Package: bip Version: 0.8.9-1 Severity: normal The current version of bip 0.8.9-1 does not start because the /var/run/bip dir for the pid file is not created properly.
A fix is included in the attached patch. -- System Information: Debian Release: jessie/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 3.11-2-amd64 (SMP w/4 CPU cores) Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages bip depends on: ii adduser 3.113+nmu3 ii libc6 2.17-97 ii libssl1.0.0 1.0.1e-4 ii lsb-base 4.1+Debian12 bip recommends no packages. bip suggests no packages. -- Configuration Files: /etc/bip.conf [Errno 13] Keine Berechtigung: u'/etc/bip.conf' -- no debconf information
diff -ruN bip-0.8.9.orig/debian/bip.init bip-0.8.9/debian/bip.init --- bip-0.8.9.orig/debian/bip.init 2013-10-22 15:31:02.000000000 +0200 +++ bip-0.8.9/debian/bip.init 2013-12-18 02:52:35.708604828 +0100 @@ -6,127 +6,151 @@ # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Bip irc proxy init script -# Description: This file should be used to start and stop bip in system -# mode. +# Description: Start and stop bip in system mode ### END INIT INFO -# Author: Arnaud Cornet <arnaud.cor...@gmail.com> +# Author: Arnaud Cornet <arnaud.cor...@gmail.com> & DNS <deb...@88it.de>. + +# Do NOT "set -e" PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="Bip IRC proxy" -NAME=bip -VARRUN=/var/run/$NAME -PIDFILE=$VARRUN/$NAME.pid -DAEMON=/usr/bin/$NAME -DAEMON_HOME=/var/lib/$NAME -DAEMON_CONFIG=/etc/bip.conf +NAME="bip" +PIDDIR="/var/run/$NAME" +PIDFILE=$PIDDIR/bip.pid +DAEMON="/usr/bin/$NAME" +DAEMON_HOME="/var/lib/$NAME" +DAEMON_CONFIG="/etc/$NAME.conf" DAEMON_ARGS="-f $DAEMON_CONFIG -s $DAEMON_HOME" -DAEMON_USER=bip -DAEMON_GROUP=bip -ENABLED=0 +DAEMON_USER=bip # also group +SCRIPTNAME="/etc/init.d/$NAME" # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 -# Exit if the configuration is missing -[ -f "$DAEMON_CONFIG" ] || exit 0 - # Read configuration variable file if it is present -[ -r /etc/default/$NAME ] && . /etc/default/$NAME - -test "$ENABLED" != "0" || exit 0 - -# Load the VERBOSE setting and other rcS variables -. /lib/init/vars.sh +[ -r "/etc/default/$NAME" ] && . "/etc/default/$NAME" # Define LSB log_* functions. # Depend on lsb-base (>= 3.2-14) to ensure that this file is present # and status_of_proc is working. . /lib/lsb/init-functions - -bip_start() +# +# Function that starts the daemon/service +# +do_start() { - if [ ! -e $VARRUN ] ; then - # /var/run can be cleaned at reboot - mkdir -p $VARRUN - chown $DAEMON_USER:$DAEMON_GROUP $VARRUN - fi - # Return - # 0 if daemon has been started - # 1 if daemon was already running - # 2 if daemon could not be started - start-stop-daemon --start --quiet --chuid $DAEMON_USER:$DAEMON_GROUP --pidfile "$PIDFILE" --exec $DAEMON --test > /dev/null \ - || return 1 - start-stop-daemon --start --quiet --chuid $DAEMON_USER:$DAEMON_GROUP --pidfile "$PIDFILE" --exec $DAEMON -- $DAEMON_ARGS \ - || return 2 - return 0 + if [ ! -e $PIDDIR ] ; then + # /var/run can be cleaned at reboot + mkdir -p $PIDDIR + chown $DAEMON_USER:$DAEMON_USER $PIDDIR + fi + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon --start --quiet \ + --pidfile "$PIDFILE" --exec "$DAEMON" \ + --test > /dev/null || return 1 + start-stop-daemon --start --quiet \ + --chuid "$DAEMON_USER:$DAEMON_USER" \ + --pidfile "$PIDFILE" --exec "$DAEMON" -- \ + $DAEMON_ARGS || return 2 + # Add code here, if necessary, that waits for the process to be ready + # to handle requests from services started subsequently which depend + # on this one. As a last resort, sleep for some time. } -bip_stop() +# +# Function that stops the daemon/service +# +do_stop() { - start-stop-daemon --stop --quiet --user $DAEMON_USER --pidfile "$PIDFILE" --retry=TERM/30/KILL/5 - RETVAL="$?" - - # cleanup in case it dies - rm -f $PIDFILE - - return "$RETVAL" + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \ + --pidfile "$PIDFILE" --name "$NAME" + RETVAL="$?" + [ "$RETVAL" = 2 ] && return 2 + # Wait for children to finish too if this is a daemon that forks + # and if the daemon is only ever run from this initscript. + # If the above conditions are not satisfied then add some other code + # that waits for the process to drop all resources that could be + # needed by services started subsequently. A last resort is to + # sleep for some time. + start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 \ + --exec "$DAEMON" + [ "$?" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. + rm -f "$PIDFILE" + return "$RETVAL" } -bip_reload() -{ - start-stop-daemon --stop --quiet --user $DAEMON_USER --pidfile "$PIDFILE" --signal 1 +# +# Function that sends a SIGHUP to the daemon/service +# +do_reload() { + start-stop-daemon --stop --signal 1 --quiet \ + --pidfile "$PIDFILE" --name "$NAME" + return 0 } case "$1" in -start) - log_daemon_msg "Starting $DESC" "$NAME" - bip_start - case "$?" in - 0) log_end_msg 0 ; exit 0 ;; - 1) log_warning_msg " (already running)." ; exit 0 ;; - 2) log_end_msg 1 ; exit 1 ;; - esac -;; -stop) - log_daemon_msg "Stopping $DESC" "$NAME" - bip_stop - case "$?" in - 0) log_end_msg 0 ; exit 0 ;; - 1) log_warning_msg " (not running)." ; exit 0 ;; - 2) log_end_msg 1 ; exit 1 ;; - esac -;; + start) + log_daemon_msg "Starting $DESC" "$NAME" + do_start + case "$?" in + 0|1) log_end_msg 0 ;; + 2) log_end_msg 1 ;; + esac + ;; + stop) + log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) log_end_msg 0 ;; + 2) log_end_msg 1 ;; + esac + ;; reload|force-reload) - log_daemon_msg "Reloading $DESC" "$NAME" - bip_reload - log_end_msg $? -;; + log_daemon_msg "Reloading $DESC" "$NAME" + do_reload + log_end_msg $? + ;; restart) - log_daemon_msg "Restarting $DESC" "$NAME" - bip_stop - [ $? = 2 ] && log_failure_msg " (failed to stop)." && exit 1 - sleep 1 - bip_start - case "$?" in - 0) log_end_msg 0 ; exit 0 ;; - 1) log_failure_msg " (failed -- old process is still running)." ; exit 1 ;; - 2) log_failure_msg " (failed to start)." ; exit 1 ;; - esac -;; + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; status) - # /var/run/bip/bip.pid is perm'd 600, so only use -p if readable - if [ -r "$PIDFILE" ]; then - status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $? - else - status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? - fi -;; + # /var/run/bip/bip.pid is perm'd 600, so only use -p if readable + if [ -r "$PIDFILE" ]; then + status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $? + else + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + fi + ;; *) - echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|status}" - exit 3 -;; + echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}" >&2 + exit 3 + ;; esac -: +exit 0 diff -ruN bip-0.8.9.orig/debian/bip.postrm bip-0.8.9/debian/bip.postrm --- bip-0.8.9.orig/debian/bip.postrm 2013-10-19 16:35:48.000000000 +0200 +++ bip-0.8.9/debian/bip.postrm 2013-12-17 07:51:56.000000000 +0100 @@ -8,7 +8,7 @@ if [ "$1" = "purge" ] ; then deluser --quiet --system "$BIPUSER" > /dev/null || true delgroup --quiet --system "$BIPGROUP" > /dev/null || true - rm -rf /var/log/bip /var/lib/bip + rm -rf /var/log/bip /var/lib/bip /var/run/bip fi #DEBHELPER# diff -ruN bip-0.8.9.orig/debian/changelog bip-0.8.9/debian/changelog --- bip-0.8.9.orig/debian/changelog 2013-10-22 19:04:58.000000000 +0200 +++ bip-0.8.9/debian/changelog 2013-12-18 02:38:16.024050422 +0100 @@ -1,3 +1,12 @@ +bip (0.8.9-1.1) unstable; urgency=low + + * Updated and fixed the init script. + + All start/stop commands are announced now. + + Create the piddir /var/run/bip, if it is not existing. + * Remove /var/run/bip, if the package will be uninstalled. + + -- DNS <deb...@88it.de> Wed, 18 Dec 2013 02:00:00 +0200 + bip (0.8.9-1) unstable; urgency=low * New upstream release (Closes: #710614):