[no ci] Package: update mini-snmpd-openipc

pull/1395/head
Viktor 2024-04-10 16:23:42 +02:00
parent cff39157a2
commit f8f1dfcffe
3 changed files with 22 additions and 92 deletions

View File

@ -1,57 +1,42 @@
#!/bin/sh #!/bin/sh
DAEMON="mini-snmpd" DAEMON="mini_snmpd"
PIDFILE="/var/run/$DAEMON.pid" PIDFILE="/var/run/$DAEMON.pid"
SNMPD_ARGS="-n -4 -c openipc -i eth0 -D OpenIPC -C https://openipc.org -L Internet -l notice" 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() { start() {
printf 'Starting %s: ' "$DAEMON" printf "Starting $DAEMON: "
[ -f /usr/sbin/$DAEMON ] || echo -en "DISABLED, " start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" -- $SNMPD_ARGS
# shellcheck disable=SC2086 # we need the word splitting if [ $? = 0 ]; then
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \
-- $SNMPD_ARGS
status=$?
if [ "$status" -eq 0 ]; then
echo "OK" echo "OK"
else else
echo "FAIL" echo "FAIL"
fi fi
return "$status"
} }
stop() { stop() {
printf 'Stopping %s: ' "$DAEMON" printf "Stopping $DAEMON: "
[ -f /usr/sbin/$DAEMON ] || echo -en "DISABLED, "
start-stop-daemon -K -q -p "$PIDFILE" start-stop-daemon -K -q -p "$PIDFILE"
status=$? if [ $? = 0 ]; then
if [ "$status" -eq 0 ]; then
rm -f "$PIDFILE"
echo "OK" echo "OK"
else else
echo "FAIL" echo "FAIL"
fi fi
return "$status"
}
restart() {
stop
sleep 1
start
} }
case "$1" in case "$1" in
start|stop|restart) start|stop)
"$1";; "$1"
reload) ;;
# Restart, since there is no true "reload" feature.
restart;; restart|reload)
stop
sleep 1
start
;;
*) *)
echo "Usage: $0 {start|stop|restart|reload}" echo "Usage: $0 {start|stop|restart|reload}"
exit 1 exit 1
;;
esac esac

View File

@ -4,18 +4,19 @@
# #
################################################################################ ################################################################################
MINI_SNMPD_OPENIPC_VERSION = 1.4 MINI_SNMPD_OPENIPC_VERSION = v1.4
MINI_SNMPD_OPENIPC_SITE = $(call github,troglobit,mini-snmpd,v$(MINI_SNMPD_OPENIPC_VERSION)) MINI_SNMPD_OPENIPC_SITE = $(call github,troglobit,mini-snmpd,$(MINI_SNMPD_OPENIPC_VERSION))
MINI_SNMPD_OPENIPC_LICENSE = GPL-2.0 MINI_SNMPD_OPENIPC_LICENSE = GPL-2.0
MINI_SNMPD_OPENIPC_LICENSE_FILES = COPYING MINI_SNMPD_OPENIPC_LICENSE_FILES = COPYING
MINI_SNMPD_OPENIPC_AUTORECONF = YES MINI_SNMPD_OPENIPC_AUTORECONF = YES
define MINI_SNMPD_OPENIPC_INSTALL_TARGET_CMDS define MINI_SNMPD_OPENIPC_INSTALL_TARGET_CMDS
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/init.d $(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 endef
$(eval $(autotools-package)) $(eval $(autotools-package))

View File

@ -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