package/iwd: add sysv init script
authorPeter Seiderer <ps.report@gmx.net>
Tue, 16 Jun 2020 06:34:31 +0000 (08:34 +0200)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Wed, 17 Jun 2020 19:57:43 +0000 (21:57 +0200)
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/iwd/S40iwd [new file with mode: 0644]
package/iwd/iwd.mk

diff --git a/package/iwd/S40iwd b/package/iwd/S40iwd
new file mode 100644 (file)
index 0000000..6714ca9
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+DAEMON="/usr/libexec/iwd"
+PIDFILE="/var/run/iwd.pid"
+
+IWD_ARGS=""
+
+[ -r "/etc/default/iwd" ] && . "/etc/default/iwd"
+
+start() {
+       printf "Starting iwd:"
+       mkdir -p /tmp/iwd/hotspot
+       start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "$DAEMON" \
+               -- $IWD_ARGS
+       status=$?
+       if [ "$status" -eq 0 ]; then
+               echo "OK"
+       else
+               echo "FAIL"
+       fi
+       return "$status"
+}
+
+stop() {
+       printf "Stopping iwd:"
+       start-stop-daemon -K -q -p "$PIDFILE"
+       status=$?
+       if [ "$status" -eq 0 ]; then
+               echo "OK"
+       else
+               echo "FAIL"
+       fi
+       return "$status"
+}
+
+case "$1" in
+       start|stop)
+               "$1";;
+       *)
+               echo "Usage: $0 {start|stop}"
+               exit 1
+esac
index d0749642677f7f90d0fc0fe0f39520526fe8adc0..853638e8ca44787b566380233357a874037decfe 100644 (file)
@@ -59,4 +59,11 @@ endef
 
 IWD_POST_INSTALL_TARGET_HOOKS += IWD_INSTALL_CONFIG_FILE
 
+define IWD_INSTALL_INIT_SYSV
+       $(INSTALL) -m 0755 -D package/iwd/S40iwd \
+               $(TARGET_DIR)/etc/init.d/S40iwd
+       mkdir -p $(TARGET_DIR)/var/lib/iwd
+       ln -sf /tmp/iwd/hotspot $(TARGET_DIR)/var/lib/iwd/hotspot
+endef
+
 $(eval $(autotools-package))