From c0ce5d1a2aee6595c0f297e6db3b73bc2e7ea123 Mon Sep 17 00:00:00 2001 From: Vincent Date: Sat, 27 Feb 2010 09:53:38 +0100 Subject: [PATCH] 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. --- CHANGELOG | 2 ++ redhat/lldpd.init | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 28bf1756..c24071a3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -18,6 +18,8 @@ lldpd (0.5.0) * Bug fixes: + Fix EDP VLAN handling + Silent warnings about bridge stuff. + + Copy /etc/localtime into chroot before starting lldpd daemon to + ensure correct timestamps for logs. lldpd (0.4.1) 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 -- 2.39.5