From 657b9c6f8795bae609ab6120bb5cfb6ddea9e328 Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Thu, 2 Oct 2008 08:00:21 -0400 Subject: Clean up %preun, %post, and %postun scriptlets - Require chkconfig and initstripts for preun, post, and postun scripts - Conditionally restart puppet in %%postun - Ensure %%preun, %%post, and %%postun scripts exit cleanly --- puppet.spec | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/puppet.spec b/puppet.spec index f36530e..a3529f3 100644 --- a/puppet.spec +++ b/puppet.spec @@ -23,6 +23,10 @@ Requires: ruby-shadow Requires: facter >= 1.1.4 Requires: ruby >= 1.8.1 +Requires(post): chkconfig +Requires(preun): chkconfig +Requires(preun): initscripts +Requires(postun): initscripts %description Puppet lets you centrally manage every important aspect of your system using a @@ -34,6 +38,10 @@ along with obviously discrete elements like packages, services, and files. Group: System Environment/Base Summary: Server for the puppet system management tool Requires: puppet = %{version}-%{release} +Requires(post): chkconfig +Requires(preun): chkconfig +Requires(preun): initscripts +Requires(postun): initscripts %description server Provides the central puppet server daemon which provides manifests to clients. @@ -145,28 +153,33 @@ touch %{buildroot}%{_sysconfdir}/puppet/puppetd.conf if [ $1 -gt 1 ] ; then /usr/sbin/usermod -d /var/lib/puppet puppet || : fi + %post -/sbin/chkconfig --add puppet -exit 0 +/sbin/chkconfig --add puppet || : %post server -/sbin/chkconfig --add puppetmaster +/sbin/chkconfig --add puppetmaster || : %preun if [ "$1" = 0 ] ; then /sbin/service puppet stop > /dev/null 2>&1 - /sbin/chkconfig --del puppet + /sbin/chkconfig --del puppet || : fi %preun server if [ "$1" = 0 ] ; then /sbin/service puppetmaster stop > /dev/null 2>&1 - /sbin/chkconfig --del puppetmaster + /sbin/chkconfig --del puppetmaster || : +fi + +%postun +if [ "$1" -ge 1 ]; then + /sbin/service puppet condrestart >/dev/null 2>&1 || : fi %postun server if [ "$1" -ge 1 ]; then - /sbin/service puppetmaster condrestart > /dev/null 2>&1 + /sbin/service puppetmaster condrestart > /dev/null 2>&1 || : fi %clean @@ -176,6 +189,9 @@ rm -rf %{buildroot} * Wed Oct 01 2008 Todd Zullinger - 0.24.5-2 - Require ruby-shadow on Fedora and RHEL >= 5 - Simplify Fedora/RHEL version checks for ruby(abi) and BuildArch +- Require chkconfig and initstripts for preun, post, and postun scripts +- Conditionally restart puppet in %%postun +- Ensure %%preun, %%post, and %%postun scripts exit cleanly - Quiet a few rpmlint complaints - Remove useless %%pbuild macro - Make specfile more like the Fedora/EPEL template -- cgit