mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-10-01 06:21:56 -09:00
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:
committed by
Thomas Petazzoni
parent
fd31530672
commit
8423849576
50
package/atftp/S80atftpd
Normal file
50
package/atftp/S80atftpd
Normal 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
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user