]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
For Redhat, adapt init.d script to initialize the chroot.
authorVincent <bernat@luffy.cx>
Sat, 27 Feb 2010 08:53:38 +0000 (09:53 +0100)
committerVincent <bernat@luffy.cx>
Sat, 27 Feb 2010 09:03:41 +0000 (10:03 +0100)
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
redhat/lldpd.init

index 28bf1756434dceb6c2854f69ee59f8002f645785..c24071a395fa9c559d4dc9c90325d151124e519a 100644 (file)
--- 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)
 
index a8d494f8fbfdf61900f958c84912a041341ab58f..9a2056e4cb3fa30d7deb605a80506513384a9030 100644 (file)
@@ -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