@@ -9,7 +9,7 @@ if [ "$2" = "in-favour" ]; then
9
9
fi
10
10
11
11
# Don't clean-up just for an upgrade.`
12
- if [ " $action " = " upgrade" ] ; then
12
+ if [ " $UPGRADE " = " upgrade" ] ; then
13
13
exit 0
14
14
fi
15
15
@@ -22,27 +22,33 @@ pgrep hyperiond > /dev/null 2>&1 && HYPERION_RUNNING=true
22
22
23
23
if grep -m1 systemd /proc/1/comm > /dev/null
24
24
then
25
- echo " ---> stop init deamon: systemd"
26
25
# 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
28
35
# disable user specific symlink
29
36
echo " ---> Disable service and remove entry"
30
- systemctl -q disable hyperion hyperiond" @${FOUND_USR} " hyperion" @${FOUND_USR} " " hyperiond@root" " hyperion@root" 2> /dev/null
31
37
rm -v /etc/systemd/system/hyperion.service /etc/systemd/system/hyperiond@.service /etc/systemd/system/hyperion@.service 2> /dev/null
32
38
33
39
elif [ -e /sbin/initctl ]
34
40
then
35
- echo " ---> stop init deamon: upstart"
36
41
# upstart
42
+ echo " ---> stop init deamon: upstart"
37
43
$HYPERION_RUNNING && initctl stop hyperiond
38
44
$HYPERION_RUNNING && initctl stop hyperion
39
45
echo " ---> Remove upstart service"
40
46
rm -v /etc/init/hyperion* 2> /dev/null
41
47
initctl reload-configuration
42
48
43
49
else
44
- echo " ---> stop init deamon: sysV"
45
50
# sysV
51
+ echo " ---> stop init deamon: sysV"
46
52
$HYPERION_RUNNING && service hyperiond stop 2> /dev/null
47
53
$HYPERION_RUNNING && service hyperion stop 2> /dev/null
48
54
echo " ---> Remove sysV service"
0 commit comments