2018-12-28 18:12:45 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
echo "---Hyperion ambient light prerm ---"
|
|
|
|
|
|
|
|
# search for users in system, returns first entry
|
|
|
|
FOUND_USR=`who | grep -o '^\w*\b'` || "root"
|
|
|
|
|
|
|
|
# stop running daemon before we delete it
|
|
|
|
HYPERION_RUNNING=false
|
|
|
|
pgrep hyperiond > /dev/null 2>&1 && HYPERION_RUNNING=true
|
|
|
|
|
|
|
|
if grep -m1 systemd /proc/1/comm > /dev/null
|
|
|
|
then
|
2019-01-07 23:33:27 +01:00
|
|
|
echo "---> stop init deamon: systemd"
|
2018-12-28 18:12:45 +01:00
|
|
|
# systemd
|
|
|
|
$HYPERION_RUNNING && systemctl stop hyperiond"@${FOUND_USR}" 2> /dev/null
|
|
|
|
# disable user specific symlink
|
2019-01-07 23:33:27 +01:00
|
|
|
echo "---> Disable service and remove entry"
|
2018-12-28 18:12:45 +01:00
|
|
|
systemctl -q disable hyperiond"@${FOUND_USR}"
|
|
|
|
rm -v /etc/systemd/system/hyperiond@.service 2>/dev/null
|
|
|
|
|
|
|
|
elif [ -e /sbin/initctl ]
|
|
|
|
then
|
2019-01-07 23:33:27 +01:00
|
|
|
echo "---> stop init deamon: upstart"
|
2018-12-28 18:12:45 +01:00
|
|
|
# upstart
|
|
|
|
$HYPERION_RUNNING && initctl stop hyperiond
|
2019-01-07 23:33:27 +01:00
|
|
|
echo "---> Remove upstart service"
|
2018-12-28 18:12:45 +01:00
|
|
|
rm -v /etc/init/hyperion* 2>/dev/null
|
|
|
|
initctl reload-configuration
|
|
|
|
|
|
|
|
else
|
2019-01-07 23:33:27 +01:00
|
|
|
echo "---> stop init deamon: sysV"
|
2018-12-28 18:12:45 +01:00
|
|
|
# sysV
|
|
|
|
$HYPERION_RUNNING && service hyperiond stop 2>/dev/null
|
2019-01-07 23:33:27 +01:00
|
|
|
echo "---> Remove sysV service"
|
2018-12-28 18:12:45 +01:00
|
|
|
update-rc.d -f hyperion remove
|
|
|
|
rm /etc/init.d/hyperion* 2>/dev/null
|
|
|
|
fi
|
|
|
|
|
2019-01-07 23:33:27 +01:00
|
|
|
# In case we don't use a service kill all instances
|
|
|
|
killall hyperiond 2> /dev/null
|
|
|
|
|
|
|
|
exit 0
|