Use systemd macros (RHBZ #1197239)

epel9
Haikel Guemar 10 years ago
parent 86c8bf8264
commit ac936bf6ef

@ -19,7 +19,7 @@
Name: puppet Name: puppet
Version: 3.7.1 Version: 3.7.1
Release: 2%{?dist} Release: 3%{?dist}
Summary: A network tool for managing many disparate systems Summary: A network tool for managing many disparate systems
License: ASL 2.0 License: ASL 2.0
URL: http://puppetlabs.com URL: http://puppetlabs.com
@ -75,6 +75,7 @@ Requires(pre): shadow-utils
Requires(post): systemd Requires(post): systemd
Requires(preun): systemd Requires(preun): systemd
Requires(postun): systemd Requires(postun): systemd
BuildRequires: systemd
%else %else
Requires(post): chkconfig Requires(post): chkconfig
Requires(preun): chkconfig Requires(preun): chkconfig
@ -98,6 +99,7 @@ Requires: puppet = %{version}-%{release}
Requires(post): systemd Requires(post): systemd
Requires(preun): systemd Requires(preun): systemd
Requires(postun): systemd Requires(postun): systemd
BuildRequires: systemd
%else %else
Requires(post): chkconfig Requires(post): chkconfig
Requires(preun): chkconfig Requires(preun): chkconfig
@ -288,24 +290,25 @@ getent passwd puppet &>/dev/null || \
useradd -r -u 52 -g puppet -d %{_localstatedir}/lib/puppet -s /sbin/nologin \ useradd -r -u 52 -g puppet -d %{_localstatedir}/lib/puppet -s /sbin/nologin \
-c "Puppet" puppet &>/dev/null -c "Puppet" puppet &>/dev/null
# ensure that old setups have the right puppet home dir # ensure that old setups have the right puppet home dir
if [ $1 -gt 1 ] ; then if [ $1 -gt 1 ]; then
usermod -d %{_localstatedir}/lib/puppet puppet &>/dev/null usermod -d %{_localstatedir}/lib/puppet puppet &>/dev/null
fi fi
exit 0 exit 0
%post %post
%if 0%{?_with_systemd} %if 0%{?_with_systemd}
/bin/systemctl daemon-reload >/dev/null 2>&1 %systemd_post puppet.service
%else %else
# If there's a running puppet agent, restart it during upgrade. Fixes # If there's a running puppet agent, restart it during upgrade. Fixes
# BZ #1024538. # BZ #1024538.
if [ "$1" -ge 1 ]; then if [ "$1" -ge 1 ]; then
pid="%{_localstatedir}/run/puppet/agent.pid" pid="%{_localstatedir}/run/puppet/agent.pid"
if [ -e "$pid" ]; then if [ -e "$pid" ]; then
if ps aux | grep `cat "$pid"` | grep -v grep | awk '{ print $12 }' | grep -q sbin; then if ps -p "$(< "$pid")" -o cmd= | grep -q "puppet agent"; then
(kill $(< "$pid") && rm -f "$pid" && \ kill "$(< "$pid")" \
/sbin/service puppet start) >/dev/null 2>&1 && rm -f "$pid" \
fi && /sbin/service puppet start
fi &>/dev/null
fi fi
fi fi
/sbin/chkconfig --add puppet /sbin/chkconfig --add puppet
@ -314,7 +317,7 @@ exit 0
%post server %post server
%if 0%{?_with_systemd} %if 0%{?_with_systemd}
/bin/systemctl daemon-reload >/dev/null 2>&1 %systemd_post puppetmaster.service
%else %else
/sbin/chkconfig --add puppetmaster /sbin/chkconfig --add puppetmaster
%endif %endif
@ -322,24 +325,10 @@ exit 0
%preun %preun
%if 0%{?_with_systemd} %if 0%{?_with_systemd}
if [ "$1" -eq 0 ] ; then %systemd_preun puppet.service
/bin/systemctl --no-reload disable puppet.service > /dev/null 2>&1
/bin/systemctl stop puppet.service > /dev/null 2>&1
/bin/systemctl daemon-reload >/dev/null 2>&1
fi
if [ "$1" -eq 1 ]; then
/bin/systemctl is-enabled puppetagent.service > /dev/null 2>&1
if [ "$?" -eq 0 ]; then
/bin/systemctl /bin/systemctl --no-reload disable puppetagent.service > /dev/null 2>&1
/bin/systemctl stop puppetagent.service > /dev/null 2>&1
/bin/systemctl daemon-reload >/dev/null 2>&1
install -D -m 644 /dev/null %{pending_upgrade_file} > /dev/null 2>&1
fi
fi
%else %else
if [ "$1" -eq 0 ] ; then if [ "$1" -eq 0 ]; then
/sbin/service puppet stop >/dev/null 2>&1 /sbin/service puppet stop &>/dev/null
/sbin/chkconfig --del puppet /sbin/chkconfig --del puppet
fi fi
%endif %endif
@ -347,14 +336,10 @@ exit 0
%preun server %preun server
%if 0%{?_with_systemd} %if 0%{?_with_systemd}
if [ "$1" -eq 0 ] ; then %systemd_preun puppetmaster.service
/bin/systemctl --no-reload disable puppetmaster.service > /dev/null 2>&1
/bin/systemctl stop puppetmaster.service > /dev/null 2>&1
/bin/systemctl daemon-reload >/dev/null 2>&1
fi
%else %else
if [ "$1" -eq 0 ] ; then if [ "$1" -eq 0 ]; then
/sbin/service puppetmaster stop >/dev/null 2>&1 /sbin/service puppetmaster stop &>/dev/null
/sbin/chkconfig --del puppetmaster /sbin/chkconfig --del puppetmaster
fi fi
%endif %endif
@ -362,30 +347,20 @@ exit 0
%postun %postun
%if 0%{?_with_systemd} %if 0%{?_with_systemd}
if [ "$1" -ge 1 ] ; then %systemd_postun_with_restart puppet.service
/bin/systemctl try-restart puppet.service >/dev/null 2>&1
if [ -e %{pending_upgrade_file} ]; then
/bin/systemctl --no-reload enable puppet.service > /dev/null 2>&1
/bin/systemctl start puppet.service > /dev/null 2>&1
/bin/systemctl daemon-reload >/dev/null 2>&1
rm %{pending_upgrade_file}
fi
fi
%else %else
if [ "$1" -ge 1 ]; then if [ "$1" -ge 1 ]; then
/sbin/service puppet condrestart >/dev/null 2>&1 /sbin/service puppet condrestart &>/dev/null
fi fi
%endif %endif
exit 0 exit 0
%postun server %postun server
%if 0%{?_with_systemd} %if 0%{?_with_systemd}
if [ "$1" -ge 1 ] ; then %systemd_postun_with_restart puppetmaster.service
/bin/systemctl try-restart puppetmaster.service >/dev/null 2>&1
fi
%else %else
if [ "$1" -ge 1 ]; then if [ "$1" -ge 1 ]; then
/sbin/service puppetmaster condrestart >/dev/null 2>&1 /sbin/service puppetmaster condrestart &>/dev/null
fi fi
%endif %endif
exit 0 exit 0
@ -394,6 +369,9 @@ exit 0
rm -rf %{buildroot} rm -rf %{buildroot}
%changelog %changelog
* Sat Feb 28 2015 Haïkel Guémar <hguemar@fedoraproject.org> - 3.7.1-3
- Use systemd macros (RHBZ #1197239)
* Tue Sep 30 2014 Orion Poplawski <orion@cora.nwra.com> - 3.7.1-2 * Tue Sep 30 2014 Orion Poplawski <orion@cora.nwra.com> - 3.7.1-2
- Drop server deps and configuration changes (bug #1144298) - Drop server deps and configuration changes (bug #1144298)

Loading…
Cancel
Save