scylladb / scylla-jmx

Scylla JMX proxy
GNU Affero General Public License v3.0
29 stars 52 forks source link

dist/redhat: systemd macro still not same with CentOS7 one #94

Closed syuu1228 closed 3 years ago

syuu1228 commented 4 years ago

As @avikivity pointed out at https://github.com/scylladb/scylla-jmx/pull/92#discussion_r363678653, Fedora 31 version of systemd macros does not work correctly on CentOS7, since CentOS7 does not support "file trigger" feature. Even after https://github.com/scylladb/scylla-jmx/commit/05d437893e07eecc8b946186217b71b13e155f29, scriptlets on old scylla .rpm and new scylla .rpm is not completely same (attached diff)

I think it's better to align with CentOS7 macro.

--- /home/syuu/scriptlet.enterprise     2020-01-17 00:57:57.186990306 +0900
+++ /home/syuu/scriptlet.oss    2020-01-17 00:58:04.932009972 +0900
@@ -12,17 +12,16 @@
 fi
 postinstall scriptlet (using /bin/sh):

-if [ $1 -eq 1 ] ; then
+
+if [ $1 -eq 1 ] && [ -x /usr/bin/systemctl ] ; then
         # Initial installation
-        systemctl preset scylla-jmx.service >/dev/null 2>&1 || :
+        /usr/bin/systemctl --no-reload preset scylla-jmx.service || :
 fi
 preuninstall scriptlet (using /bin/sh):

-if [ $1 -eq 0 ] ; then
+
+if [ $1 -eq 0 ] && [ -x /usr/bin/systemctl ] ; then
         # Package removal, not upgrade
-        systemctl --no-reload disable scylla-jmx.service > /dev/null 2>&1 || :
-        systemctl stop scylla-jmx.service > /dev/null 2>&1 || :
+        /usr/bin/systemctl --no-reload disable --now scylla-jmx.service || : 
 fi
-postuninstall scriptlet (using /bin/sh):
-
-systemctl daemon-reload >/dev/null 2>&1 || :
+postuninstall program: /bin/sh