mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
even more changes
Signed-off-by: Paulchen-Panther <Paulchen--Panter@gmx.net>
This commit is contained in:
@@ -1,51 +1,56 @@
|
||||
#!/bin/sh
|
||||
|
||||
# check which init script we should use
|
||||
USE_SYSTEMD=`grep -m1 -c systemd /proc/1/comm`
|
||||
USE_INITCTL=`which /sbin/initctl | wc -l`
|
||||
USE_SERVICE=`which /usr/sbin/service | wc -l`
|
||||
echo "---Hyperion ambient light preinst ---"
|
||||
|
||||
#check for hyperion install
|
||||
if [ -d /usr/share/hyperion/bin ];then
|
||||
if [ -e /etc/hyperion/hyperion.config.json ];then
|
||||
file=`grep -m1 -c '"general"' /etc/hyperion/hyperion.config.json`
|
||||
if [ $file -ne 1 ]; then
|
||||
echo "--> It seems you are running an old version of Hyperion (1.X). Will create a backup at /usr/share/hyperion/Backup_Hyperion_1.0 and reset configuration / system service"
|
||||
|
||||
# Stop hyperion daemon if it is running
|
||||
echo '---> Stop Hyperion, if necessary'
|
||||
if [ $USE_SYSTEMD -eq 1 ]; then
|
||||
service hyperion stop 2>/dev/null
|
||||
elif [ $USE_INITCTL -eq 1 ]; then
|
||||
/sbin/initctl stop hyperion 2>/dev/null
|
||||
elif [ $USE_SERVICE -eq 1 ]; then
|
||||
/usr/sbin/service hyperion stop 2>/dev/null
|
||||
fi
|
||||
|
||||
#Backup
|
||||
echo "--> Move old config(s) and files to /usr/share/hyperion/Backup_Hyperion_1.0"
|
||||
mkdir /usr/share/hyperion/Backup_Hyperion_1.0
|
||||
mv /usr/share/hyperion /usr/share/hyperion/Backup_Hyperion_1.0
|
||||
mv /etc/hyperion/* /usr/share/hyperion/Backup_Hyperion_1.0
|
||||
# search for users in system, returns first entry
|
||||
FOUND_USR=`who | grep -o '^\w*\b'` || "root"
|
||||
|
||||
#Disabling and delete service files
|
||||
if [ $USE_SYSTEMD -eq 1 ]; then
|
||||
# Delete and disable Hyperion systemd script
|
||||
echo '---> Delete and disable Hyperion systemd service'
|
||||
systemctl disable hyperion.service
|
||||
rm -v /etc/systemd/system/hyperion* 2>/dev/null
|
||||
elif [ $USE_INITCTL -eq 1 ]; then
|
||||
echo '---> Delete and disable Hyperion initctl script'
|
||||
rm -v /etc/init/hyperion* 2>/dev/null
|
||||
initctl reload-configuration
|
||||
elif [ $USE_SERVICE -eq 1 ]; then
|
||||
# Delete and disable Hyperion init.d script
|
||||
echo '---> Delete and disable Hyperion init.d script'
|
||||
update-rc.d -f hyperion remove
|
||||
rm /etc/init.d/hyperion* 2>/dev/null
|
||||
fi
|
||||
|
||||
echo "--> Hyperion 1.0 installation has been moved"
|
||||
fi
|
||||
# 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
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
#$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);
|
||||
|
Reference in New Issue
Block a user