From 9310f36a2d25dc15161a8db0a97b98f515a214e1 Mon Sep 17 00:00:00 2001 From: Nicolas Thill Date: Wed, 16 Nov 2011 09:44:06 +0000 Subject: [PATCH] packages/lldpd: use new service functions SVN-Revision: 29170 --- net/lldpd/Makefile | 4 ++-- net/lldpd/files/lldpd.init | 41 +++++++++++++++++++------------------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/net/lldpd/Makefile b/net/lldpd/Makefile index 83103e5ee8..86d49bd5f2 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:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.luffy.cx/lldpd/ diff --git a/net/lldpd/files/lldpd.init b/net/lldpd/files/lldpd.init index 195a02760a..a627056f71 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.30.2