From 1c14ca878636a2cf9261174eb4a4bd04f6fd1a94 Mon Sep 17 00:00:00 2001 From: Viktor <35473052+viktorxda@users.noreply.github.com> Date: Sun, 31 Mar 2024 22:12:52 +0200 Subject: [PATCH] [no ci] Overlay: additional script refactoring --- general/overlay/etc/init.d/S01syslogd | 1 - general/overlay/etc/init.d/S10modules | 4 +--- general/overlay/etc/init.d/S21rngd | 24 +++++++----------------- general/overlay/etc/init.d/S49ntpd | 1 - general/overlay/etc/init.d/S60crond | 1 - general/overlay/etc/init.d/S70vendor | 2 +- 6 files changed, 9 insertions(+), 24 deletions(-) diff --git a/general/overlay/etc/init.d/S01syslogd b/general/overlay/etc/init.d/S01syslogd index a14c1b0b..cea35a57 100755 --- a/general/overlay/etc/init.d/S01syslogd +++ b/general/overlay/etc/init.d/S01syslogd @@ -2,7 +2,6 @@ DAEMON="syslogd" PIDFILE="/var/run/$DAEMON.pid" - SYSLOGD_ARGS="-C64 -t" # shellcheck source=/dev/null diff --git a/general/overlay/etc/init.d/S10modules b/general/overlay/etc/init.d/S10modules index acc14423..7fb03528 100755 --- a/general/overlay/etc/init.d/S10modules +++ b/general/overlay/etc/init.d/S10modules @@ -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 diff --git a/general/overlay/etc/init.d/S21rngd b/general/overlay/etc/init.d/S21rngd index 2da62c66..6f701da7 100755 --- a/general/overlay/etc/init.d/S21rngd +++ b/general/overlay/etc/init.d/S21rngd @@ -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 diff --git a/general/overlay/etc/init.d/S49ntpd b/general/overlay/etc/init.d/S49ntpd index 0caf7eb7..0cba8499 100755 --- a/general/overlay/etc/init.d/S49ntpd +++ b/general/overlay/etc/init.d/S49ntpd @@ -2,7 +2,6 @@ DAEMON="ntpd" PIDFILE="/var/run/$DAEMON.pid" - NTPD_ARGS="-n" # shellcheck source=/dev/null diff --git a/general/overlay/etc/init.d/S60crond b/general/overlay/etc/init.d/S60crond index 4402eed7..2a6e76fa 100755 --- a/general/overlay/etc/init.d/S60crond +++ b/general/overlay/etc/init.d/S60crond @@ -2,7 +2,6 @@ DAEMON="crond" PIDFILE="/var/run/$DAEMON.pid" - CROND_ARGS="-f -c /etc/crontabs" # shellcheck source=/dev/null diff --git a/general/overlay/etc/init.d/S70vendor b/general/overlay/etc/init.d/S70vendor index 78960a5d..3e9ba069 100755 --- a/general/overlay/etc/init.d/S70vendor +++ b/general/overlay/etc/init.d/S70vendor @@ -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