# 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
#
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"
# 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
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-@ 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