From 7b836e6ed26da83fba5439f60f08eb4d4a2779b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Henrique=20Ferreira=20de=20Freitas?= Date: Fri, 21 Mar 2025 21:07:54 -0300 Subject: [PATCH] iwd: add systemv-init script Signed-off-by: Khem Raj --- meta-oe/recipes-connectivity/iwd/iwd/iwd | 42 +++++++++++++++++++++ meta-oe/recipes-connectivity/iwd/iwd_3.3.bb | 11 +++++- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-connectivity/iwd/iwd/iwd diff --git a/meta-oe/recipes-connectivity/iwd/iwd/iwd b/meta-oe/recipes-connectivity/iwd/iwd/iwd new file mode 100644 index 0000000000..89fc75c9ab --- /dev/null +++ b/meta-oe/recipes-connectivity/iwd/iwd/iwd @@ -0,0 +1,42 @@ +#!/bin/sh + +DAEMON=/usr/libexec/iwd +PIDFILE=/var/run/iwd.pid +DESC="iNet wireless daemon" + +if [ -f /etc/default/iwd ] ; then + . /etc/default/iwd +fi + +set -e + +do_start() { + start-stop-daemon --start --background --name iwd --quiet --exec $DAEMON +} + +do_stop() { + start-stop-daemon --stop --oknodo --name iwd --quiet +} + +case "$1" in + start) + echo "Starting $DESC" + do_start + ;; + stop) + echo "Stopping $DESC" + do_stop + ;; + restart|force-reload) + echo "Restarting $DESC" + do_stop + sleep 1 + do_start + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 \ No newline at end of file diff --git a/meta-oe/recipes-connectivity/iwd/iwd_3.3.bb b/meta-oe/recipes-connectivity/iwd/iwd_3.3.bb index 84b1795995..9d5b3658ae 100644 --- a/meta-oe/recipes-connectivity/iwd/iwd_3.3.bb +++ b/meta-oe/recipes-connectivity/iwd/iwd_3.3.bb @@ -7,10 +7,11 @@ DEPENDS = "dbus" SRC_URI = "https://www.kernel.org/pub/linux/network/wireless/${BP}.tar.xz \ file://0001-build-Use-abs_top_srcdir-instead-of-abs_srcdir-for-e.patch \ + file://iwd \ " SRC_URI[sha256sum] = "8189e15e701112f871fb5f5e9351f007c9098754b4168ed43cc5422a3adc0255" -inherit autotools manpages pkgconfig python3native systemd +inherit autotools manpages pkgconfig python3native systemd update-rc.d PACKAGECONFIG ??= " \ client \ @@ -24,6 +25,9 @@ PACKAGECONFIG[wired] = "--enable-wired,--disable-wired" PACKAGECONFIG[ofono] = "--enable-ofono,--disable-ofono" PACKAGECONFIG[systemd] = "--with-systemd-unitdir=${systemd_system_unitdir},--disable-systemd-service,systemd" +INITSCRIPT_NAME = "iwd" +INITSCRIPT_PARAMS = "start 04 5 2 3 . stop 23 0 1 6 ." + SYSTEMD_SERVICE:${PN} = " \ iwd.service \ ${@bb.utils.contains('PACKAGECONFIG', 'wired', 'ead.service', '', d)} \ @@ -36,6 +40,11 @@ do_configure:prepend() { do_install:append() { # If client and monitor are disabled, bindir is empty, causing a QA error rmdir --ignore-fail-on-non-empty ${D}/${bindir} + + if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${UNPACKDIR}/iwd ${D}${sysconfdir}/init.d/iwd + fi } FILES:${PN} += " \