[SCM] Debian packaging for the 2.0 Apache Shibboleth SP branch, master, updated. debian/2.4.3+dfsg-3-9-g2a05bab

Russ Allbery rra at debian.org
Thu Feb 2 08:16:45 UTC 2012


The following commit has been merged in the master branch:
commit 1d7433c21a06a9e9256bac7a3ca1d2e25dbd47bc
Author: Russ Allbery <rra at debian.org>
Date:   Wed Feb 1 23:45:07 2012 -0800

    Rewrite the shibd init script to use LSB functions, add status
    
    * Rewrite the shibd init script to use the LSB init script functions and
      implement the status action.

diff --git a/configs/shibd-debian.in b/configs/shibd-debian.in
index 5d68a6b..0eefbb2 100644
--- a/configs/shibd-debian.in
+++ b/configs/shibd-debian.in
@@ -1,18 +1,20 @@
 #! /bin/sh
 ### BEGIN INIT INFO
-# Provides: shibd
-# Required-Start: $local_fs $remote_fs $network
-# Required-Stop: $local_fs $remote_fs
-# Default-Start: 2 3 4 5
+# Provides:             shibd
+# Required-Start:       $local_fs $remote_fs $network
+# Required-Stop:        $local_fs $remote_fs
+# Default-Start:        2 3 4 5
 # Default-Stop:
-# Short-Description: Shibboleth 2 Service Provider Daemon
-# Description: Starts the separate daemon used by the Shibboleth
-#       Apache module to manage sessions and to retrieve
-#       attributes from Shibboleth Identity Providers.
+# Short-Description:    Shibboleth 2 Service Provider Daemon
+# Description:          Starts the separate daemon used by the Shibboleth
+#                       Apache module to manage sessions and to retrieve
+#                       attributes from Shibboleth Identity Providers.
 ### END INIT INFO
 #
 # Written by Quanah Gibson-Mount <quanah at stanford.edu>
 # Modified by Lukas Haemmerle <lukas.haemmerle at switch.ch> for Shibboleth 2
+# Updated to use the LSB init functions by Russ Allbery <rra at debian.org>
+#
 # Based on the dh-make template written by:
 #
 # Written by Miquel van Smoorenburg <miquels at cistron.nl>.
@@ -49,8 +51,11 @@ DAEMON_OPTS="$DAEMON_OPTS -w 30"
 # Read configuration if it is present.
 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
 
-# Get the setting of VERBOSE and other rcS variables.
-[ -f /etc/default/rcS ] && . /etc/default/rcS
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+# Define LSB log_* functions.
+. /lib/lsb/init-functions
 
 prepare_environment () {
     # Ensure @-PKGRUNDIR-@ exists.  /var/run may be on a tmpfs file system.
@@ -70,50 +75,98 @@ prepare_environment () {
             ERROR='ERROR OpenSSL : error code: 33558541 '
             if echo "$DIAG" | fgrep -q "$ERROR" ; then
                 unset DAEMON_USER
-                echo "$NAME warning: file permissions require running as root"
+                log_warning_msg "$NAME: file permissions require running as" \
+                    "root"
             else
                 chown -Rh "$DAEMON_USER" '@-PKGRUNDIR-@' '@-PKGLOGDIR-@'
             fi
         else
             unset DAEMON_USER
-            echo "$NAME error: unable to run config check as user $DAEMON_USER"
+            log_warning_msg "$NAME: unable to run config check as user" \
+                "$DAEMON_USER"
         fi
         unset DIAG
     fi
 }
 
+# Start shibd.
+do_start () {
+    # 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 ${DAEMON_USER:+--chuid $DAEMON_USER} \
+        --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
+        || return 1
+    start-stop-daemon --start --quiet ${DAEMON_USER:+--chuid $DAEMON_USER} \
+        --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS \
+        || return 2
+}
+
+# Stop shibd.
+do_stop () {
+    # 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="$?"
+    return "$RETVAL"
+}
+
 case "$1" in
 start)
     prepare_environment
 
     # Don't start shibd if NO_START is set.
     if [ "$NO_START" = 1 ] ; then
-        echo "Not starting $DESC (see /etc/default/$NAME)"
+        if [ "$VERBOSE" != no ] ; then
+            echo "Not starting $DESC (see /etc/default/$NAME)"
+        fi
         exit 0
     fi
-    echo -n "Starting $DESC: "
-    start-stop-daemon --start --quiet ${DAEMON_USER:+--chuid $DAEMON_USER} \
-        --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS
-    echo "$NAME."
+    [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+    do_start
+    case "$?" in
+        0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+        2)   [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+    esac
     ;;
 stop)
-    echo -n "Stopping $DESC: "
-    start-stop-daemon --stop --quiet --pidfile $PIDFILE \
-        --exec $DAEMON
-    echo "$NAME."
+    [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+    do_stop
+    case "$?" in
+        0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+        2)   [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+    esac
     ;;
 restart|force-reload)
     prepare_environment
 
-    echo -n "Restarting $DESC: "
-    start-stop-daemon --stop --quiet --pidfile $PIDFILE \
-        --retry TERM/30/KILL/5 --exec $DAEMON
-    start-stop-daemon --start --quiet ${DAEMON_USER:+--chuid $DAEMON_USER} \
-        --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS
-    echo "$NAME."
+    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)
+    status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $?
     ;;
 *)
-    echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
+    echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
     exit 1
     ;;
 esac
diff --git a/debian/changelog b/debian/changelog
index a216b7f..a56be62 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,8 @@ shibboleth-sp2 (2.4.3+dfsg-4) UNRELEASED; urgency=low
     - Enable multiarch support.
   * Rebuild the Autotools build system using dh-autoreconf instead of
     rolling our own version of the same thing.
+  * Rewrite the shibd init script to use the LSB init script functions and
+    implement the status action.
 
  -- Russ Allbery <rra at debian.org>  Wed, 01 Feb 2012 22:27:55 -0800
 

-- 
Debian packaging for the 2.0 Apache Shibboleth SP



More information about the Pkg-shibboleth-devel mailing list