]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
restart rrdcached on upgrade, start and stop in install/uninstall (#764)
authorTomas Vestelind <tomas.vestelind@gmail.com>
Wed, 25 Jan 2017 17:30:27 +0000 (18:30 +0100)
committerTobias Oetiker <tobi@oetiker.ch>
Wed, 25 Jan 2017 17:30:27 +0000 (18:30 +0100)
* restart rrdcached on upgrade, start and stop in install/uninstall

Start rrdcached and enable autostart when installing
Restart rrdcached and enable autostart when upgrading
Stop rrdcached and disable autostart when uninstalling

Catch non-zero return codes and return 0 in scriptlets

Signed-off-by: Tomas Vestelind <tomas.vestelind@gmail.com>
* enable and restart on both install and upgrade just before finishing the rpm installation

Signed-off-by: Tomas Vestelind <tomas.vestelind@gmail.com>
rrdtool.spec

index 6873163bf9baed212b7624ec1fb2c471893482d1..bb639a2c2beb454d7c42c676e4353efc30875c1b 100644 (file)
@@ -317,18 +317,32 @@ find examples/ -type f -exec chmod 0644 {} \;
 %post -p /sbin/ldconfig
 
 %post cached
-/sbin/chkconfig --add rrdcached
-/sbin/service rrdcached start
+/sbin/chkconfig --add rrdcached || :
+if [ $1 -lt 2 ] # Installing
+then
+    /sbin/service rrdcached start || :
+else # Upgrading
+    /sbin/service rrdcached restart || :
+fi
+
+%posttrans
+/sbin/chkconfig --add rrdcached || :
+/sbin/service rrdcached restart || :
 
 %preun cached
-/sbin/service rrdcached stop
+if [ $1 -lt 1 ] # Uninstalling
+then
+    /sbin/service rrdcached stop || :
+    /sbin/chkconfig --del rrdcached || :
+fi
 
 %postun -p /sbin/ldconfig
 
 %postun cached
-/sbin/chkconfig --del rrdcached
-test "$1" != 0 || /usr/sbin/userdel %rrdcached_user &>/dev/null || :
-#test "$1" != 0 || /usr/sbin/groupdel %rrdcached_user &>/dev/null || :
+if [ $1 -lt 1 ] # Uninstalling
+then
+    /usr/sbin/userdel %rrdcached_user &>/dev/null || :
+fi
 
 %files
 %defattr(-,root,root,-)