[oe-commits] [openembedded-core] 06/22: iptables: Allow overriding rules file location

git at git.openembedded.org git at git.openembedded.org
Wed Dec 4 12:33:02 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 64eeedcdc586c221e3684861ba85e8e4bc9c5dd1
Author: Niko Mauno <niko.mauno at iki.fi>
AuthorDate: Tue Nov 26 22:14:06 2019 +0200

    iptables: Allow overriding rules file location
    
    In some cases a distribution may want to install rules file into a
    location other than /etc/iptables/ so introduce custom recipe-level
    IPTABLES_RULES_DIR parameter which allows conveniently overriding
    the rules directory location.
    
    Signed-off-by: Niko Mauno <niko.mauno at iki.fi>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/recipes-extended/iptables/iptables/iptables.service |  4 ++--
 meta/recipes-extended/iptables/iptables_1.8.3.bb         | 11 ++++++++---
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/meta/recipes-extended/iptables/iptables/iptables.service b/meta/recipes-extended/iptables/iptables/iptables.service
index 041316e..5a8aa3f 100644
--- a/meta/recipes-extended/iptables/iptables/iptables.service
+++ b/meta/recipes-extended/iptables/iptables/iptables.service
@@ -5,8 +5,8 @@ Wants=network-pre.target
 
 [Service]
 Type=oneshot
-ExecStart=@SBINDIR@/iptables-restore /etc/iptables/iptables.rules
-ExecReload=@SBINDIR@/iptables-restore /etc/iptables/iptables.rules
+ExecStart=@SBINDIR@/iptables-restore @RULESDIR@/iptables.rules
+ExecReload=@SBINDIR@/iptables-restore @RULESDIR@/iptables.rules
 RemainAfterExit=yes
 
 [Install]
diff --git a/meta/recipes-extended/iptables/iptables_1.8.3.bb b/meta/recipes-extended/iptables/iptables_1.8.3.bb
index 563c8ae..7368020 100644
--- a/meta/recipes-extended/iptables/iptables_1.8.3.bb
+++ b/meta/recipes-extended/iptables/iptables_1.8.3.bb
@@ -38,14 +38,19 @@ do_configure_prepend() {
     rm -f libtool.m4 lt~obsolete.m4 ltoptions.m4 ltsugar.m4 ltversion.m4
 }
 
+IPTABLES_RULES_DIR ?= "${sysconfdir}/${BPN}"
+
 do_install_append() {
-    install -d ${D}${sysconfdir}/iptables
-    install -m 0644 ${WORKDIR}/iptables.rules ${D}${sysconfdir}/iptables
+    install -d ${D}${IPTABLES_RULES_DIR}
+    install -m 0644 ${WORKDIR}/iptables.rules ${D}${IPTABLES_RULES_DIR}
 
     install -d ${D}${systemd_system_unitdir}
     install -m 0644 ${WORKDIR}/iptables.service ${D}${systemd_system_unitdir}
 
-    sed -i -e 's, at SBINDIR@,${sbindir},g' ${D}${systemd_system_unitdir}/iptables.service
+    sed -i \
+        -e 's, at SBINDIR@,${sbindir},g' \
+        -e 's, at RULESDIR@,${IPTABLES_RULES_DIR},g' \
+        ${D}${systemd_system_unitdir}/iptables.service
 }
 
 PACKAGES += "${PN}-modules"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list