From e40175b3c006cace46e4050426a53a8dca33253c Mon Sep 17 00:00:00 2001 From: marschap Date: Fri, 2 May 2008 11:10:28 +0000 Subject: [PATCH] fix LSB init headers; add pidfile & configfile handling to debian init scripts --- ChangeLog | 1 + scripts/debian/control | 2 +- scripts/debian/lcdproc.LCDd.default | 5 ++++- scripts/debian/lcdproc.LCDd.init | 20 ++++++++++++++++++-- scripts/debian/lcdproc.default | 3 +++ scripts/debian/lcdproc.init | 24 ++++++++++++++++++++---- scripts/debian/lcdproc.lcdexec.default | 3 +++ scripts/debian/lcdproc.lcdexec.init | 24 ++++++++++++++++++++---- scripts/debian/lcdproc.lcdvc.default | 3 +++ scripts/debian/lcdproc.lcdvc.init | 24 ++++++++++++++++++++---- scripts/debian/rules | 6 +++--- scripts/init-LCDd.LSB.in | 3 ++- scripts/init-LCDd.debian.in | 2 +- scripts/init-lcdexec.LSB.in | 3 ++- scripts/init-lcdexec.debian.in | 2 +- scripts/init-lcdproc.LSB.in | 3 ++- scripts/init-lcdproc.debian.in | 2 +- scripts/init-lcdvc.LSB.in | 3 ++- scripts/init-lcdvc.debian.in | 2 +- 19 files changed, 108 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index d5c5f07..987e87e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -47,6 +47,7 @@ v.0.5dev (ongoing development) * hd44780 driver: "euro" character mapping table (Markus Dolze) * CwLnx driver: support for CW12832 + new driver mx5000 for Logitech MX5000 keyboards (Christian Jodar) + * update debian inits scripts to allow multiple instances of clients v.0.5.2 * fix switching on/off the Load screen in lcdproc client using the menu diff --git a/scripts/debian/control b/scripts/debian/control index 81c77cd..221e2d8 100644 --- a/scripts/debian/control +++ b/scripts/debian/control @@ -4,7 +4,7 @@ Priority: extra Maintainer: Jose Luis Tallon Build-Depends: debhelper (>= 5.0.0), pkg-config, xmlto, libncurses5-dev, libusb-dev (>= 0.1.8), libsvga1-dev, libxosd-dev Uploaders: Jonathan Oxer -Standards-Version: 3.7.2.0 +Standards-Version: 3.7.3 Package: lcdproc Architecture: any diff --git a/scripts/debian/lcdproc.LCDd.default b/scripts/debian/lcdproc.LCDd.default index 5968bd1..b614096 100644 --- a/scripts/debian/lcdproc.LCDd.default +++ b/scripts/debian/lcdproc.LCDd.default @@ -3,7 +3,10 @@ # shall LCDd be started (yes/no) START=no +# config file +#CONFIGFILE=/etc/lcdproc/LCDd.conf + # options for LCDd startup -OPTIONS="-c /etc/lcdproc/LCDd.conf" +OPTIONS="" # EOF diff --git a/scripts/debian/lcdproc.LCDd.init b/scripts/debian/lcdproc.LCDd.init index eacf3b4..f38cdf9 100644 --- a/scripts/debian/lcdproc.LCDd.init +++ b/scripts/debian/lcdproc.LCDd.init @@ -1,11 +1,12 @@ #! /bin/sh -#### BEGIN INIT INFO +### BEGIN INIT INFO # Provides: LCDd # Required-Start: $syslog $local_fs $network $remote_fs # Required-Stop: $syslog $local_fs $network $remote_fs +# Should-Start: udev # Default-Start: 2 3 4 5 -# Default-Stop: S 0 1 6 +# Default-Stop: 0 1 6 # Short-Description: LCDproc Server Daemon # Description: Debian init script for LCDd, the display # server daemon in the LCDproc suite @@ -19,6 +20,9 @@ NAME=${NAME:-LCDd} DAEMON=/usr/sbin/LCDd DESC="LCDproc display server daemon" DEFAULTS=/etc/default/$NAME +CONFIGFILE=/etc/lcdproc/$NAME.conf +PIDFILE=/var/run/$NAME.pid +OPTIONS="" START=yes # Source defaults file; edit that file to configure this script. @@ -26,6 +30,18 @@ if [ -e "${DEFAULTS}" ]; then . "${DEFAULTS}" fi +# try to get PID file name from config file (not used yet) +if [ -f "${CONFIGFILE:=/etc/lcdproc/$NAME.conf}" ]; then + PIDFILE=`grep -i '^[:space:]*PidFile[:space:]*=' ${CONFIGFILE} \ + | head -n1 \ + | cut -d= -f2- \ + | sed -e 's,^[:space:]*\(.*\)[:space:]*$,\1,'` + OPTIONS="${OPTIONS} -c ${CONFIGFILE}" +fi + +# if necessary set default PID file name (not used yet) +PIDFILE=${PIDFILE:-/var/run/$NAME.pid} + # If we're not to start the daemon, simply exit if [ "${START}" != "yes" ]; then exit 0 diff --git a/scripts/debian/lcdproc.default b/scripts/debian/lcdproc.default index 84a8de3..4e6faa5 100644 --- a/scripts/debian/lcdproc.default +++ b/scripts/debian/lcdproc.default @@ -3,6 +3,9 @@ # shall lcdproc be started (yes/no) START=no +# config file +#CONFIGFILE=/etc/lcdproc/lcdproc.conf + # options for lcdproc startup #OPTIONS="C G" diff --git a/scripts/debian/lcdproc.init b/scripts/debian/lcdproc.init index 04aaed3..09115ad 100644 --- a/scripts/debian/lcdproc.init +++ b/scripts/debian/lcdproc.init @@ -1,11 +1,12 @@ #! /bin/sh -#### BEGIN INIT INFO +### BEGIN INIT INFO # Provides: lcdproc # Required-Start: $syslog $local_fs $network $remote_fs # Required-Stop: $syslog $local_fs $network $remote_fs +# Should-Start: LCDd # Default-Start: 2 3 4 5 -# Default-Stop: S 0 1 6 +# Default-Stop: 0 1 6 # Short-Description: LCDproc system status information viewer # Description: Debian init script for lcdproc, the system # status information viewer in the LCDproc suite @@ -19,6 +20,9 @@ NAME=${NAME:-lcdproc} DAEMON=/usr/bin/lcdproc DESC="LCDproc system status monitor" DEFAULTS=/etc/default/$NAME +CONFIGFILE=/etc/lcdproc/$NAME.conf +PIDFILE=/var/run/$NAME.pid +OPTIONS="" START=yes # Source defaults file; edit that file to configure this script. @@ -26,6 +30,18 @@ if [ -e "${DEFAULTS}" ]; then . "${DEFAULTS}" fi +# try to get PID file name from config file +if [ -f "${CONFIGFILE:=/etc/lcdproc/$NAME.conf}" ]; then + PIDFILE=`grep -i '^[:space:]*PidFile[:space:]*=' ${CONFIGFILE} \ + | head -n1 \ + | cut -d= -f2- \ + | sed -e 's,^[:space:]*\(.*\)[:space:]*$,\1,'` + OPTIONS="${OPTIONS} -c ${CONFIGFILE}" +fi + +# if necessary set default PID file name +PIDFILE=${PIDFILE:-/var/run/$NAME.pid} + # If we're not to start the daemon, simply exit if [ "${START}" != "yes" ]; then exit 0 @@ -41,12 +57,12 @@ test -x $DAEMON || exit 5 case "$1" in start) log_daemon_msg "Starting $DESC" "$NAME" - start_daemon $DAEMON $OPTIONS + start_daemon -p $PIDFILE $DAEMON $OPTIONS log_end_msg $? ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" - killproc $DAEMON + killproc -p $PIDFILE $DAEMON log_end_msg $? ;; restart|reload|force-reload) diff --git a/scripts/debian/lcdproc.lcdexec.default b/scripts/debian/lcdproc.lcdexec.default index 90fee91..bd54d0f 100644 --- a/scripts/debian/lcdproc.lcdexec.default +++ b/scripts/debian/lcdproc.lcdexec.default @@ -3,6 +3,9 @@ # shall lcdexec be started (yes/no) START=no +# config file +#CONFIGFILE=/etc/lcdproc/lcdexec.conf + # options for lcdexec startup #OPTIONS="" diff --git a/scripts/debian/lcdproc.lcdexec.init b/scripts/debian/lcdproc.lcdexec.init index 58ad608..d344929 100644 --- a/scripts/debian/lcdproc.lcdexec.init +++ b/scripts/debian/lcdproc.lcdexec.init @@ -1,11 +1,12 @@ #! /bin/sh -#### BEGIN INIT INFO +### BEGIN INIT INFO # Provides: lcdexec # Required-Start: $syslog $local_fs $network $remote_fs # Required-Stop: $syslog $local_fs $network $remote_fs +# Should-Start: LCDd # Default-Start: 2 3 4 5 -# Default-Stop: S 0 1 6 +# Default-Stop: 0 1 6 # Short-Description: LCDproc program starter from the LCDd menu # Description: Debian init script for lcdexec, the client to # start programs from the LCDd menu in the LCDproc suite @@ -19,6 +20,9 @@ NAME=${NAME:-lcdexec} DAEMON=/usr/bin/lcdexec DESC="LCDproc program starter" DEFAULTS=/etc/default/$NAME +CONFIGFILE=/etc/lcdproc/$NAME.conf +PIDFILE=/var/run/$NAME.pid +OPTIONS="" START=no # Source defaults file; edit that file to configure this script. @@ -26,6 +30,18 @@ if [ -e "${DEFAULTS}" ]; then . "${DEFAULTS}" fi +# try to get PID file name from config file +if [ -f "${CONFIGFILE:=/etc/lcdproc/$NAME.conf}" ]; then + PIDFILE=`grep -i '^[:space:]*PidFile[:space:]*=' ${CONFIGFILE} \ + | head -n1 \ + | cut -d= -f2- \ + | sed -e 's,^[:space:]*\(.*\)[:space:]*$,\1,'` + OPTIONS="${OPTIONS} -c ${CONFIGFILE}" +fi + +# if necessary set default PID file name +PIDFILE=${PIDFILE:-/var/run/$NAME.pid} + # If we're not to start the daemon, simply exit if [ "${START}" != "yes" ]; then exit 0 @@ -41,12 +57,12 @@ test -x $DAEMON || exit 5 case "$1" in start) log_daemon_msg "Starting $DESC" "$NAME" - start_daemon $DAEMON $OPTIONS + start_daemon -p $PIDFILE $DAEMON $OPTIONS log_end_msg $? ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" - killproc $DAEMON + killproc -p $PIDFILE $DAEMON log_end_msg $? ;; restart|reload|force-reload) diff --git a/scripts/debian/lcdproc.lcdvc.default b/scripts/debian/lcdproc.lcdvc.default index 460dc80..c3cdcba 100644 --- a/scripts/debian/lcdproc.lcdvc.default +++ b/scripts/debian/lcdproc.lcdvc.default @@ -3,6 +3,9 @@ # shall lcdvc be started (yes/no) START=no +# config file +#CONFIGFILE=/etc/lcdproc/lcdvc.conf + # options for lcdvc startup #OPTIONS="" diff --git a/scripts/debian/lcdproc.lcdvc.init b/scripts/debian/lcdproc.lcdvc.init index ac6d01a..97e35bd 100644 --- a/scripts/debian/lcdproc.lcdvc.init +++ b/scripts/debian/lcdproc.lcdvc.init @@ -1,11 +1,12 @@ #! /bin/sh -#### BEGIN INIT INFO +### BEGIN INIT INFO # Provides: lcdvc # Required-Start: $syslog $local_fs $network $remote_fs # Required-Stop: $syslog $local_fs $network $remote_fs +# Should-Start: LCDd # Default-Start: 2 3 4 5 -# Default-Stop: S 0 1 6 +# Default-Stop: 0 1 6 # Short-Description: LCDproc virtual console # Description: Debian init script for lcdvc, the virtual # console client in the LCDproc suite @@ -19,6 +20,9 @@ NAME=${NAME:-lcdvc} DAEMON=/usr/bin/lcdvc DESC="LCDproc virtual console" DEFAULTS=/etc/default/$NAME +CONFIGFILE=/etc/lcdproc/$NAME.conf +PIDFILE=/var/run/$NAME.pid +OPTIONS="" START=no # Source defaults file; edit that file to configure this script. @@ -26,6 +30,18 @@ if [ -e "${DEFAULTS}" ]; then . "${DEFAULTS}" fi +# try to get PID file name from config file +if [ -f "${CONFIGFILE:=/etc/lcdproc/$NAME.conf}" ]; then + PIDFILE=`grep -i '^[:space:]*PidFile[:space:]*=' ${CONFIGFILE} \ + | head -n1 \ + | cut -d= -f2- \ + | sed -e 's,^[:space:]*\(.*\)[:space:]*$,\1,'` + OPTIONS="${OPTIONS} -c ${CONFIGFILE}" +fi + +# if necessary set default PID file name +PIDFILE=${PIDFILE:-/var/run/$NAME.pid} + # If we're not to start the daemon, simply exit if [ "${START}" != "yes" ]; then exit 0 @@ -41,12 +57,12 @@ test -x $DAEMON || exit 5 case "$1" in start) log_daemon_msg "Starting $DESC" "$NAME" - start_daemon $DAEMON $OPTIONS + start_daemon -p $PIDFILE $DAEMON $OPTIONS log_end_msg $? ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" - killproc $DAEMON + killproc -p $PIDFILE $DAEMON log_end_msg $? ;; restart|reload|force-reload) diff --git a/scripts/debian/rules b/scripts/debian/rules index d4212aa..2562f85 100755 --- a/scripts/debian/rules +++ b/scripts/debian/rules @@ -108,10 +108,10 @@ binary-arch: build install # dh_installemacsen # dh_installpam # dh_installmime - dh_installinit # for the lcdproc client + dh_installinit --update-rcd-params="defaults 21 79" # for the lcdproc client dh_installinit --name=LCDd - dh_installinit --name=lcdexec - dh_installinit --name=lcdvc + dh_installinit --name=lcdexec --update-rcd-params="defaults 21 79" + dh_installinit --name=lcdvc --update-rcd-params="defaults 21 79" # dh_installcron # dh_installinfo dh_installman diff --git a/scripts/init-LCDd.LSB.in b/scripts/init-LCDd.LSB.in index 52b8892..b91f22a 100644 --- a/scripts/init-LCDd.LSB.in +++ b/scripts/init-LCDd.LSB.in @@ -1,9 +1,10 @@ #! /bin/sh -#### BEGIN INIT INFO +### BEGIN INIT INFO # Provides: LCDd # Required-Start: $syslog $local_fs $network $remote_fs # Required-Stop: $syslog $local_fs $network $remote_fs +# Should-Start: udev # Default-Start: 2 3 4 5 # Default-Stop: S 0 1 6 # Short-Description: LCDproc Server Daemon diff --git a/scripts/init-LCDd.debian.in b/scripts/init-LCDd.debian.in index 3a0781f..b5c75c6 100644 --- a/scripts/init-LCDd.debian.in +++ b/scripts/init-LCDd.debian.in @@ -1,6 +1,6 @@ #!/bin/sh -e -#### BEGIN INIT INFO +### BEGIN INIT INFO # Provides: LCDd # Required-Start: $syslog $local_fs $network $remote_fs # Required-Stop: $syslog $local_fs $network $remote_fs diff --git a/scripts/init-lcdexec.LSB.in b/scripts/init-lcdexec.LSB.in index d0e45d9..6d336cf 100644 --- a/scripts/init-lcdexec.LSB.in +++ b/scripts/init-lcdexec.LSB.in @@ -1,9 +1,10 @@ #! /bin/sh -#### BEGIN INIT INFO +### BEGIN INIT INFO # Provides: lcdexec # Required-Start: $syslog $local_fs $network $remote_fs # Required-Stop: $syslog $local_fs $network $remote_fs +# Should-Start: LCDd # Default-Start: 2 3 4 5 # Default-Stop: S 0 1 6 # Short-Description: LCDproc program starter from the LCDd menu diff --git a/scripts/init-lcdexec.debian.in b/scripts/init-lcdexec.debian.in index ed41b69..1fba86b 100644 --- a/scripts/init-lcdexec.debian.in +++ b/scripts/init-lcdexec.debian.in @@ -1,6 +1,6 @@ #!/bin/sh -e -#### BEGIN INIT INFO +### BEGIN INIT INFO # Provides: lcdexec # Required-Start: $syslog $local_fs $network $remote_fs # Required-Stop: $syslog $local_fs $network $remote_fs diff --git a/scripts/init-lcdproc.LSB.in b/scripts/init-lcdproc.LSB.in index 5ac990d..8985350 100644 --- a/scripts/init-lcdproc.LSB.in +++ b/scripts/init-lcdproc.LSB.in @@ -1,9 +1,10 @@ #! /bin/sh -#### BEGIN INIT INFO +### BEGIN INIT INFO # Provides: lcdproc # Required-Start: $syslog $local_fs $network $remote_fs # Required-Stop: $syslog $local_fs $network $remote_fs +# Should-Start: LCDd # Default-Start: 2 3 4 5 # Default-Stop: S 0 1 6 # Short-Description: LCDproc system status information viewer diff --git a/scripts/init-lcdproc.debian.in b/scripts/init-lcdproc.debian.in index 7579748..37be02a 100644 --- a/scripts/init-lcdproc.debian.in +++ b/scripts/init-lcdproc.debian.in @@ -1,6 +1,6 @@ #!/bin/sh -e -#### BEGIN INIT INFO +### BEGIN INIT INFO # Provides: lcdproc # Required-Start: $syslog $local_fs $network $remote_fs # Required-Stop: $syslog $local_fs $network $remote_fs diff --git a/scripts/init-lcdvc.LSB.in b/scripts/init-lcdvc.LSB.in index c36dddf..e5bb529 100644 --- a/scripts/init-lcdvc.LSB.in +++ b/scripts/init-lcdvc.LSB.in @@ -1,9 +1,10 @@ #! /bin/sh -#### BEGIN INIT INFO +### BEGIN INIT INFO # Provides: lcdvc # Required-Start: $syslog $local_fs $network $remote_fs # Required-Stop: $syslog $local_fs $network $remote_fs +# Should-Start: LCDd # Default-Start: 2 3 4 5 # Default-Stop: S 0 1 6 # Short-Description: LCDproc virtual console diff --git a/scripts/init-lcdvc.debian.in b/scripts/init-lcdvc.debian.in index 11a1093..338988d 100644 --- a/scripts/init-lcdvc.debian.in +++ b/scripts/init-lcdvc.debian.in @@ -1,6 +1,6 @@ #!/bin/sh -e -#### BEGIN INIT INFO +### BEGIN INIT INFO # Provides: lcdvc # Required-Start: $syslog $local_fs $network $remote_fs # Required-Stop: $syslog $local_fs $network $remote_fs