diff --git a/lldpad-0.9.41-init.patch b/lldpad-0.9.41-init.patch deleted file mode 100644 index 79643d7..0000000 --- a/lldpad-0.9.41-init.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- lldpad-0.9.41/lldpad.init 2011-01-11 03:35:01.000000000 +0100 -+++ lldpad-0.9.41/lldpad.init.new 2011-02-04 10:05:37.414483161 +0100 -@@ -33,14 +33,14 @@ - # lldpad This shell script takes care of starting and stopping - # lldpad (including DCB capabilities exchange protocol) - # --# chkconfig: - 20 80 -+# chkconfig: 2345 20 80 - # description: Link Layer Discovery Protocol Agent Daemon - # - ### BEGIN INIT INFO - # Provides: lldpad - # Required-Start: network - # Required-Stop: --# Default-Start: -+# Default-Start: 3 5 - # Default-Stop: - # Short Description: Link Layer Discovery Protocol Agent Daemon - # Description: Link Layer Discovery Protocol Agent Daemon diff --git a/lldpad-0.9.42-clean-exit.patch b/lldpad-0.9.42-clean-exit.patch new file mode 100644 index 0000000..574335c --- /dev/null +++ b/lldpad-0.9.42-clean-exit.patch @@ -0,0 +1,12 @@ +diff --git a/lldpad.c b/lldpad.c +index 3a4a721..2f8bc23 100644 +--- a/lldpad.c ++++ b/lldpad.c +@@ -424,5 +424,7 @@ int main(int argc, char *argv[]) + closelog(); + unlink(PID_FILE); + eloop_destroy(); ++ if (eloop_terminated()) ++ exit(0); + exit(1); + } diff --git a/lldpad.service b/lldpad.service new file mode 100644 index 0000000..8cc4aed --- /dev/null +++ b/lldpad.service @@ -0,0 +1,10 @@ +[Unit] +Description=Link Layer Discovery Protocol Agent Daemon. +After=syslog.target network.target + +[Service] +Type=simple +ExecStart=/usr/sbin/lldpad + +[Install] +WantedBy=multi-user.target diff --git a/lldpad.spec b/lldpad.spec index ac4a3ab..9bc46d0 100644 --- a/lldpad.spec +++ b/lldpad.spec @@ -1,23 +1,25 @@ Name: lldpad Version: 0.9.42 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Intel LLDP Agent Group: System Environment/Daemons License: GPLv2 URL: http://open-lldp.org/ Source0: %{name}-%{version}.tar.gz -Patch0: lldpad-0.9.41-init.patch -Patch1: lldpad-0.9.41-make.patch -Patch2: lldpad-0.9.41-lldptool-invalid-pointer.patch +Source1: %{name}.service +Patch0: lldpad-0.9.41-make.patch +Patch1: lldpad-0.9.41-lldptool-invalid-pointer.patch +Patch2: lldpad-0.9.42-clean-exit.patch Requires: kernel >= 2.6.32 +BuildRequires: systemd-units BuildRequires: libconfig-devel >= 1.3.2 kernel-headers >= 2.6.32 BuildRequires: flex >= 2.5.33 BuildRequires: automake autoconf libtool BuildRequires: libnl-devel libnl -Requires(post): chkconfig -Requires(preun): chkconfig initscripts -Requires(postun): initscripts +Requires(post): systemd-units +Requires(preun): systemd-units +Requires(postun): systemd-units Provides: dcbd = %{version}-%{release} Obsoletes: dcbd < 0.9.26 @@ -39,8 +41,8 @@ that use %{name}. %prep %setup -q -n open-lldp %patch0 -p1 -b .make -%patch1 -p1 -b .init -%patch2 -p1 -b .invalid-pointer +%patch1 -p1 -b .invalid-pointer +%patch2 -p1 -b .clean-exit %build ./bootstrap.sh @@ -49,23 +51,25 @@ make %{?_smp_mflags} %install make install DESTDIR=%{buildroot} -mkdir -p %{buildroot}%{_initddir} -mv %{buildroot}/etc/init.d/%{name} %{buildroot}%{_initddir} -rm -rf %{buildroot}/etc/init.d rm -f %{buildroot}%{_mandir}/man8/dcbd.8 +mkdir -p %{buildroot}%{_unitdir} +install -m644 %{SOURCE1} %{buildroot}%{_unitdir} +rm -rf %{buildroot}/etc/init.d %post -/sbin/chkconfig --add %{name} +if [ $1 -eq 1 ]; then + systemctl enable %{name}.service +fi %preun -if [ $1 = 0 ]; then - /sbin/service %{name} stop > /dev/null 2>&1 - /sbin/chkconfig --del %{name} +if [ $1 -eq 0 ]; then + systemctl stop %{name}.service + systemctl disable %{name}.service fi %postun -if [ "$1" -ge "1" ]; then - /sbin/service %{name} condrestart > /dev/null 2>&1 || : +if [ $1 -eq 1 ]; then + systemctl try-restart %{name}.service fi %post devel @@ -89,7 +93,7 @@ fi %doc COPYING README ChangeLog %{_sbindir}/* %dir %{_sharedstatedir}/%{name} -%{_initddir}/%{name} +%{_unitdir}/%{name}.service %{_mandir}/man8/* %files devel @@ -97,6 +101,12 @@ fi %{_libdir}/pkgconfig/*.pc %changelog +* Tue Jun 21 2011 Petr Sabata - 0.9.42-2 +- Introduce systemd unit file, drop SysV support +- Call systemctl instead of service and chkconfig +- Enable the service only on new installation (%post) +- Clean exit patch + * Mon Jun 13 2011 Petr Sabata - 0.9.42-1 - 0.9.42 bump (massive patches cleanup) - Remove obsolete defattr