Patchwork [meta-networking,3/5] quagga: fix pkg_postinst

login
register
mail settings
Submitter Qi.Chen@windriver.com
Date Oct. 31, 2013, 6:29 a.m.
Message ID <1383200986-18674-3-git-send-email-Qi.Chen@windriver.com>
Download mbox | patch
Permalink /patch/60859/
State Accepted, archived
Commit 7f1b4775ef198d86821997632bf6e38305f3fa1b
Headers show

Comments

Qi.Chen@windriver.com - Oct. 31, 2013, 6:29 a.m.
From: Chen Qi <Qi.Chen@windriver.com>

This patch mainly involves two changes.
1. Create necessary files at do_install task. Add these configuration
   files to the CONFFILES variable.
2. Move the `chmod' and `chown' commands to do_install task.

After these two changes, qugga can run successfully at rootfs time.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 .../recipes-protocols/quagga/quagga.inc            |   28 +++++++++++++-------
 1 file changed, 19 insertions(+), 9 deletions(-)

Patch

diff --git a/meta-networking/recipes-protocols/quagga/quagga.inc b/meta-networking/recipes-protocols/quagga/quagga.inc
index 8720876..196bd30 100644
--- a/meta-networking/recipes-protocols/quagga/quagga.inc
+++ b/meta-networking/recipes-protocols/quagga/quagga.inc
@@ -73,6 +73,14 @@  do_install () {
         install -m 0640 ${S}/$f/$f.conf.sample ${D}${sysconfdir}/quagga/$f.conf.sample
     done
 
+    for f in bgpd vtysh babeld isisd ospfd ripngd zebra ripd ospf6d; do
+	touch ${D}${sysconfdir}/quagga/$f.conf
+    done
+    chown quagga:quaggavty ${D}${sysconfdir}/quagga
+    chown quagga:quagga ${D}${sysconfdir}/quagga/*.conf
+    chmod 750 ${D}${sysconfdir}/quagga
+    chmod 640 ${D}${sysconfdir}/quagga/*.conf
+
     # Install quagga
     oe_runmake install DESTDIR=${D} prefix=${prefix} \
             sbindir=${sbindir} \
@@ -108,7 +116,17 @@  FILES_${PN}-watchquagga = "${sbindir}/watchquagga ${sysconfdir}/default/watchqua
                            ${sysconfdir}/init.d/watchquagga"
 
 # Indicate that the default files are configuration files
-CONFFILES_${PN} = "${sysconfdir}/default/quagga"
+CONFFILES_${PN} = "${sysconfdir}/default/quagga \
+                   ${sysconfdir}/quagga/bgpd.conf \
+                   ${sysconfdir}/quagga/vtysh.conf \
+                   ${sysconfdir}/quagga/babeld.conf \
+                   ${sysconfdir}/quagga/isisd.conf \
+                   ${sysconfdir}/quagga/ospfd.conf \
+                   ${sysconfdir}/quagga/ripngd.conf \
+                   ${sysconfdir}/quagga/zebra.conf \
+                   ${sysconfdir}/quagga/ripd.conf \
+                   ${sysconfdir}/quagga/ospf6d.conf \
+                  "
 CONFFILES_${PN}-watchquagga = "${sysconfdir}/default/watchquagga"
 
 # Stop the names being rewritten due to the internal shared libraries
@@ -132,14 +150,6 @@  GROUPADD_PARAM_${PN} = "--system quagga ; --system quaggavty"
 USERADD_PARAM_${PN} = "--system --home ${localstatedir}/run/quagga/ -M -g quagga quagga"
 
 pkg_postinst_${PN} () {
-    if [ "x$D" != "x" ] ; then
-        exit 1
-    fi
-    for f in bgpd vtysh babeld isisd ospfd ripngd zebra ripd ospf6d; do touch ${sysconfdir}/quagga/$f.conf; done
-    chown quagga:quaggavty ${sysconfdir}/quagga
-    chown quagga:quagga ${sysconfdir}/quagga/*.conf
-    chmod 750 ${sysconfdir}/quagga
-    chmod 640 ${sysconfdir}/quagga/*.conf
     if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
         ${sysconfdir}/init.d/populate-volatile.sh update
     fi