mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-28 13:46:32 +00:00
package/rng-tools: add SysV init script
[Thomas: minor adjustments to make the script look more like our standard init scripts.] Signed-off-by: Benoît Thébaudeau <benoit@wsystem.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
parent
f061efd8e5
commit
f54df529da
48
package/rng-tools/S21rngd
Executable file
48
package/rng-tools/S21rngd
Executable file
@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
NAME="rngd"
|
||||||
|
DAEMON="/usr/sbin/${NAME}"
|
||||||
|
DAEMON_ARGS=""
|
||||||
|
CFG_FILE="/etc/default/${NAME}"
|
||||||
|
PID_FILE="/var/run/${NAME}.pid"
|
||||||
|
|
||||||
|
# Read configuration variable file if it is present
|
||||||
|
[ -r "${CFG_FILE}" ] && . "${CFG_FILE}"
|
||||||
|
|
||||||
|
start()
|
||||||
|
{
|
||||||
|
printf "Starting ${NAME}: "
|
||||||
|
start-stop-daemon -S -q -x "${DAEMON}" -- ${DAEMON_ARGS}
|
||||||
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||||
|
}
|
||||||
|
|
||||||
|
stop()
|
||||||
|
{
|
||||||
|
printf "Stopping ${NAME}: "
|
||||||
|
# This daemon does not exit properly with the default TERM signal unless
|
||||||
|
# it's forced to work by something reading /dev/random. Killing it and
|
||||||
|
# removing its PID file is more straightforward.
|
||||||
|
if start-stop-daemon -K -q -s KILL -p "${PID_FILE}" -n "${NAME}"; then
|
||||||
|
rm -f "${PID_FILE}"
|
||||||
|
echo "OK"
|
||||||
|
else
|
||||||
|
echo "FAIL"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
stop
|
||||||
|
;;
|
||||||
|
restart|reload)
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 {start|stop|restart|reload}" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
@ -22,6 +22,11 @@ else
|
|||||||
RNG_TOOLS_CONF_OPTS += --without-libgcrypt
|
RNG_TOOLS_CONF_OPTS += --without-libgcrypt
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
define RNG_TOOLS_INSTALL_INIT_SYSV
|
||||||
|
$(INSTALL) -D -m 755 package/rng-tools/S21rngd \
|
||||||
|
$(TARGET_DIR)/etc/init.d/S21rngd
|
||||||
|
endef
|
||||||
|
|
||||||
define RNG_TOOLS_INSTALL_INIT_SYSTEMD
|
define RNG_TOOLS_INSTALL_INIT_SYSTEMD
|
||||||
$(INSTALL) -D -m 644 package/rng-tools/rngd.service \
|
$(INSTALL) -D -m 644 package/rng-tools/rngd.service \
|
||||||
$(TARGET_DIR)/usr/lib/systemd/system/rngd.service
|
$(TARGET_DIR)/usr/lib/systemd/system/rngd.service
|
||||||
|
Loading…
x
Reference in New Issue
Block a user