From 9a79e6d59327e3fd685439c03b46d43e239e934e Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sat, 27 Feb 2010 09:48:10 +0100 Subject: [PATCH] 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. --- debian/lldpd.init.d | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/debian/lldpd.init.d b/debian/lldpd.init.d index 306d21a8..e33d84a0 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 -- \ -- 2.39.5