commit fe98ec8f5fa8ddba389419c89af5b035bfb327a8
Author: Paweł Gołaszewski <[email protected]>
Date:   Wed Nov 14 14:26:26 2012 +0100

    start scripts

 lldpd.init      | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 lldpd.spec      | 22 +++++++++----------
 lldpd.sysconfig |  3 +++
 3 files changed, 82 insertions(+), 11 deletions(-)
---
diff --git a/lldpd.spec b/lldpd.spec
index 4807b1f..271ad17 100644
--- a/lldpd.spec
+++ b/lldpd.spec
@@ -10,15 +10,15 @@ License:    MIT
 Group:         Networking
 Source0:       http://media.luffy.cx/files/lldpd/%{name}-%{version}.tar.gz
 # Source0-md5: 3db3a80fa6a384cd59e9d6a42ce7b630
-#Source2:      %{name}-lldpd.init
-#Source3:      %{name}-lldpd.sysconfig
-#Source4:      %{name}-lldpd.service
+Source1:       %{name}.init
+Source2:       %{name}.sysconfig
+#Source3:      %{name}-lldpd.service
 URL:           https://github.com/vincentbernat/lldpd/wiki
 BuildRequires: autoconf >= 1.5
 BuildRequires: automake
-BuildRequires: libconfuse-devel
 Requires(post,preun,postun):   systemd-units >= 38
 Requires:      systemd-units >= 38
+Conflicts:     openlldp
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -49,13 +49,13 @@ on bridges. More complex setups may give false results.
 
 %install
 rm -rf $RPM_BUILD_ROOT
-#install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{systemdunitdir}}
+install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{systemdunitdir}}
 
 %{__make} install \
        DESTDIR=$RPM_BUILD_ROOT
 
-#install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/lldpd
-#install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/lldpd
+install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/lldpd
+install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/lldpd
 #install %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/lldpd.service
 
 %clean
@@ -64,7 +64,7 @@ rm -rf $RPM_BUILD_ROOT
 %post
 /sbin/chkconfig --add lldpd
 %service lldpd restart "LLDP Daemon"
-%systemd_post lldpd.service
+#systemd_post lldpd.service
 
 %preun
 if [ "$1" = "0" ]; then
@@ -76,14 +76,14 @@ fi
 %postun
 %systemd_reload
 
-%triggerpostun -- openlldp < 0.4
+%triggerpostun -- lldpd < 0.4
 %systemd_trigger lldpd.service
 
 %files
 %defattr(644,root,root,755)
 %doc CHANGELOG README.md
-#%attr(754,root,root) /etc/rc.d/init.d/lldpd
-#%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/lldpd
+%attr(754,root,root) /etc/rc.d/init.d/lldpd
+%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/lldpd
 #%{systemdunitdir}/lldpd.service
 %attr(755,root,root) %{_sbindir}/lldpd
 %attr(755,root,root) %{_sbindir}/lldpctl
diff --git a/lldpd.init b/lldpd.init
new file mode 100644
index 0000000..2126dbf
--- /dev/null
+++ b/lldpd.init
@@ -0,0 +1,68 @@
+#!/bin/sh
+# openlldp     LLDPD - LLDP, CDP and EDP implimentation
+#
+# chkconfig:   345 55 55
+# description: The LLDPD project aims to provide a comprehensive 
implementation 
+#              of the IEEE standard 802.1AB Link Layer Discovery Protocol.
+# processname: lldpd
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Get service config
+[ -f /etc/sysconfig/lldpd ] && . /etc/sysconfig/lldpd
+
+start() {
+       # Check if the service is already running?
+       if [ ! -f /var/lock/subsys/lldpd ]; then
+               msg_starting "LLDP Daemon"
+               daemon /usr/sbin/lldpd $LLDP_OPT
+               RETVAL=$?
+               if [ $RETVAL -eq 0 ]; then
+                       touch /var/lock/subsys/lldpd
+                       ok
+               else
+                       fail
+               fi
+       else
+               msg_already_running "LLDP Daemon"
+       fi
+}
+
+stop() {
+       # Stop daemons.
+       if [ -f /var/lock/subsys/lldpd ]; then
+               killproc --pidfile /var/run/lldpd.pid lldpd
+               rm -f /var/lock/subsys/lldpd
+       else
+               msg_not_running "LLDP Daemon"
+       fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  status)
+       status lldpd
+       RETVAL=$?
+       ;;
+  *)
+       msg_usage "$0 {start|stop|restart|status}"
+       exit 3
+       ;;
+esac
+
+exit $RETVAL
diff --git a/lldpd.sysconfig b/lldpd.sysconfig
new file mode 100644
index 0000000..b0243ba
--- /dev/null
+++ b/lldpd.sysconfig
@@ -0,0 +1,3 @@
+# Customized settings for lldpd
+
+LLDP_OPT=""
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/lldpd.git/commitdiff/fe98ec8f5fa8ddba389419c89af5b035bfb327a8

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to