mini_snmpd: 1.4-rc1 add git,autoconf,procd init script,uci validation - new upstream/openwrt maintainer

Makes use of all available runtime options that can be passed to
mini_snmpd such as -I listen_on interface

Run-tested on trunk on ar71xx. Please review the init script regarding procd
monitoring interfaces, though everything else due to the conversion to
procd should be and done properly, if not overkill compared to most
other script bundled with openwrt.

The main benefit of all this is now larger routers can run multiple
instances of mini_snmpd on different ports, to get around the MIB hard
coded 4 interface/mountpoint limits.

Due to somewhat lacking dev / package maintainer docs except for
http://wiki.prplfoundation.org/wiki/Procd_reference writing this script
took longer than it should. You can see it's evolution here:
https://github.com/hojuruku/openwrt-packages/blob/mini_snmpd/net/mini_snmpd/files/mini_snmpd.init

If everything in it is found to be sane, please include it to the
openwrt wiki on procd as an example.

Due to procd / uci /sbin/validate_data cbi element datatype (uciname) being used
to check uci config, the configuration file now only takes openwrt uci network names not
physical network names as it did before.
http://git.openwrt.org/?p=packages.git;a=commit;h=783e5578ad104d1ca3c31582add08fc8eb4ad083

Like busybox the package Makefile has depends for all runtime
dependencies needed by the init script. mini_snmpd only depends on libc

squashed commits:
mini_snmpd: fix typo to fix procd triggers calling daemon binary directly instead of init script - misuse of $PROG var
mini_snmpd: enable SSP & mini_snmpd to start by default and listen on lan
mini_snmpd: disable RELRO blocker in Makefile after consulation
mini_snmpd: add smarts to init script to detect if ubusd hasn't started yet
mini_snmpd: fix init script - ubus -S doesn't print meaningful errors to give the user
mini_snmpd: Makefile roll back Makefile PKG_RELEASE to 1 for feng shui
This commit is contained in:
Luke McKee
2016-07-09 20:54:37 +07:00
parent cfb086812a
commit 82cf5ca5c6
5 changed files with 276 additions and 288 deletions
+39 -25
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2009-2014 OpenWrt.org
# Copyright (C) 2009-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@@ -8,54 +8,68 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=mini_snmpd
PKG_VERSION:=1.2b
PKG_RELEASE:=8
PKG_VERSION:=1.4-rc1
PKG_RELEASE:=1
PKG_MAINTAINER:=Luke McKee <hojuruku@gmail.com>
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/troglobit/mini-snmpd.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=203d92e60ed09466d6676c6ad20ad6cb2ce08a5d
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://members.aon.at/linuxfreak/linux/
PKG_MD5SUM:=9e432c50ba8216d7fab0983b11b7112a
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
PKG_FIXUP:=autoreconf
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
# As warned by upstream maintainer and binutils
# however compiler warnings can be ignored until next binutils release
# https://github.com/wongsyrone/openwrt-1/issues/67
# PKG_SSP:=0
# PKG_RELRO:=0
include $(INCLUDE_DIR)/package.mk
define Package/mini-snmpd
define Package/mini_snmpd
SECTION:=net
CATEGORY:=Network
TITLE:=SNMP server for embedded systems
URL:=http://members.aon.at/linuxfreak/linux/mini_snmpd.html
TITLE:=A tiny SNMP server for embedded systems
URL:=http://troglobit.github.io/mini-snmpd.html
# uncomment if you just want the binary, not the init script
# openwrt requires init script runtime dependencies be defined for make menuconfig
# (e.g busybox sysntpd)
DEPENDS:=+jsonfilter +ubus +procd +ubox
endef
ifneq ($(CONFIG_IPV6),)
TARGET_CFLAGS+= -D__IPV6__
else
TARGET_CFLAGS+= -D__IPV4__
endif
CONFIGURE_ARGS+= \
$(if $(CONFIG_IPV6),,--disable-ipv6)
TARGET_CFLAGS+= -DSYSLOG
# Configure weirdness - Disabled by default, explicitately disabling turns feature on!
# --disable-debug \
# --disable-demo - Upstream Github Issue #4 Fixed 20160707
MAKE_FLAGS+= \
OFLAGS="$(TARGET_CFLAGS)" \
# We make sure that only openwrt buildroot does the stripping as per user request via make menuconfig
CONFIGURE_VARS+= LD="$(TARGET_CC)" \
STRIP="/bin/true" \
INSTALL_ROOT="$(PKG_INSTALL_DIR)"
CFLAGS="$(TARGET_CFLAGS)"
MAKE_FLAGS+= STRIP="/bin/true"
define Build/Compile
$(call Build/Compile/Default,mini_snmpd)
endef
# FYI upstream suggested stripping options
# STRIP="strip -S --strip-unneeded --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag mini_snmpd"
define Package/mini-snmpd/install
define Package/mini_snmpd/install
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_INSTALL_DIR)/sbin/mini_snmpd $(1)/usr/bin/
$(CP) $(PKG_INSTALL_DIR)/usr/bin/mini_snmpd $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/mini_snmpd.config $(1)/etc/config/mini_snmpd
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/mini_snmpd.init $(1)/etc/init.d/mini_snmpd
endef
define Package/mini-snmpd/conffiles
define Package/mini_snmpd/conffiles
/etc/config/mini_snmpd
endef
$(eval $(call BuildPackage,mini-snmpd))
$(eval $(call BuildPackage,mini_snmpd))