This adds lldpd from http://vincentbernat.github.io/lldpd/ to the list
of packages. Quote: »lldpd is a 802.1ab implementation (LLDP) to help
you locate neighbors of all your equipments.«

Signed-off-by: Alexander Dahl <p...@lespocky.de>
---
 generic/etc/init.d/lldpd |  139 ++++++++++++++++++++++++++++++++++++++++++++++
 rules/lldpd-bbinit.in    |    9 +++
 rules/lldpd.in           |   95 +++++++++++++++++++++++++++++++
 rules/lldpd.make         |   89 +++++++++++++++++++++++++++++
 4 files changed, 332 insertions(+)
 create mode 100755 generic/etc/init.d/lldpd
 create mode 100644 rules/lldpd-bbinit.in
 create mode 100644 rules/lldpd.in
 create mode 100644 rules/lldpd.make

diff --git a/generic/etc/init.d/lldpd b/generic/etc/init.d/lldpd
new file mode 100755
index 0000000..00c8240
--- /dev/null
+++ b/generic/etc/init.d/lldpd
@@ -0,0 +1,139 @@
+#!/bin/sh
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="LLDP daemon"
+NAME=lldpd
+DAEMON=/usr/sbin/$NAME
+DAEMON_ARGS="@DAEMON_ARGS@"
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+CHROOT=@PRIVSEP_CHROOT@
+
+# exit if binary is missing
+[ -x "$DAEMON" ] || exit 0
+
+# read further config if present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+is_running() {
+    start-stop-daemon -K --quiet --test --exec $DAEMON --pidfile $PIDFILE
+}
+
+do_chroot() {
+    oldumask=$(umask)
+    umask 022
+    [ -d $CHROOT/etc ] || mkdir -p $CHROOT/etc
+    [ -f $CHROOT/etc/localtime ] || [ ! -f /etc/localtime ] || \
+        cp /etc/localtime $CHROOT/etc/localtime
+    umask $oldumask
+}
+
+do_start() {
+    do_chroot
+    is_running && return 1
+    start-stop-daemon -S --quiet --pidfile $PIDFILE --exec $DAEMON -- \
+        $DAEMON_ARGS \
+        || return 2
+}
+
+do_stop() {
+    is_running || return 0
+    start-stop-daemon -K --quiet --pidfile $PIDFILE --name $NAME
+    RETVAL="$?"
+
+    # wait up to 30 seconds until daemon stopped
+    for i in $(seq 30)
+    do
+        sleep 1
+        echo -n '.'
+        if ! is_running
+        then
+            break
+        fi
+    done
+
+    # see if it's still running
+    if is_running
+    then
+        start-stop-daemon -K --quiet --signal KILL --pidfile $PIDFILE --name 
$NAME
+
+        for i in $(seq 5)
+        do
+            sleep 1
+            echo -n '.'
+            if ! is_running
+            then
+                break
+            fi
+        done
+
+        if is_running
+        then
+            return 2
+        fi
+    fi
+
+    rm -f $PIDFILE
+    return "$RETVAL"
+}
+
+do_reload() {
+    # send SIGHUP
+    start-stop-daemon -K --signal 1 --quiet --pidfile $PIDFILE --name $NAME
+    return 0
+}
+
+case "$1" in
+    start)
+        echo -n "Starting $DESC ..."
+        do_start
+        case "$?" in
+            0|1)    echo " Done." ;;
+            2)      echo " Failed." ;;
+        esac
+        ;;
+    stop)
+        echo -n "Stopping $DESC ."
+        do_stop
+        case "$?" in
+            0|1)    echo " Done." ;;
+            2)      echo " Failed." ;;
+        esac
+        ;;
+    reload)
+        echo -n "Reloading $DESC ..."
+        do_reload
+        echo " Done."
+        ;;
+    restart|force-reload)
+        echo -n "Restarting $DESC .."
+        do_stop
+        case "$?" in
+            0|1)
+                do_start
+                case "$?" in
+                    0)  echo " Done." ;;
+                    1)  echo " Failed." ;; # Old process still running
+                    *)  echo " Failed." ;; # Failed to start
+                esac
+                ;;
+            *)
+                echo " Failed." # Failed to stop
+                ;;
+        esac
+        ;;
+    status)
+        if is_running
+        then
+            echo "$NAME is running with PID $(cat $PIDFILE) ..."
+        else
+            echo "$NAME is not running"
+        fi
+        ;;
+    *)
+        echo "Usage: $SCRIPTNAME 
{start|stop|restart|reload|force-reload|status}" >&2
+        exit 3
+        ;;
+esac
+
+:
diff --git a/rules/lldpd-bbinit.in b/rules/lldpd-bbinit.in
new file mode 100644
index 0000000..103452a
--- /dev/null
+++ b/rules/lldpd-bbinit.in
@@ -0,0 +1,9 @@
+## SECTION=initmethod_bbinit
+
+config LLDPD_BBINIT_LINK
+       string
+       depends on LLDPD_STARTSCRIPT
+       prompt "lldpd"
+       default "S28lldpd"
+
+# vim: ft=kconfig noet tw=72
diff --git a/rules/lldpd.in b/rules/lldpd.in
new file mode 100644
index 0000000..c4b4434
--- /dev/null
+++ b/rules/lldpd.in
@@ -0,0 +1,95 @@
+## SECTION=networking
+
+menuconfig LLDPD
+       tristate
+       prompt "lldpd                         "
+       select INITMETHOD
+       select LIBEVENT
+       select NET_SNMP if LLDPD_SNMP
+       select NET_SNMP_MIB_MODULES_AGENTX if LLDPD_SNMP
+       select LIBXML2 if LLDPD_XML
+       select BUSYBOX_START_STOP_DAEMON if LLDPD_STARTSCRIPT
+       select BUSYBOX_FEATURE_START_STOP_DAEMON_LONG_OPTIONS if 
LLDPD_STARTSCRIPT
+       help
+         lldpd is an ISC-licensed implementation of LLDP for various
+         Unixes. It also supports some proprietary protocols.
+
+if LLDPD
+
+config LLDPD_PRIVSEP_USER
+       string
+       prompt "Which user to use for privilege separation"
+       default "nobody"
+
+config LLDPD_PRIVSEP_GROUP
+       string
+       prompt "Which group to use for privilege separation"
+       default "nogroup"
+
+config LLDPD_PRIVSEP_CHROOT
+       string
+       prompt "Which directory to use to chroot lldpd"
+       default "/var/run/lldpd"
+
+config LLDPD_CDP
+       bool
+       prompt "Enable Cisco Discovery Protocol"
+       default y
+
+config LLDPD_FDP
+       bool
+       prompt "Enable Foundry Discovery Protocol"
+       default y
+
+config LLDPD_EDP
+       bool
+       prompt "Enable Extreme Discovery Protocol"
+       default y
+
+config LLDPD_SONMP
+       bool
+       prompt "Enable SynOptics Network Management Protocol"
+       default y
+
+config LLDPD_LLDPMED
+       bool
+       prompt "Enable LLDP-MED extension"
+       default y
+
+config LLDPD_DOT1
+       bool
+       prompt "Enable Dot1 extension (VLAN stuff)"
+       default y
+
+config LLDPD_DOT3
+       bool
+       prompt "Enable Dot3 extension (PHY stuff)"
+       default y
+
+config LLDPD_OLDIES
+       bool
+       prompt "Enable compatibility with Linux kernel older than 2.6.18"
+
+config LLDPD_SNMP
+       bool
+       prompt "Enable the use of SNMP"
+
+config LLDPD_XML
+       bool
+       prompt "Enable XML output via libxml2"
+
+config LLDPD_STARTSCRIPT
+       bool
+       prompt "install /etc/init.d/lldpd"
+       default y
+
+config LLDPD_DAEMON_ARGS
+       string
+       prompt "additional arguments for daemon startup"
+       default ""
+       help
+         This could be -c -e -f -s …
+
+endif
+
+# vim: ft=kconfig noet tw=72
diff --git a/rules/lldpd.make b/rules/lldpd.make
new file mode 100644
index 0000000..a999100
--- /dev/null
+++ b/rules/lldpd.make
@@ -0,0 +1,89 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2013 by Alexander Dahl <p...@lespocky.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_LLDPD) += lldpd
+
+#
+# Paths and names
+#
+LLDPD_VERSION  := 0.7.6
+LLDPD_MD5              := dbd90a68b91448dcb94a4a77c5d8ef65
+LLDPD                  := lldpd-$(LLDPD_VERSION)
+LLDPD_SUFFIX   := tar.gz
+LLDPD_URL              := 
http://media.luffy.cx/files/lldpd//$(LLDPD).$(LLDPD_SUFFIX)
+LLDPD_SOURCE   := $(SRCDIR)/$(LLDPD).$(LLDPD_SUFFIX)
+LLDPD_DIR              := $(BUILDDIR)/$(LLDPD)
+LLDPD_LICENSE  := ICS
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+LLDPD_CONF_TOOL        := autoconf
+LLDPD_CONF_OPT := $(CROSS_AUTOCONF_USR) \
+       --disable-doxygen-doc \
+       --without-embedded-libevent \
+       --$(call ptx/endis, PTXCONF_LLDPD_CDP)-cdp \
+       --$(call ptx/endis, PTXCONF_LLDPD_FDP)-fdp \
+       --$(call ptx/endis, PTXCONF_LLDPD_EDP)-edp \
+       --$(call ptx/endis, PTXCONF_LLDPD_SONMP)-sonmp \
+       --$(call ptx/endis, PTXCONF_LLDPD_LLDPMED)-lldpmed \
+       --$(call ptx/endis, PTXCONF_LLDPD_DOT1)-dot1 \
+       --$(call ptx/endis, PTXCONF_LLDPD_DOT3)-dot3 \
+       --$(call ptx/endis, PTXCONF_LLDPD_OLDIES)-oldies \
+       --$(call ptx/wwo, PTXCONF_LLDPD_SNMP)-snmp \
+       --$(call ptx/wwo, PTXCONF_LLDPD_XML)-xml \
+       --with-privsep-user="$(PTXCONF_LLDPD_PRIVSEP_USER)" \
+       --with-privsep-group="$(PTXCONF_LLDPD_PRIVSEP_GROUP)" \
+       --with-privsep-chroot="$(PTXCONF_LLDPD_PRIVSEP_CHROOT)"
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/lldpd.targetinstall:
+       @$(call targetinfo)
+
+       @$(call install_init, lldpd)
+       @$(call install_fixup, lldpd,PRIORITY,optional)
+       @$(call install_fixup, lldpd,SECTION,base)
+       @$(call install_fixup, lldpd,AUTHOR,"Alexander Dahl <p...@lespocky.de>")
+       @$(call install_fixup, lldpd,DESCRIPTION,missing)
+
+       @$(call install_copy, lldpd, 0, 0, 0755, -, /usr/sbin/lldpd)
+       @$(call install_copy, lldpd, $(PTXCONF_LLDPD_PRIVSEP_USER), \
+               $(PTXCONF_LLDPD_PRIVSEP_GROUP), 4750, -, /usr/sbin/lldpcli)
+       @$(call install_link, lldpd, lldpcli, /usr/sbin/lldpctl)
+
+       @$(call install_lib, lldpd, 0, 0, 0644, liblldpctl)
+
+ifdef PTXCONF_INITMETHOD_BBINIT
+ifdef PTXCONF_LLDPD_STARTSCRIPT
+       @$(call install_alternative, lldpd, 0, 0, 0755, /etc/init.d/lldpd)
+       @$(call install_replace, lldpd, /etc/init.d/lldpd, \
+               @DAEMON_ARGS@, $(PTXCONF_LLDPD_DAEMON_ARGS))
+       @$(call install_replace, lldpd, /etc/init.d/lldpd, \
+               @PRIVSEP_CHROOT@, $(PTXCONF_LLDPD_PRIVSEP_CHROOT))
+
+ifneq ($(call remove_quotes,$(PTXCONF_LLDPD_BBINIT_LINK)),)
+       @$(call install_link, lldpd, ../init.d/lldpd, \
+               /etc/rc.d/$(PTXCONF_LLDPD_BBINIT_LINK))
+endif
+endif
+endif
+
+       @$(call install_finish, lldpd)
+
+       @$(call touch)
+
+# vim: ft=make noet
-- 
1.7.10.4


-- 
ptxdist mailing list
ptxdist@pengutronix.de

Reply via email to