+++ /dev/null
-#!/bin/sh
-#
-# Start logging
-#
-
-SYSLOGD_ARGS=-n
-KLOGD_ARGS=-n
-[ -r /etc/default/logging ] && . /etc/default/logging
-
-start() {
- printf "Starting logging: "
- start-stop-daemon -b -S -q -m -p /var/run/syslogd.pid --exec /sbin/syslogd -- $SYSLOGD_ARGS
- start-stop-daemon -b -S -q -m -p /var/run/klogd.pid --exec /sbin/klogd -- $KLOGD_ARGS
- echo "OK"
-}
-
-stop() {
- printf "Stopping logging: "
- start-stop-daemon -K -q -p /var/run/syslogd.pid
- start-stop-daemon -K -q -p /var/run/klogd.pid
- echo "OK"
-}
-
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- restart|reload)
- stop
- start
- ;;
- *)
- echo "Usage: $0 {start|stop|restart|reload}"
- exit 1
-esac
-
-exit $?
--- /dev/null
+#!/bin/sh
+
+DAEMON="syslogd"
+PIDFILE="/var/run/$DAEMON.pid"
+
+SYSLOGD_ARGS=""
+
+# shellcheck source=/dev/null
+[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
+
+# BusyBox' syslogd does not create a pidfile, so pass "-n" in the command line
+# and use "-m" to instruct start-stop-daemon to create one.
+start() {
+ printf 'Starting %s: ' "$DAEMON"
+ # shellcheck disable=SC2086 # we need the word splitting
+ start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/sbin/$DAEMON" \
+ -- -n $SYSLOGD_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"
+ status=$?
+ if [ "$status" -eq 0 ]; then
+ rm -f "$PIDFILE"
+ echo "OK"
+ else
+ echo "FAIL"
+ fi
+ return "$status"
+}
+
+restart() {
+ stop
+ sleep 1
+ start
+}
+
+case "$1" in
+ start|stop|restart)
+ "$1";;
+ reload)
+ # Restart, since there is no true "reload" feature.
+ restart;;
+ *)
+ echo "Usage: $0 {start|stop|restart|reload}"
+ exit 1
+esac
--- /dev/null
+#!/bin/sh
+
+DAEMON="klogd"
+PIDFILE="/var/run/$DAEMON.pid"
+
+KLOGD_ARGS=""
+
+# shellcheck source=/dev/null
+[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
+
+# BusyBox' klogd does not create a pidfile, so pass "-n" in the command line
+# and use "-m" to instruct start-stop-daemon to create one.
+start() {
+ printf 'Starting %s: ' "$DAEMON"
+ # shellcheck disable=SC2086 # we need the word splitting
+ start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/sbin/$DAEMON" \
+ -- -n $KLOGD_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"
+ status=$?
+ if [ "$status" -eq 0 ]; then
+ rm -f "$PIDFILE"
+ echo "OK"
+ else
+ echo "FAIL"
+ fi
+ return "$status"
+}
+
+restart() {
+ stop
+ sleep 1
+ start
+}
+
+case "$1" in
+ start|stop|restart)
+ "$1";;
+ reload)
+ # Restart, since there is no true "reload" feature.
+ restart;;
+ *)
+ echo "Usage: $0 {start|stop|restart|reload}"
+ exit 1
+esac
$(if $(BR2_PACKAGE_PCIUTILS),pciutils) \
$(if $(BR2_PACKAGE_PROCPS_NG),procps-ng) \
$(if $(BR2_PACKAGE_PSMISC),psmisc) \
- $(if $(BR2_PACKAGE_RSYSLOGD),rsyslog) \
$(if $(BR2_PACKAGE_START_STOP_DAEMON),start-stop-daemon) \
$(if $(BR2_PACKAGE_SYSKLOGD),sysklogd) \
- $(if $(BR2_PACKAGE_SYSLOG_NG),syslog-ng) \
$(if $(BR2_PACKAGE_SYSTEMD),systemd) \
$(if $(BR2_PACKAGE_SYSVINIT),sysvinit) \
$(if $(BR2_PACKAGE_TAR),tar) \
endef
endif
-# Only install our own if no other package already did.
+# Only install our logging scripts if no other package does it.
+ifeq ($(BR2_PACKAGE_SYSKLOGD)$(BR2_PACKAGE_RSYSLOG)$(BR2_PACKAGE_SYSLOG_NG),)
define BUSYBOX_INSTALL_LOGGING_SCRIPT
- if grep -q CONFIG_SYSLOGD=y $(@D)/.config && \
- [ ! -e $(TARGET_DIR)/etc/init.d/S01logging ]; \
+ if grep -q CONFIG_SYSLOGD=y $(@D)/.config; \
then \
- $(INSTALL) -m 0755 -D package/busybox/S01logging \
- $(TARGET_DIR)/etc/init.d/S01logging; \
+ $(INSTALL) -m 0755 -D package/busybox/S01syslogd \
+ $(TARGET_DIR)/etc/init.d/S01syslogd; \
+ fi; \
+ if grep -q CONFIG_KLOGD=y $(@D)/.config; \
+ then \
+ $(INSTALL) -m 0755 -D package/busybox/S02klogd \
+ $(TARGET_DIR)/etc/init.d/S02klogd; \
fi
endef
+endif
ifeq ($(BR2_INIT_BUSYBOX),y)
define BUSYBOX_INSTALL_INITTAB