Don't need chown of new log dir, clean up some indents
[shibboleth/cpp-sp.git] / configs / shibd-suse.in
index 62a1619..318499f 100644 (file)
@@ -7,12 +7,14 @@
 #
 ### BEGIN INIT INFO
 # Provides: shibd
-# Required-Start: network
-# Required-Stop: $null
+# Required-Start: $local_fs $remote_fs $network
+# Should-Start: $time
+# Should-Stop: $time
+# Required-Stop: $local_fs $remote_fs $network
 # Default-Start: 3 5
+# Default-Stop: 0 1 2 6 
 # Short-Description: Shibboleth 2.x Service Provider Daemon
-# Description: Starts the separate daemon used by the Shibboleth
-# Apache module to manage state and SAML interactions.
+# Description: Starts the separate daemon used by the Shibboleth Apache module to manage state and SAML interactions.
 ### END INIT INFO
 #
  
@@ -22,8 +24,9 @@ SHIB_CONFIG=@-PKGSYSCONFDIR-@/shibboleth2.xml
 DAEMON=@-PREFIX-@/sbin/$NAME
 SCRIPTNAME=/etc/init.d/$NAME
 PID_FILE=@-PKGRUNDIR-@/shibd.pid
+SHIBD_USER=root
 DAEMON_OPTS=""
+
 # Force removal of socket
 DAEMON_OPTS="$DAEMON_OPTS -f"
  
@@ -35,6 +38,8 @@ DAEMON_OPTS="$DAEMON_OPTS -p $PID_FILE"
 
 # Specify wait time to use
 DAEMON_OPTS="$DAEMON_OPTS -w 30"
+
+[ -e /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
  
 # Exit if the package is not installed.
 test -x "$DAEMON" || exit 5
@@ -46,13 +51,19 @@ rc_reset
  
 case "$1" in
     start)
+        # Make sure package run directory exists.
+        [ -d @-PKGRUNDIR-@ ] || mkdir @-PKGRUNDIR-@
+
+        # Handle transition from root to non-root packages.
+        chown -R $SHIBD_USER:$SHIBD_USER @-PKGRUNDIR-@ @-PKGCACHEDIR-@ 2>/dev/null || :
+               
         echo -n "Starting $DESC ($NAME)"
         ## Start daemon with startproc(8). If this fails
         ## the echo return value is set appropriate.
  
         # NOTE: startproc return 0, even if service is
         # already running to match LSB spec.
-        /sbin/startproc -p $PID_FILE $DAEMON $DAEMON_OPTS > /dev/null 2>&1
+        /sbin/startproc -u $SHIBD_USER -p $PID_FILE $DAEMON $DAEMON_OPTS > /dev/null 2>&1
  
         # Remember status and be verbose
         rc_status -v