packages/lldpd: use new service functions

git-svn-id: svn://svn.openwrt.org/openwrt/packages@29170 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nico 2011-11-16 09:44:06 +00:00
parent c3252e539f
commit 7a14389fa4
2 changed files with 23 additions and 22 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2008 OpenWrt.org
# Copyright (C) 2008-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=lldpd
PKG_VERSION:=0.3
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.luffy.cx/lldpd/

View File

@ -1,7 +1,10 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2008-2011 OpenWrt.org
START=90
SERVICE_USE_PID=1
start() {
local enable_cdp
local enable_fdp
@ -9,27 +12,25 @@ start() {
local enable_edp
local lldp_class
local lldp_location
local args="-d"
config_load lldpd
config_get_bool enable_cdp config enable_cdp
config_get_bool enable_fdp config enable_fdp
config_get_bool enable_sonmp config enable_sonmp
config_get_bool enable_edp config enable_edp
config_get lldp_class config lldp_class
config_get lldp_location config lldp_location
[ "$enable_cdp" == 1 ] && append args "-c"
[ "$enable_fdp" == 1 ] && append args "-f"
[ "$enable_sonmp" == 1 ] && append args "-s"
[ "$enable_edp" == 1 ] && append args "-e"
[ -n "$lldp_location" ] && append args "-L '$lldp_location'"
append args "-M ${lldp_class:-4}"
eval start-stop-daemon -S -x lldpd -b -q -- $args
config_load 'lldpd'
config_get_bool enable_cdp 'config' 'enable_cdp' 0
config_get_bool enable_fdp 'config' 'enable_fdp' 0
config_get_bool enable_sonmp 'config' 'enable_sonmp' 0
config_get_bool enable_edp 'config' 'enable_edp' 0
config_get lldp_class 'config' 'lldp_class'
config_get lldp_location 'config' 'lldp_location'
[ $enable_cdp -gt 0 ] && append args '-c'
[ $enable_fdp -gt 0 ] && append args '-f'
[ $enable_sonmp -gt 0 ] && append args '-s'
[ $enable_edp -gt 0 ] && append args '-e'
service_start /usr/sbin/lldpd $args \
${lldp_location:+ -L "$lldp_location"} \
${lldp_class:+ -M $lldp_class}
}
stop() {
start-stop-daemon -K -q -x lldpd
rm -f /var/run/lldpd.socket
service_stop /usr/sbin/lldpd
}