Could you try/critique this initscript patch for me, please.

Thanks.

Mark

diff --git a/debian/apt-cacher.init b/debian/apt-cacher.init
index 2c38b7f..7ae1636 100644
--- a/debian/apt-cacher.init
+++ b/debian/apt-cacher.init
@@ -15,7 +15,8 @@ 
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 DESC="Apt-Cacher"
 NAME=apt-cacher
 DAEMON=/usr/sbin/$NAME
-PIDFILE=/var/run/$NAME/$NAME.pid
+RUNDIR=/var/run/$NAME
+PIDFILE=$RUNDIR/$NAME.pid
 SCRIPTNAME=/etc/init.d/$NAME
 
 # Gracefully exit if the package has been removed.
@@ -40,6 +41,18 @@ d_start() {
            echo "$NAME."
     else
         echo "Not started (AUTOSTART not enabled in /etc/default/$NAME)";
+
+        # apt-cacher needs $RUNDIR, but is not able to create it in inetd or 
CGI mode
+       if test ! -d "$RUNDIR"; then
+           mkdir -m 755 "$RUNDIR"
+           CONFIG_FILES="/etc/$NAME/$NAME.conf $(run-parts --list 
/etc/$NAME/conf.d)"
+           RUN_AS_USER=$(sed -n 's/^ *user *= *//p' $CONFIG_FILES  | tail -1)
+           RUN_AS_GROUP=$(sed -n 's/^ *group *= *//p' $CONFIG_FILES | tail -1)
+           [ "$RUN_AS_USER" ] && chown $RUN_AS_USER "$RUNDIR"
+           [ "$RUN_AS_GROUP" ] && chgrp $RUN_AS_GROUP "$RUNDIR"
+       fi
+
+
     fi
 }
 


-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to