@@ -9,7 +9,7 @@ if [ "$2" = "in-favour" ]; then
99fi
1010
1111# Don't clean-up just for an upgrade.`
12- if [ " $action " = " upgrade" ] ; then
12+ if [ " $UPGRADE " = " upgrade" ] ; then
1313 exit 0
1414fi
1515
@@ -22,27 +22,33 @@ pgrep hyperiond > /dev/null 2>&1 && HYPERION_RUNNING=true
2222
2323if grep -m1 systemd /proc/1/comm > /dev/null
2424then
25- echo " ---> stop init deamon: systemd"
2625 # systemd
27- $HYPERION_RUNNING && systemctl stop hyperion hyperiond" @${FOUND_USR} " hyperion" @${FOUND_USR} " " hyperiond@root" " hyperion@root" 2> /dev/null
26+ echo " ---> stop init deamon: systemd"
27+ CURRENT_SERVICE=$( systemctl list-units --all | { grep -o " hyperion*.*\.service" || true ; })
28+ if [ ! -z ${CURRENT_SERVICE} ]; then
29+ $HYPERION_RUNNING && systemctl stop " ${CURRENT_SERVICE} " 2> /dev/null
30+ systemctl -q disable " ${CURRENT_SERVICE} " 2> /dev/null
31+ else
32+ $HYPERION_RUNNING && systemctl stop hyperion hyperiond" @${FOUND_USR} " hyperion" @${FOUND_USR} " " hyperiond@root" " hyperion@root" 2> /dev/null
33+ systemctl -q disable hyperion hyperiond" @${FOUND_USR} " hyperion" @${FOUND_USR} " " hyperiond@root" " hyperion@root" 2> /dev/null
34+ fi
2835 # disable user specific symlink
2936 echo " ---> Disable service and remove entry"
30- systemctl -q disable hyperion hyperiond" @${FOUND_USR} " hyperion" @${FOUND_USR} " " hyperiond@root" " hyperion@root" 2> /dev/null
3137 rm -v /etc/systemd/system/hyperion.service /etc/systemd/system/hyperiond@.service /etc/systemd/system/hyperion@.service 2> /dev/null
3238
3339elif [ -e /sbin/initctl ]
3440then
35- echo " ---> stop init deamon: upstart"
3641 # upstart
42+ echo " ---> stop init deamon: upstart"
3743 $HYPERION_RUNNING && initctl stop hyperiond
3844 $HYPERION_RUNNING && initctl stop hyperion
3945 echo " ---> Remove upstart service"
4046 rm -v /etc/init/hyperion* 2> /dev/null
4147 initctl reload-configuration
4248
4349else
44- echo " ---> stop init deamon: sysV"
4550 # sysV
51+ echo " ---> stop init deamon: sysV"
4652 $HYPERION_RUNNING && service hyperiond stop 2> /dev/null
4753 $HYPERION_RUNNING && service hyperion stop 2> /dev/null
4854 echo " ---> Remove sysV service"
0 commit comments