package/atftp: add sysvinit script

Add a script to launch the atftp daemon at boot.

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Brandon Maier
2024-07-02 15:18:44 +00:00
committed by Thomas Petazzoni
parent fd31530672
commit 8423849576
2 changed files with 55 additions and 0 deletions

50
package/atftp/S80atftpd Normal file
View File

@@ -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

View 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))