]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
For Debian init.d, build the chroot before starting the daemon.
authorVincent Bernat <bernat@luffy.cx>
Sat, 27 Feb 2010 08:48:10 +0000 (09:48 +0100)
committerVincent <bernat@luffy.cx>
Sat, 27 Feb 2010 08:49:27 +0000 (09:49 +0100)
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.

debian/lldpd.init.d

index 306d21a879ede846ae835c475a6e00728e4a4f59..e33d84a0e6e1edc297660408c4e13e06da47d000 100644 (file)
@@ -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 -- \