Introduce systemd support
This commit is contained in:
parent
2f8ffeb7f2
commit
af3a878ec4
@ -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
|
|
12
lldpad-0.9.42-clean-exit.patch
Normal file
12
lldpad-0.9.42-clean-exit.patch
Normal file
@ -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);
|
||||||
|
}
|
10
lldpad.service
Normal file
10
lldpad.service
Normal file
@ -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
|
48
lldpad.spec
48
lldpad.spec
@ -1,23 +1,25 @@
|
|||||||
Name: lldpad
|
Name: lldpad
|
||||||
Version: 0.9.42
|
Version: 0.9.42
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: Intel LLDP Agent
|
Summary: Intel LLDP Agent
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
URL: http://open-lldp.org/
|
URL: http://open-lldp.org/
|
||||||
Source0: %{name}-%{version}.tar.gz
|
Source0: %{name}-%{version}.tar.gz
|
||||||
Patch0: lldpad-0.9.41-init.patch
|
Source1: %{name}.service
|
||||||
Patch1: lldpad-0.9.41-make.patch
|
Patch0: lldpad-0.9.41-make.patch
|
||||||
Patch2: lldpad-0.9.41-lldptool-invalid-pointer.patch
|
Patch1: lldpad-0.9.41-lldptool-invalid-pointer.patch
|
||||||
|
Patch2: lldpad-0.9.42-clean-exit.patch
|
||||||
|
|
||||||
Requires: kernel >= 2.6.32
|
Requires: kernel >= 2.6.32
|
||||||
|
BuildRequires: systemd-units
|
||||||
BuildRequires: libconfig-devel >= 1.3.2 kernel-headers >= 2.6.32
|
BuildRequires: libconfig-devel >= 1.3.2 kernel-headers >= 2.6.32
|
||||||
BuildRequires: flex >= 2.5.33
|
BuildRequires: flex >= 2.5.33
|
||||||
BuildRequires: automake autoconf libtool
|
BuildRequires: automake autoconf libtool
|
||||||
BuildRequires: libnl-devel libnl
|
BuildRequires: libnl-devel libnl
|
||||||
Requires(post): chkconfig
|
Requires(post): systemd-units
|
||||||
Requires(preun): chkconfig initscripts
|
Requires(preun): systemd-units
|
||||||
Requires(postun): initscripts
|
Requires(postun): systemd-units
|
||||||
Provides: dcbd = %{version}-%{release}
|
Provides: dcbd = %{version}-%{release}
|
||||||
Obsoletes: dcbd < 0.9.26
|
Obsoletes: dcbd < 0.9.26
|
||||||
|
|
||||||
@ -39,8 +41,8 @@ that use %{name}.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q -n open-lldp
|
%setup -q -n open-lldp
|
||||||
%patch0 -p1 -b .make
|
%patch0 -p1 -b .make
|
||||||
%patch1 -p1 -b .init
|
%patch1 -p1 -b .invalid-pointer
|
||||||
%patch2 -p1 -b .invalid-pointer
|
%patch2 -p1 -b .clean-exit
|
||||||
|
|
||||||
%build
|
%build
|
||||||
./bootstrap.sh
|
./bootstrap.sh
|
||||||
@ -49,23 +51,25 @@ make %{?_smp_mflags}
|
|||||||
|
|
||||||
%install
|
%install
|
||||||
make install DESTDIR=%{buildroot}
|
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
|
rm -f %{buildroot}%{_mandir}/man8/dcbd.8
|
||||||
|
mkdir -p %{buildroot}%{_unitdir}
|
||||||
|
install -m644 %{SOURCE1} %{buildroot}%{_unitdir}
|
||||||
|
rm -rf %{buildroot}/etc/init.d
|
||||||
|
|
||||||
%post
|
%post
|
||||||
/sbin/chkconfig --add %{name}
|
if [ $1 -eq 1 ]; then
|
||||||
|
systemctl enable %{name}.service
|
||||||
|
fi
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
if [ $1 = 0 ]; then
|
if [ $1 -eq 0 ]; then
|
||||||
/sbin/service %{name} stop > /dev/null 2>&1
|
systemctl stop %{name}.service
|
||||||
/sbin/chkconfig --del %{name}
|
systemctl disable %{name}.service
|
||||||
fi
|
fi
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
if [ "$1" -ge "1" ]; then
|
if [ $1 -eq 1 ]; then
|
||||||
/sbin/service %{name} condrestart > /dev/null 2>&1 || :
|
systemctl try-restart %{name}.service
|
||||||
fi
|
fi
|
||||||
|
|
||||||
%post devel
|
%post devel
|
||||||
@ -89,7 +93,7 @@ fi
|
|||||||
%doc COPYING README ChangeLog
|
%doc COPYING README ChangeLog
|
||||||
%{_sbindir}/*
|
%{_sbindir}/*
|
||||||
%dir %{_sharedstatedir}/%{name}
|
%dir %{_sharedstatedir}/%{name}
|
||||||
%{_initddir}/%{name}
|
%{_unitdir}/%{name}.service
|
||||||
%{_mandir}/man8/*
|
%{_mandir}/man8/*
|
||||||
|
|
||||||
%files devel
|
%files devel
|
||||||
@ -97,6 +101,12 @@ fi
|
|||||||
%{_libdir}/pkgconfig/*.pc
|
%{_libdir}/pkgconfig/*.pc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jun 21 2011 Petr Sabata <contyk@redhat.com> - 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 <contyk@redhat.com> - 0.9.42-1
|
* Mon Jun 13 2011 Petr Sabata <contyk@redhat.com> - 0.9.42-1
|
||||||
- 0.9.42 bump (massive patches cleanup)
|
- 0.9.42 bump (massive patches cleanup)
|
||||||
- Remove obsolete defattr
|
- Remove obsolete defattr
|
||||||
|
Loading…
Reference in New Issue
Block a user