[meta-networking] ifupdown-ng: Add recipe

Message ID 20220102105412.17013-1-alexk@zuma.ai
State New
Headers show
Series [meta-networking] ifupdown-ng: Add recipe | expand

Commit Message

Alex Kiernan Jan. 2, 2022, 10:54 a.m. UTC
ifupdown-ng is a network device manager that is largely compatible with
Debian ifupdown, BusyBox ifupdown and Cumulus Networks' ifupdown2.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Alex Kiernan <alexk@zuma.ai>
---
 ...w-sbin-to-be-overridden-for-usrmerge.patch | 42 +++++++++++++++++
 .../ifupdown-ng/ifupdown-ng_0.11.3.bb         | 47 +++++++++++++++++++
 2 files changed, 89 insertions(+)
 create mode 100644 meta-networking/recipes-support/ifupdown-ng/ifupdown-ng/0001-build-Allow-sbin-to-be-overridden-for-usrmerge.patch
 create mode 100644 meta-networking/recipes-support/ifupdown-ng/ifupdown-ng_0.11.3.bb

Patch

diff --git a/meta-networking/recipes-support/ifupdown-ng/ifupdown-ng/0001-build-Allow-sbin-to-be-overridden-for-usrmerge.patch b/meta-networking/recipes-support/ifupdown-ng/ifupdown-ng/0001-build-Allow-sbin-to-be-overridden-for-usrmerge.patch
new file mode 100644
index 000000000000..7738eea19f1e
--- /dev/null
+++ b/meta-networking/recipes-support/ifupdown-ng/ifupdown-ng/0001-build-Allow-sbin-to-be-overridden-for-usrmerge.patch
@@ -0,0 +1,42 @@ 
+From 8df83410c0db4a9688c76529d9396859a8cf25a7 Mon Sep 17 00:00:00 2001
+From: Alex Kiernan <alexk@zuma.ai>
+Date: Thu, 30 Dec 2021 17:35:22 +0000
+Subject: [PATCH] build: Allow /sbin to be overridden for usrmerge
+
+To support usrmerge installation in Yocto, make SBINDIR a variable which
+can be overridden.
+
+Upstream-Status: Submitted [https://github.com/ifupdown-ng/ifupdown-ng/pull/164]
+Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
+Signed-off-by: Alex Kiernan <alexk@zuma.ai>
+---
+ Makefile | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 9fb6199a5e80..527fbd7a911f 100644
+--- a/Makefile
++++ b/Makefile
+@@ -7,6 +7,7 @@ PACKAGE_NAME := ifupdown-ng
+ PACKAGE_VERSION := 0.11.3
+ PACKAGE_BUGREPORT := https://github.com/ifupdown-ng/ifupdown-ng/issues/new
+ 
++SBINDIR := /sbin
+ 
+ INTERFACES_FILE := /etc/network/interfaces
+ STATE_FILE := /run/ifstate
+@@ -146,9 +147,9 @@ check: ${LIBIFUPDOWN_LIB} ${CMDS}
+ 	kyua test || (kyua report --verbose && exit 1)
+ 
+ install: all
+-	install -D -m755 ${MULTICALL} ${DESTDIR}/sbin/${MULTICALL}
++	install -D -m755 ${MULTICALL} ${DESTDIR}${SBINDIR}/${MULTICALL}
+ 	for i in ${CMDS}; do \
+-		ln -s /sbin/${MULTICALL} ${DESTDIR}/sbin/$$i; \
++		ln -s ${SBINDIR}/${MULTICALL} ${DESTDIR}${SBINDIR}/$$i; \
+ 	done
+ 	for i in ${EXECUTOR_SCRIPTS}; do \
+ 		install -D -m755 executor-scripts/${LAYOUT}/$$i ${DESTDIR}${EXECUTOR_PATH}/$$i; \
+-- 
+2.34.1
+
diff --git a/meta-networking/recipes-support/ifupdown-ng/ifupdown-ng_0.11.3.bb b/meta-networking/recipes-support/ifupdown-ng/ifupdown-ng_0.11.3.bb
new file mode 100644
index 000000000000..0b815c07f047
--- /dev/null
+++ b/meta-networking/recipes-support/ifupdown-ng/ifupdown-ng_0.11.3.bb
@@ -0,0 +1,47 @@ 
+SUMMARY = "Flexible ifup/ifdown implementation"
+DESCRIPTION = "ifupdown-ng is a network device manager that is largely \
+compatible with Debian ifupdown, BusyBox ifupdown and Cumulus Networks' \
+ifupdown2."
+LICENSE = "ISC"
+LIC_FILES_CHKSUM = "file://COPYING;md5=451f521abe917914139c9739ea0f2bc5"
+
+DEPENDS = "libbsd"
+
+PV .= "+git${SRCPV}"
+
+SRC_URI = "git://github.com/ifupdown-ng/ifupdown-ng.git;protocol=https;branch=main \
+           file://0001-build-Allow-sbin-to-be-overridden-for-usrmerge.patch \
+"
+SRCREV = "e978d1a42c1fe6978ba55aaa733fcda3a7dc3717"
+
+S = "${WORKDIR}/git"
+
+inherit pkgconfig update-alternatives
+
+LIBBSD_CFLAGS = "`pkg-config --cflags libbsd-overlay`"
+LIBBSD_LIBS = "`pkg-config --cflags --libs libbsd-overlay`"
+
+EXTRA_OEMAKE = "\
+    CC='${CC} ${CFLAGS} ${LDFLAGS}' \
+    LD='${LD} ${LDFLAGS}' \
+    SBINDIR='${base_sbindir}' \
+    LIBBSD_CFLAGS='${LIBBSD_CFLAGS}' \
+    LIBBSD_LIBS='${LIBBSD_LIBS}' \
+    INTERFACES_FILE='${sysconfdir}/network/interfaces' \
+    CONFIG_FILE='${sysconfdir}/network/ifupdown-ng.conf' \
+    EXECUTOR_PATH='${libexecdir}/${BPN}' \
+"
+
+do_compile () {
+	oe_runmake
+}
+
+do_install () {
+	oe_runmake 'DESTDIR=${D}' install
+}
+
+ALTERNATIVE_PRIORITY = "120"
+ALTERNATIVE:${PN} = "ifup ifdown"
+
+ALTERNATIVE_LINK_NAME[ifup] = "${base_sbindir}/ifup"
+ALTERNATIVE_LINK_NAME[ifdown] = "${base_sbindir}/ifdown"