mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
17019575f6
git-svn-id: https://svn.fhem.de/fhem/trunk@15784 2b470e98-0d58-463d-a4d8-8e2adae1ed80
41 lines
939 B
Bash
41 lines
939 B
Bash
#!/bin/bash
|
|
# $Id$
|
|
set -e
|
|
|
|
user_exists=$(id -u fhem > /dev/null 2>&1; echo $?)
|
|
if [ "$user_exists" -eq "1" ]; then
|
|
echo "creating user fhem"
|
|
useradd --system --home /opt/fhem --gid dialout --shell /bin/false fhem
|
|
fi
|
|
|
|
chown -R fhem:dialout /opt/fhem
|
|
|
|
# remove repository entry after first installation
|
|
sed -i /debian.fhem.de/d /etc/apt/sources.list
|
|
|
|
# set up of autostart
|
|
# systemd: supported
|
|
# sysvinit: supported
|
|
# upstart: not supported
|
|
|
|
# detect init system
|
|
test=$(stat /sbin/init |grep "/sbin/init")
|
|
re="systemd$"
|
|
|
|
if [[ $test =~ $re ]];
|
|
then
|
|
cp /opt/fhem/contrib/init-scripts/fhem.service /etc/systemd/system
|
|
systemctl daemon-reload
|
|
systemctl enable fhem.service
|
|
systemctl start fhem.service
|
|
else
|
|
cp /opt/fhem/contrib/init-scripts/fhem.3 /etc/init.d/fhem
|
|
chmod ugo+x /etc/init.d/fhem
|
|
update-rc.d fhem defaults
|
|
if test -f /etc/init.d/fhem; then
|
|
/etc/init.d/fhem start noaptmark
|
|
fi
|
|
fi
|
|
|
|
exit 0
|