]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
For Redhat, adapt init.d script to initialize the chroot.
authorVincent Bernat <bernat@luffy.cx>
Wed, 10 Mar 2010 21:20:48 +0000 (22:20 +0100)
committerVincent Bernat <bernat@luffy.cx>
Wed, 10 Mar 2010 21:20:48 +0000 (22:20 +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 2b94e696665a3557a8fd54afde94a1382bb383df..c5b34d8ba47bb647a1f43019f2767d2e28b51157 100644 (file)
--- 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 <bernat@luffy.cx>
 
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