2019-08-03 17:20:03 +02:00
|
|
|
#!/bin/sh
|
2017-02-08 14:36:28 +01:00
|
|
|
|
2018-12-28 18:12:45 +01:00
|
|
|
echo "---Hyperion ambient light preinst ---"
|
|
|
|
|
|
|
|
# search for users in system, returns first entry
|
2019-08-10 12:30:08 +02:00
|
|
|
FOUND_USR=`who | grep -o -m1 '^\w*\b'` || "root"
|
2018-12-28 18:12:45 +01:00
|
|
|
|
|
|
|
# stop running daemon before we install
|
|
|
|
if pgrep hyperiond > /dev/null 2>&1
|
|
|
|
then
|
|
|
|
if grep -m1 systemd /proc/1/comm > /dev/null
|
|
|
|
then
|
|
|
|
echo "--> stop init deamon: systemd"
|
|
|
|
# systemd
|
|
|
|
systemctl stop hyperiond"@${FOUND_USR}" 2> /dev/null
|
|
|
|
|
|
|
|
elif [ -e /sbin/initctl ]
|
|
|
|
then
|
|
|
|
echo "--> stop init deamon: upstart"
|
|
|
|
# upstart
|
|
|
|
initctl stop hyperiond
|
|
|
|
|
|
|
|
else
|
|
|
|
echo "--> stop init deamon: sysV"
|
|
|
|
# sysV
|
|
|
|
service hyperiond stop 2>/dev/null
|
2017-02-08 14:36:28 +01:00
|
|
|
fi
|
|
|
|
fi
|
2018-12-28 18:12:45 +01:00
|
|
|
|
2019-01-07 23:33:27 +01:00
|
|
|
# In case we don't use a service kill all instances
|
|
|
|
killall hyperiond 2> /dev/null
|
|
|
|
|
|
|
|
# overwrite last return code
|
|
|
|
exit 0
|
2018-12-28 18:12:45 +01:00
|
|
|
|
|
|
|
#$USR=hyperionIS;
|
|
|
|
|
|
|
|
#addToGroup()
|
|
|
|
##{
|
|
|
|
# getent group $1 && adduser $USR $1;
|
|
|
|
#}
|
|
|
|
|
|
|
|
#check if user exists
|
|
|
|
#if id $USR >/dev/null 2>&1; then
|
|
|
|
# echo "--> hyperion user exists, skip creation";
|
|
|
|
#else
|
|
|
|
## create user
|
|
|
|
# echo "--> Create Hyperion user";
|
|
|
|
# adduser --system --group $USR;
|
|
|
|
#fi
|
|
|
|
|
|
|
|
# add user to groups if required
|
|
|
|
## secondary user groups that are required to access system things
|
|
|
|
#addToGroup(dialout);
|
|
|
|
#addToGroup(video);
|
|
|
|
#addToGroup(audio);
|
|
|
|
#addToGroup(systemd-journal);
|
|
|
|
# platform specific groups
|
|
|
|
#addToGroup(i2c);
|
|
|
|
#addToGroup(spi);
|
|
|
|
#addToGroup(gpio);
|