]> Git Repo - buildroot-mgba.git/commitdiff
package/atftp: add sysvinit script
authorBrandon Maier <[email protected]>
Tue, 2 Jul 2024 15:18:44 +0000 (15:18 +0000)
committerThomas Petazzoni <[email protected]>
Tue, 9 Jul 2024 20:14:51 +0000 (22:14 +0200)
Add a script to launch the atftp daemon at boot.

Signed-off-by: Brandon Maier <[email protected]>
Signed-off-by: Thomas Petazzoni <[email protected]>
package/atftp/S80atftpd [new file with mode: 0644]
package/atftp/atftp.mk

diff --git a/package/atftp/S80atftpd b/package/atftp/S80atftpd
new file mode 100644 (file)
index 0000000..523251b
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+DAEMON="atftpd"
+PIDFILE="/var/run/$DAEMON.pid"
+ATFTPD_ARGS="--user root.root /tftpboot"
+
+# shellcheck disable=SC1090
+[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
+
+start() {
+       printf 'Starting %s: ' "$DAEMON"
+       # shellcheck disable=SC2086 # we need the word splitting
+       start-stop-daemon -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" -- \
+               --daemon --pidfile="$PIDFILE" $ATFTPD_ARGS
+       status=$?
+       if [ "$status" -eq 0 ]; then
+               echo "OK"
+       else
+               echo "FAIL"
+       fi
+       return "$status"
+}
+
+stop() {
+       printf 'Stopping %s: ' "$DAEMON"
+       start-stop-daemon -K -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON"
+       status=$?
+       if [ "$status" -eq 0 ]; then
+               echo "OK"
+       else
+               echo "FAIL"
+       fi
+       return "$status"
+}
+
+case "$1" in
+start)
+       start
+       ;;
+stop)
+       stop
+       ;;
+restart|reload)
+       stop
+       start
+       ;;
+*)
+       echo "Usage: $0 {start|stop|restart}"
+       exit 1
+esac
index d41178cac42df57bc0d60339d5f4a60f9fced2bc..c71a70cd5dc541a2741237f5bfd95e159663b1b4 100644 (file)
@@ -36,4 +36,9 @@ else
 ATFTP_CONF_OPTS += --disable-libpcre
 endif
 
+define ATFTP_INSTALL_INIT_SYSV
+       $(INSTALL) -m 755 -D package/atftp/S80atftpd \
+               $(TARGET_DIR)/etc/init.d/S80atftpd
+endef
+
 $(eval $(autotools-package))
This page took 0.04254 seconds and 4 git commands to generate.