From f8f1dfcffe21eea15603c695915ed78c8a07576c Mon Sep 17 00:00:00 2001 From: Viktor <35473052+viktorxda@users.noreply.github.com> Date: Wed, 10 Apr 2024 16:23:42 +0200 Subject: [PATCH] [no ci] Package: update mini-snmpd-openipc --- .../package/mini-snmpd-openipc/files/S50snmpd | 49 ++++++---------- .../package/mini-snmpd-openipc/mini-snmpd.mk | 9 +-- general/scripts/legacy/init.d/S50snmpd | 56 ------------------- 3 files changed, 22 insertions(+), 92 deletions(-) delete mode 100755 general/scripts/legacy/init.d/S50snmpd diff --git a/general/package/mini-snmpd-openipc/files/S50snmpd b/general/package/mini-snmpd-openipc/files/S50snmpd index e925ced5..84a00625 100755 --- a/general/package/mini-snmpd-openipc/files/S50snmpd +++ b/general/package/mini-snmpd-openipc/files/S50snmpd @@ -1,57 +1,42 @@ #!/bin/sh -DAEMON="mini-snmpd" +DAEMON="mini_snmpd" PIDFILE="/var/run/$DAEMON.pid" - SNMPD_ARGS="-n -4 -c openipc -i eth0 -D OpenIPC -C https://openipc.org -L Internet -l notice" -# shellcheck source=/dev/null -[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" - -# The mini-snmpd 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" - [ -f /usr/sbin/$DAEMON ] || echo -en "DISABLED, " - # shellcheck disable=SC2086 # we need the word splitting - start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \ - -- $SNMPD_ARGS - status=$? - if [ "$status" -eq 0 ]; then + printf "Starting $DAEMON: " + start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" -- $SNMPD_ARGS + if [ $? = 0 ]; then echo "OK" else echo "FAIL" fi - return "$status" } stop() { - printf 'Stopping %s: ' "$DAEMON" - [ -f /usr/sbin/$DAEMON ] || echo -en "DISABLED, " + printf "Stopping $DAEMON: " start-stop-daemon -K -q -p "$PIDFILE" - status=$? - if [ "$status" -eq 0 ]; then - rm -f "$PIDFILE" + if [ $? = 0 ]; then 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;; + start|stop) + "$1" + ;; + + restart|reload) + stop + sleep 1 + start + ;; + *) echo "Usage: $0 {start|stop|restart|reload}" exit 1 + ;; esac diff --git a/general/package/mini-snmpd-openipc/mini-snmpd.mk b/general/package/mini-snmpd-openipc/mini-snmpd.mk index c3c432b6..0e238dd5 100644 --- a/general/package/mini-snmpd-openipc/mini-snmpd.mk +++ b/general/package/mini-snmpd-openipc/mini-snmpd.mk @@ -4,18 +4,19 @@ # ################################################################################ -MINI_SNMPD_OPENIPC_VERSION = 1.4 -MINI_SNMPD_OPENIPC_SITE = $(call github,troglobit,mini-snmpd,v$(MINI_SNMPD_OPENIPC_VERSION)) +MINI_SNMPD_OPENIPC_VERSION = v1.4 +MINI_SNMPD_OPENIPC_SITE = $(call github,troglobit,mini-snmpd,$(MINI_SNMPD_OPENIPC_VERSION)) MINI_SNMPD_OPENIPC_LICENSE = GPL-2.0 MINI_SNMPD_OPENIPC_LICENSE_FILES = COPYING MINI_SNMPD_OPENIPC_AUTORECONF = YES define MINI_SNMPD_OPENIPC_INSTALL_TARGET_CMDS - $(INSTALL) -m 755 -d $(TARGET_DIR)/etc/init.d - cp $(MINI_SNMPD_OPENIPC_PKGDIR)/files/S50snmpd $(TARGET_DIR)/etc/init.d + $(INSTALL) -m 755 -t $(TARGET_DIR)/etc/init.d $(MINI_SNMPD_OPENIPC_PKGDIR)/files/S50snmpd + $(INSTALL) -m 755 -d $(TARGET_DIR)/usr/bin + $(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(@D)/mini_snmpd endef $(eval $(autotools-package)) diff --git a/general/scripts/legacy/init.d/S50snmpd b/general/scripts/legacy/init.d/S50snmpd deleted file mode 100755 index a8fc7959..00000000 --- a/general/scripts/legacy/init.d/S50snmpd +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh - -DAEMON="mini-snmpd" -PIDFILE="/var/run/$DAEMON.pid" - -SNMPD_ARGS="-n -4 -c openipc -i eth0 -D OpenIPC -C https://openipc.org -L Internet -l notice" - -# shellcheck source=/dev/null -[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" - -# The mini-snmpd 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" - [ -f /usr/sbin/$DAEMON ] || echo -en "DISABLED, " - # shellcheck disable=SC2086 # we need the word splitting - start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" -- $SNMPD_ARGS - status=$? - if [ "$status" -eq 0 ]; then - echo "OK" - else - echo "FAIL" - fi - return "$status" -} - -stop() { - printf 'Stopping %s: ' "$DAEMON" - [ -f /usr/sbin/$DAEMON ] || echo -en "DISABLED, " - start-stop-daemon -K -q -p "$PIDFILE" - status=$? - if [ "$status" -eq 0 ]; then - rm -f "$PIDFILE" - echo "OK" - else - echo "FAIL" - fi - return "$status" -} - -case "$1" in - start|stop) - "$1" - ;; - - restart|reload) - stop - sleep 1 - start - ;; - - *) - echo "Usage: $0 {start|stop|restart|reload}" - exit 1 - ;; -esac