diff --git a/fhem/FHEM/10_FS20.pm b/fhem/FHEM/10_FS20.pm index 88aeac374..c126126f8 100755 --- a/fhem/FHEM/10_FS20.pm +++ b/fhem/FHEM/10_FS20.pm @@ -89,6 +89,8 @@ my %models = ( fs20usr => 'simple', ); +sub hex2four($); +sub four2hex($$); sub FS20_Initialize($) diff --git a/fhem/Makefile b/fhem/Makefile index 1d94a3ff2..2cca7228e 100644 --- a/fhem/Makefile +++ b/fhem/Makefile @@ -72,8 +72,6 @@ deb: rm -rf .f make ROOT=`pwd`/.f install cp -r contrib/DEBIAN .f - mkdir .f/etc/init - cp contrib/init-scripts/fhem.upstart .f/etc/init/fhem.conf find .f -name CVS -print | xargs rm -rf find .f -name example.CVS -print | xargs rm -rf find .f -name \*.orig -print | xargs rm -f diff --git a/fhem/contrib/DEBIAN/postinst b/fhem/contrib/DEBIAN/postinst index bfb984811..5d6d37227 100644 --- a/fhem/contrib/DEBIAN/postinst +++ b/fhem/contrib/DEBIAN/postinst @@ -1,13 +1,24 @@ #!/bin/sh -# Don't know how to check presence of fhem in passwd with -e -#set -e +set -e -grep -q fhem /etc/passwd -e=$? - -if test ! $e = 0; then - useradd --system --home /var/log/fhem --shell /bin/false fhem +if ! getent passwd fhem >/dev/null; then + useradd --system --home /var/log/fhem --shell /bin/false fhem fi + chown -R fhem /var/log/fhem /etc/fhem.cfg -initctl start fhem + +#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 diff --git a/fhem/contrib/DEBIAN/postrm b/fhem/contrib/DEBIAN/postrm index 0cbf1c310..59b1d2d31 100755 --- a/fhem/contrib/DEBIAN/postrm +++ b/fhem/contrib/DEBIAN/postrm @@ -3,8 +3,13 @@ set -e if grep -q fhem /etc/passwd; then - userdel fhem + userdel fhem fi + if test -f /etc/init/fhem.conf; then - rm /etc/init/fhem.conf + rm /etc/init/fhem.conf +fi +if test -f /etc/init.d/fhem; then + update-rc.d fhem remove + rm /etc/init.d/fhem fi diff --git a/fhem/contrib/DEBIAN/prerm b/fhem/contrib/DEBIAN/prerm index 0facdb209..f5d3f8c1d 100755 --- a/fhem/contrib/DEBIAN/prerm +++ b/fhem/contrib/DEBIAN/prerm @@ -1,6 +1,11 @@ #!/bin/sh set -e + if pgrep fhem.pl >/dev/null; then - initctl stop fhem + if test -x /sbin/initctl; then + initctl stop fhem + else + invoke-rc.d fhem stop + fi fi diff --git a/fhem/contrib/executables b/fhem/contrib/executables index d0784ba8b..b5867828a 100644 --- a/fhem/contrib/executables +++ b/fhem/contrib/executables @@ -10,6 +10,7 @@ .f/usr/share/fhem/contrib/getstate/fhem-getstate .f/usr/share/fhem/contrib/init-scripts/fhem.1 .f/usr/share/fhem/contrib/init-scripts/fhem.2 +.f/usr/share/fhem/contrib/init-scripts/fhem.3 .f/usr/share/fhem/contrib/km271.pl .f/usr/share/fhem/contrib/ks300avg.pl .f/usr/share/fhem/contrib/rolwzo_not_off.sh diff --git a/fhem/contrib/init-scripts/fhem.3 b/fhem/contrib/init-scripts/fhem.3 new file mode 100644 index 000000000..97afe71a7 --- /dev/null +++ b/fhem/contrib/init-scripts/fhem.3 @@ -0,0 +1,44 @@ +#!/bin/sh +# description: Start or stop the fhem server +# Added by Alex Peuchert + +### BEGIN INIT INFO +# Provides: fhem.pl +# Required-Start: $local_fs $remote_fs +# Required-Stop: $local_fs $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: FHEM server +### END INIT INFO + +set -e + +fhz=/usr/bin/fhem.pl +conf=/etc/fhem.cfg +port=7072 + +case "$1" in +'start') + echo "Starting fhem..." + $fhz $conf + RETVAL=$? + ;; +'stop') + echo "Stopping fhem..." + $fhz $port "shutdown" + RETVAL=$? + ;; +'status') + cnt=`ps -ef | grep "fhem.pl" | grep -v grep | wc -l` + if [ "$cnt" -eq "0" ] ; then + echo "fhem is not running" + else + echo "fhem is running" + fi + ;; +*) + echo "Usage: $0 { start | stop | status }" + RETVAL=1 + ;; +esac +exit $RETVAL diff --git a/fhem/docs/changelog b/fhem/docs/changelog index 57f1fda88..838f90923 100644 --- a/fhem/docs/changelog +++ b/fhem/docs/changelog @@ -1,6 +1,14 @@ -fhem (4.10) +fhem (5.0-1) unstable; urgency=low + + * Making .dep compatible for Debian Squeeze and for Ubuntu Lucid + init script is copied from contrib/initscripts + prerm deletes the initscripts + + -- Alex Peuchert Thu, 30 Sep 2010 11:00:00 +0200 + +fhem (4.10) unstable; urgency=low * Trying to make Debian package lintian clean. * First release - -- Rudolf Koenig 2010-08-01 + -- Rudolf Koenig Sun, 1 Aug 2010 00:00:00 +0200 diff --git a/fhem/fhem.pl b/fhem/fhem.pl index 08c7e2fb0..6ad64bdbc 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -160,7 +160,7 @@ my $nextat; # Time when next timer will be triggered. my $intAtCnt=0; my %duplicate; # Pool of received msg for multi-fhz/cul setups my $duplidx=0; # helper for the above pool -my $cvsid = '$Id: fhem.pl,v 1.110 2010-08-14 10:35:12 rudolfkoenig Exp $'; +my $cvsid = '$Id: fhem.pl,v 1.111 2010-09-30 13:12:27 rudolfkoenig Exp $'; my $namedef = "where is either:\n" . "- a single device name\n" . @@ -2253,5 +2253,3 @@ ReadingsVal($$$) } return $default; } - -