From: Vincent Bernat Date: Sat, 27 Feb 2010 08:48:10 +0000 (+0100) Subject: For Debian init.d, build the chroot before starting the daemon. X-Git-Tag: 0.4.2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cd0f174718fff8ea23ab757beda555c68516643c;p=thirdparty%2Flldpd.git For Debian init.d, build the chroot before starting the daemon. The chroot is an empty directory with a copy of /etc/localtime. This file ensures that we are able to write logs using the correct time. --- diff --git a/debian/lldpd.init.d b/debian/lldpd.init.d index 3ece7f1e..9e09ed59 100644 --- a/debian/lldpd.init.d +++ b/debian/lldpd.init.d @@ -18,6 +18,7 @@ DAEMON=/usr/sbin/$NAME DAEMON_ARGS="" PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME +CHROOT=/var/run/$NAME # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 @@ -28,8 +29,17 @@ SCRIPTNAME=/etc/init.d/$NAME [ -f /lib/init/vars.sh ] && . /lib/init/vars.sh . /lib/lsb/init-functions +do_chroot() +{ + [ -d $CHROOT ] || mkdir -p $CHROOT + [ -d $CHROOT/etc ] || mkdir $CHROOT/etc + [ -f $CHROOT/etc/localtime ] || [ ! -f /etc/localtime ] || \ + cp /etc/localtime $CHROOT/etc/localtime +} + do_start() { + do_chroot start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ || return 1 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \