#
-# 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.
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/
$(INSTALL_DATA) ./files/lldpd.config $(1)/etc/config/lldpd
endef
+define Package/lldpd/conffiles
+/etc/config/lldpd
+endef
+
$(eval $(call BuildPackage,lldpd))
#!/bin/sh /etc/rc.common
+# Copyright (C) 2008-2011 OpenWrt.org
START=90
+SERVICE_USE_PID=1
+
start() {
local enable_cdp
local enable_fdp
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
}