From 0427a0f781a89e94330bc951c6043ab74411a477 Mon Sep 17 00:00:00 2001 From: jow Date: Sun, 5 Feb 2012 15:23:20 +0000 Subject: [PATCH] [packages_10.03.2] lldpd: merge r29170, r29199 git-svn-id: svn://svn.openwrt.org/openwrt/branches/packages_10.03.2@30215 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- net/lldpd/Makefile | 8 ++++++-- net/lldpd/files/lldpd.init | 41 +++++++++++++++++++++-------------------- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/net/lldpd/Makefile b/net/lldpd/Makefile index a4e6241..20b4f05 100644 --- a/net/lldpd/Makefile +++ b/net/lldpd/Makefile @@ -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:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.luffy.cx/lldpd/ @@ -56,4 +56,8 @@ define Package/lldpd/install $(INSTALL_DATA) ./files/lldpd.config $(1)/etc/config/lldpd endef +define Package/lldpd/conffiles +/etc/config/lldpd +endef + $(eval $(call BuildPackage,lldpd)) diff --git a/net/lldpd/files/lldpd.init b/net/lldpd/files/lldpd.init index 195a027..a627056 100644 --- a/net/lldpd/files/lldpd.init +++ b/net/lldpd/files/lldpd.init @@ -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 } -- 2.11.0