And the following patch even works (the previous one had wrong spacing in [ -n $User] line, [ -n $Group] respectively
-- Katarina Machalkova Software Engineer gateprotect AG Germany ________________________________ Valentinskamp 24 | D-20354 Hamburg / Germany | Phone +49 (0) 40 278 85 0 | Fax +49 (0) 40 278 85 100 Internet www.gateprotect.com | Com. register ID HRB 89042 Hamburg Board of directors: Dr. Peter Smeets (CEO), Dr. Reinhard Festag (CFO), Stephan Ziegler (CTO) Supervisory board: Dr. Rainer Zimmermann (Chairman)
--- c-icap.init.d.old 2012-06-06 15:10:59.618125287 +0200 +++ c-icap.init.d 2012-06-06 15:08:59.151384908 +0200 @@ -20,6 +20,7 @@ test -x $DAEMON || exit 0 LOGDIR=/var/log/c-icap +CONFFILE=/etc/c-icap/c-icap.conf PIDFILE=/var/run/c-icap/$NAME.pid DODTIME=3 # Time to wait for the server to die, in seconds # If this value is set too low you might not @@ -32,15 +33,36 @@ . /etc/default/c-icap fi +slurp_config() +{ + CONFFILE="$1" + + if [ -e "$CONFFILE" ]; then + for variable in `egrep -v '^[[:space:]]*(#|$)' "$CONFFILE" | awk '{print $1}'`; do + value=`grep ^$variable $CONFFILE | head -n1 | awk '{print $2}'` + + if [ -n "$value" ]; then + export "$variable"="$value" + fi + done + fi + +} + check_ctl_dir() { # Create the ctl empty dir if necessary if [ ! -d /var/run/c-icap ]; then + [ -n "$User" ] || User=c-icap + [ -n "$Group" ] || Group=nogroup + mkdir /var/run/c-icap - chown c-icap /var/run/c-icap + chown "$User":"$Group" /var/run/c-icap chmod 0755 /var/run/c-icap fi } +slurp_config "$CONFFILE" + # If the daemon is not enabled, give the user a warning and stop. # Check to create /var/run directory if someone wants to run c-icap # in debug mode / foreground to test some functions without start it from init.d