[no ci] Overlay: additional script refactoring

pull/1369/head
Viktor 2024-03-31 22:12:52 +02:00
parent 499db53eff
commit 1c14ca8786
6 changed files with 9 additions and 24 deletions

View File

@ -2,7 +2,6 @@
DAEMON="syslogd"
PIDFILE="/var/run/$DAEMON.pid"
SYSLOGD_ARGS="-C64 -t"
# shellcheck source=/dev/null

View File

@ -2,9 +2,7 @@
case "$1" in
start)
printf "Loading modules:"
# load modules for detected devices
# find /sys/ -name modalias -print0 | xargs -0 sort -u -z | xargs -0 modprobe -abq
echo "Loading kernel modules..."
# load modules from /etc/modules
[ -r /etc/modules ] || exit 0

View File

@ -1,31 +1,21 @@
#!/bin/sh
NAME="rngd"
DAEMON="/usr/sbin/${NAME}"
DAEMON="rngd"
DAEMON_ARGS="-r /dev/urandom"
CFG_FILE="/etc/default/${NAME}"
PID_FILE="/var/run/${NAME}.pid"
# Read configuration variable file if it is present
[ -r "${CFG_FILE}" ] && . "${CFG_FILE}"
PID_FILE="/var/run/$DAEMON.pid"
start() {
printf "Starting ${NAME}: "
start-stop-daemon -S -q -x "${DAEMON}" -- ${DAEMON_ARGS}
[ $? = 0 ] && echo "OK" || echo "FAIL"
echo "Starting $DAEMON..."
start-stop-daemon -S -q -x "/usr/sbin/$DAEMON" -- $DAEMON_ARGS
}
stop() {
printf "Stopping ${NAME}: "
echo "Stopping $DAEMON..."
# 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
start-stop-daemon -K -q -s KILL -p "$PID_FILE" -n "$DAEMON"
rm -f "$PID_FILE"
}
case "$1" in

View File

@ -2,7 +2,6 @@
DAEMON="ntpd"
PIDFILE="/var/run/$DAEMON.pid"
NTPD_ARGS="-n"
# shellcheck source=/dev/null

View File

@ -2,7 +2,6 @@
DAEMON="crond"
PIDFILE="/var/run/$DAEMON.pid"
CROND_ARGS="-f -c /etc/crontabs"
# shellcheck source=/dev/null

View File

@ -9,7 +9,7 @@ case "$1" in
start)
[ "${vendor}" = "goke" ] || [ "${vendor}" = "hisilicon" ] && status=$(check_mac)
[ -n "${status}" ] && log_vendor "${status}"
echo -e '\nLoading of kernel modules...'
echo -e "\nLoading vendor modules..."
load_${vendor} -i
;;
esac