1
0
mirror of https://git.yoctoproject.org/poky synced 2026-07-16 15:57:04 +00:00

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.

(From OE-Core rev: 64eeedcdc586c221e3684861ba85e8e4bc9c5dd1)

Signed-off-by: Niko Mauno <niko.mauno@iki.fi>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Niko Mauno
2019-11-26 22:14:06 +02:00
committed by Richard Purdie
parent 567922d2fc
commit 05b20e95e1
2 changed files with 10 additions and 5 deletions
@@ -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]
@@ -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,@SBINDIR@,${sbindir},g' ${D}${systemd_system_unitdir}/iptables.service
sed -i \
-e 's,@SBINDIR@,${sbindir},g' \
-e 's,@RULESDIR@,${IPTABLES_RULES_DIR},g' \
${D}${systemd_system_unitdir}/iptables.service
}
PACKAGES += "${PN}-modules"