From: Vincent Bernat Date: Wed, 10 Mar 2010 21:20:48 +0000 (+0100) Subject: For Redhat, adapt init.d script to initialize the chroot. X-Git-Tag: 0.4.2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0d611979150b99081d43d4969c90616bd75bb8d1;p=thirdparty%2Flldpd.git For Redhat, adapt init.d script to initialize the chroot. The chroot is an empty directory containing a copy of /etc/localtime to enable the use of the correct timestamp when logging for the process trapped in the chroot. --- diff --git a/CHANGELOG b/CHANGELOG index 2b94e696..c5b34d8b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,9 @@ lldpd (0.4.2) - * Misc fix: + * Misc fixes: + fix a crash when an interface is removed + + copy /etc/localtime into chroot before starting lldpd daemon to + ensure correct timestamps for logs. -- Vincent Bernat diff --git a/redhat/lldpd.init b/redhat/lldpd.init index a8d494f8..9a2056e4 100644 --- a/redhat/lldpd.init +++ b/redhat/lldpd.init @@ -32,6 +32,15 @@ RETVAL=0 prog="lldpd" binary=/usr/sbin/lldpd pidfile=/var/run/lldpd.pid +chroot=/var/run/lldpd + +build_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 +} start() { [ -x $binary ] || exit 5 @@ -40,6 +49,7 @@ start() { RETVAL=1 failure else + build_chroot daemon --pidfile=$pidfile $binary $OPTIONS RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lldpd