2010-08-02 12:47:55 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2010-09-30 13:12:28 +00:00
|
|
|
set -e
|
2010-08-02 12:47:55 +00:00
|
|
|
|
2010-09-30 13:12:28 +00:00
|
|
|
if ! getent passwd fhem >/dev/null; then
|
|
|
|
useradd --system --home /var/log/fhem --shell /bin/false fhem
|
2010-08-02 12:47:55 +00:00
|
|
|
fi
|
2010-09-30 13:12:28 +00:00
|
|
|
|
2010-08-02 12:47:55 +00:00
|
|
|
chown -R fhem /var/log/fhem /etc/fhem.cfg
|
2010-09-30 13:12:28 +00:00
|
|
|
|
|
|
|
#set up of autostart
|
|
|
|
if test -x /sbin/initctl; then
|
|
|
|
# upstart
|
|
|
|
mkdir -p /etc/init
|
|
|
|
cp /usr/share/fhem/contrib/init-scripts/fhem.upstart /etc/init/fhem.conf
|
|
|
|
initctl start fhem
|
|
|
|
else
|
|
|
|
# Sysvinit
|
|
|
|
mkdir -p /etc/init.d
|
|
|
|
cp /usr/share/fhem/contrib/init-scripts/fhem.3 /etc/init.d/fhem
|
|
|
|
chmod ugo+x /etc/init.d/fhem
|
|
|
|
update-rc.d fhem defaults
|
|
|
|
invoke-rc.d fhem start
|
|
|
|
fi
|