[package] add a config file and init script to mini_snmpd (#5496)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@16774 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
3d3745d2b3
commit
e602b72d3a
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=mini_snmpd
|
PKG_NAME:=mini_snmpd
|
||||||
PKG_VERSION:=1.0
|
PKG_VERSION:=1.0
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=3
|
||||||
|
|
||||||
PKG_SOURCE:=mini_snmpd.tar.gz
|
PKG_SOURCE:=mini_snmpd.tar.gz
|
||||||
PKG_SOURCE_URL:=http://members.aon.at/linuxfreak/linux/
|
PKG_SOURCE_URL:=http://members.aon.at/linuxfreak/linux/
|
||||||
@ -39,6 +39,10 @@ endef
|
|||||||
define Package/mini-snmpd/install
|
define Package/mini-snmpd/install
|
||||||
$(INSTALL_DIR) $(1)/sbin
|
$(INSTALL_DIR) $(1)/sbin
|
||||||
$(CP) $(PKG_INSTALL_DIR)/sbin/mini_snmpd $(1)/sbin/
|
$(CP) $(PKG_INSTALL_DIR)/sbin/mini_snmpd $(1)/sbin/
|
||||||
|
$(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
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,mini-snmpd))
|
$(eval $(call BuildPackage,mini-snmpd))
|
||||||
|
7
net/mini_snmpd/files/mini_snmpd.config
Normal file
7
net/mini_snmpd/files/mini_snmpd.config
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
config mini_snmpd
|
||||||
|
option enabled 1
|
||||||
|
option community public
|
||||||
|
option location ''
|
||||||
|
option contact ''
|
||||||
|
option disks '/tmp,/jffs'
|
||||||
|
option interfaces 'lo,br-lan,eth0.1,eth1' # Max 4
|
38
net/mini_snmpd/files/mini_snmpd.init
Normal file
38
net/mini_snmpd/files/mini_snmpd.init
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
# Copyright (C) 2009 OpenWrt.org
|
||||||
|
|
||||||
|
NAME=mini_snmpd
|
||||||
|
PROG=/usr/bin/$NAME
|
||||||
|
START=50
|
||||||
|
|
||||||
|
append_string() {
|
||||||
|
local section="$1"
|
||||||
|
local option="$2"
|
||||||
|
local value="$3"
|
||||||
|
local _val
|
||||||
|
config_get _val "$section" "$option"
|
||||||
|
[ -n "$_val" ] && append args "$3 $_val"
|
||||||
|
}
|
||||||
|
|
||||||
|
mini_snmpd_config() {
|
||||||
|
local cfg="$1"
|
||||||
|
args=""
|
||||||
|
|
||||||
|
append_string "$cfg" community "-c"
|
||||||
|
append_string "$cfg" location "-L"
|
||||||
|
append_string "$cfg" contact "-C"
|
||||||
|
append_string "$cfg" disks "-d"
|
||||||
|
append_string "$cfg" interfaces "-i"
|
||||||
|
|
||||||
|
config_get_bool enabled "$cfg" "enabled" '1'c
|
||||||
|
[ "$enabled" -gt 0 ] && $PROG $args &
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
config_load mini_snmpd
|
||||||
|
config_foreach mini_snmpd_config mini_snmpd
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
killall mini_snmpd
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user