Skip to contentSkip to conversation

iptables: Use update alternatives for "ebtables"

PATCH In review Zhang Xiao 2 participants 2 messages Apr 3 – Apr 9

lore
Share & tools
lore

Zhang Xiao

author
#0 lore raw

PATCH v2 1/1 iptables: Use update alternatives for "ebtables"

The ebtables utility can be provided by both ebtables and iptables packages. Set higher priority for the version provided by iptables to prefer it.

---
 meta/recipes-extended/iptables/iptables_1.8.13.bb | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
meta/recipes-extended/iptables/iptables_1.8.13.bb +6 -1
index 11b287ed3b..52173b338e 100644
@@ -21,7 +21,7 @@ SYSTEMD_SERVICE:${PN} = "\
     ${@bb.utils.contains('PACKAGECONFIG', 'ipv6', 'ip6tables.service', '', d)} \
 "
 
-inherit autotools pkgconfig systemd
+inherit autotools pkgconfig systemd update-alternatives
 
 EXTRA_OECONF = "--with-kernel=${STAGING_INCDIR}"
 
@@ -122,3 +122,8 @@ ALLOW_EMPTY:${PN}-modules = "1"
 INSANE_SKIP:${PN}-module-xt-conntrack = "dev-so"
 INSANE_SKIP:${PN}-module-xt-ct = "dev-so"
 INSANE_SKIP:${PN}-module-xt-nat = "dev-so"
+
+ALTERNATIVE:${PN} = ""
+ALTERNATIVE:${PN}:append = "${@bb.utils.contains('PACKAGECONFIG', 'libnftnl', ' ebtables', '', d)}"
+ALTERNATIVE_LINK_NAME[ebtables] = "${sbindir}/ebtables"
+ALTERNATIVE_PRIORITY[ebtables] = "100"
Signature · 1 line
2.53.0
#1 lore raw

Review

Quoted 2 lines · ZhangXiao via lists.openembedded.org
(quoted diff) +2 -0
+ALTERNATIVE:${PN} = ""
+ALTERNATIVE:${PN}:append = "${@bb.utils.contains('PACKAGECONFIG', 'libnftnl', ' ebtables', '', d)}”

Assigning the empty string and then run-time appending is wasteful, just do this in one line:

ALTERNATIVE:${PN} = "${@bb.utils.contains('PACKAGECONFIG', 'libnftnl', ' ebtables', '', d)}”

Ross