Comply with guidelines for systemd services

This commit is contained in:
Jiri Popelka 2011-04-29 12:13:36 +02:00
parent cc2eb946a1
commit 6817180bd0

View File

@ -16,7 +16,7 @@
Summary: Dynamic host configuration protocol software Summary: Dynamic host configuration protocol software
Name: dhcp Name: dhcp
Version: 4.2.1 Version: 4.2.1
Release: 6.%{patchver}%{?dist} Release: 7.%{patchver}%{?dist}
# NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to # NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to
# dcantrell maintaining the package) made incorrect use of the epoch and # dcantrell maintaining the package) made incorrect use of the epoch and
# that's why it is at 12 now. It should have never been used, but it was. # that's why it is at 12 now. It should have never been used, but it was.
@ -82,6 +82,8 @@ Requires: %{name}-common = %{epoch}:%{version}-%{release}
Requires(post): chkconfig Requires(post): chkconfig
Requires(post): coreutils Requires(post): coreutils
Requires(post): systemd-units Requires(post): systemd-units
# This is actually needed for the %%triggerun script but Requires(triggerun) is not valid.
Requires(post): systemd-sysv
Requires(preun): chkconfig Requires(preun): chkconfig
Requires(preun): initscripts Requires(preun): initscripts
Requires(preun): systemd-units Requires(preun): systemd-units
@ -170,6 +172,14 @@ Requires: %{name}-libs = %{epoch}:%{version}-%{release}
Header files and API documentation for using the ISC DHCP libraries. The Header files and API documentation for using the ISC DHCP libraries. The
libdhcpctl and libomapi static libraries are also included in this package. libdhcpctl and libomapi static libraries are also included in this package.
%package sysvinit
Summary: Legacy SysV initscripts for DHCP server and relay agent
Group: System Environment/Base
%description sysvinit
Legacy SysV initscripts for init mechanisms such as upstart
which do not support the systemd unit file format.
%prep %prep
%setup -q -n dhcp-%{VERSION} %setup -q -n dhcp-%{VERSION}
@ -498,12 +508,10 @@ if [ ! -z "${prevconf}" ]; then
fi fi
fi fi
/sbin/chkconfig --add dhcpd # Initial installation
/sbin/chkconfig --add dhcpd6 if [ $1 -eq 1 ] ; then
/sbin/chkconfig --add dhcrelay || :
# systemd
/bin/systemctl daemon-reload >/dev/null 2>&1 || : /bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
%post -n dhclient %post -n dhclient
@ -525,30 +533,20 @@ fi || :
%preun %preun
# Package removal, not upgrade # Package removal, not upgrade
if [ $1 = 0 ]; then if [ $1 -eq 0 ] ; then
/sbin/service dhcpd stop >/dev/null 2>&1 /bin/systemctl --no-reload disable dhcpd.service > /dev/null 2>&1 || :
/sbin/service dhcpd6 stop >/dev/null 2>&1 /bin/systemctl --no-reload disable dhcpd6.service > /dev/null 2>&1 || :
/sbin/service dhcrelay stop >/dev/null 2>&1 /bin/systemctl --no-reload disable dhcrelay.service > /dev/null 2>&1 || :
/sbin/chkconfig --del dhcpd
/sbin/chkconfig --del dhcpd6
/sbin/chkconfig --del dhcrelay || :
/bin/systemctl stop dhcpd.service > /dev/null 2>&1 || : /bin/systemctl stop dhcpd.service > /dev/null 2>&1 || :
/bin/systemctl stop dhcpd6.service > /dev/null 2>&1 || : /bin/systemctl stop dhcpd6.service > /dev/null 2>&1 || :
/bin/systemctl stop dhcrelay.service > /dev/null 2>&1 || : /bin/systemctl stop dhcrelay.service > /dev/null 2>&1 || :
/bin/systemctl disable dhcpd.service > /dev/null 2>&1 || :
/bin/systemctl disable dhcpd6.service > /dev/null 2>&1 || :
/bin/systemctl disable dhcrelay.service > /dev/null 2>&1 || :
fi fi
%postun %postun
/bin/systemctl daemon-reload >/dev/null 2>&1 || : /bin/systemctl daemon-reload >/dev/null 2>&1 || :
# Package upgrade, not uninstall # Package upgrade, not uninstall
if [ $1 -ge 1 ]; then if [ $1 -ge 1 ]; then
/sbin/service dhcpd condrestart >/dev/null 2>&1
/sbin/service dhcpd6 condrestart >/dev/null 2>&1
/sbin/service dhcrelay condrestart >/dev/null 2>&1 || :
/bin/systemctl try-restart dhcpd.service >/dev/null 2>&1 || : /bin/systemctl try-restart dhcpd.service >/dev/null 2>&1 || :
/bin/systemctl try-restart dhcpd6.service >/dev/null 2>&1 || : /bin/systemctl try-restart dhcpd6.service >/dev/null 2>&1 || :
/bin/systemctl try-restart dhcrelay.service >/dev/null 2>&1 || : /bin/systemctl try-restart dhcrelay.service >/dev/null 2>&1 || :
@ -559,8 +557,25 @@ fi
%postun libs -p /sbin/ldconfig %postun libs -p /sbin/ldconfig
#https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd
%triggerun -- dhcp < 12:4.2.0-21.P1
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply httpd
# to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save dhpd
/usr/bin/systemd-sysv-convert --save dhpd6
/usr/bin/systemd-sysv-convert --save dhcrelay
# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del dhcpd >/dev/null 2>&1 || :
/sbin/chkconfig --del dhcpd6 >/dev/null 2>&1 || :
/sbin/chkconfig --del dhcrelay >/dev/null 2>&1 || :
/bin/systemctl try-restart dhcpd.service >/dev/null 2>&1 || :
/bin/systemctl try-restart dhcpd6.service >/dev/null 2>&1 || :
/bin/systemctl try-restart dhcrelay.service >/dev/null 2>&1 || :
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
%files %files
%defattr(-,root,root,-)
%doc dhcpd.conf.sample dhcpd6.conf.sample %doc dhcpd.conf.sample dhcpd6.conf.sample
%doc contrib/* %doc contrib/*
%dir %{_localstatedir}/lib/dhcpd %dir %{_localstatedir}/lib/dhcpd
@ -576,12 +591,9 @@ fi
%dir %{_sysconfdir}/NetworkManager %dir %{_sysconfdir}/NetworkManager
%dir %{_sysconfdir}/NetworkManager/dispatcher.d %dir %{_sysconfdir}/NetworkManager/dispatcher.d
%{_sysconfdir}/NetworkManager/dispatcher.d/12-dhcpd %{_sysconfdir}/NetworkManager/dispatcher.d/12-dhcpd
%{_initddir}/dhcpd %attr(0644,root,root) %{_unitdir}/dhcpd.service
%{_initddir}/dhcpd6 %attr(0644,root,root) %{_unitdir}/dhcpd6.service
%{_initddir}/dhcrelay %attr(0644,root,root) %{_unitdir}/dhcrelay.service
%attr(0644,root,root) /lib/systemd/system/dhcpd.service
%attr(0644,root,root) /lib/systemd/system/dhcpd6.service
%attr(0644,root,root) /lib/systemd/system/dhcrelay.service
%{_sbindir}/dhcpd %{_sbindir}/dhcpd
%{_sbindir}/dhcrelay %{_sbindir}/dhcrelay
%attr(0644,root,root) %{_mandir}/man5/dhcpd.conf.5.gz %attr(0644,root,root) %{_mandir}/man5/dhcpd.conf.5.gz
@ -590,7 +602,6 @@ fi
%attr(0644,root,root) %{_mandir}/man8/dhcrelay.8.gz %attr(0644,root,root) %{_mandir}/man8/dhcrelay.8.gz
%files -n dhclient %files -n dhclient
%defattr(-,root,root,-)
%doc dhclient.conf.sample dhclient6.conf.sample README.dhclient.d %doc dhclient.conf.sample dhclient6.conf.sample README.dhclient.d
%attr(0750,root,root) %dir %{dhcpconfdir} %attr(0750,root,root) %dir %{dhcpconfdir}
%config(noreplace) %{dhcpconfdir}/dhclient.conf %config(noreplace) %{dhcpconfdir}/dhclient.conf
@ -608,7 +619,6 @@ fi
%attr(0644,root,root) %{_mandir}/man8/dhclient-script.8.gz %attr(0644,root,root) %{_mandir}/man8/dhclient-script.8.gz
%files common %files common
%defattr(-,root,root,-)
%doc LICENSE README RELNOTES doc/References.txt %doc LICENSE README RELNOTES doc/References.txt
%{_bindir}/omshell %{_bindir}/omshell
%attr(0644,root,root) %{_mandir}/man1/omshell.1.gz %attr(0644,root,root) %{_mandir}/man1/omshell.1.gz
@ -616,13 +626,11 @@ fi
%attr(0644,root,root) %{_mandir}/man5/dhcp-eval.5.gz %attr(0644,root,root) %{_mandir}/man5/dhcp-eval.5.gz
%files libs %files libs
%defattr(-,root,root,-)
%{_libdir}/libdhcpctl.so.* %{_libdir}/libdhcpctl.so.*
%{_libdir}/libomapi.so.* %{_libdir}/libomapi.so.*
%{_libdir}/libdst.so.* %{_libdir}/libdst.so.*
%files devel %files devel
%defattr(-,root,root,-)
%doc doc/IANA-arp-parameters doc/api+protocol %doc doc/IANA-arp-parameters doc/api+protocol
%{_includedir}/dhcpctl %{_includedir}/dhcpctl
%{_includedir}/isc-dhcp %{_includedir}/isc-dhcp
@ -633,7 +641,15 @@ fi
%attr(0644,root,root) %{_mandir}/man3/dhcpctl.3.gz %attr(0644,root,root) %{_mandir}/man3/dhcpctl.3.gz
%attr(0644,root,root) %{_mandir}/man3/omapi.3.gz %attr(0644,root,root) %{_mandir}/man3/omapi.3.gz
%files sysvinit
%{_initddir}/dhcpd
%{_initddir}/dhcpd6
%{_initddir}/dhcrelay
%changelog %changelog
* Fri Apr 29 2011 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.1-7.P1
- Comply with guidelines for systemd services
* Wed Apr 27 2011 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.1-6.P1 * Wed Apr 27 2011 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.1-6.P1
- Fix NetworkManager dispatcher script for dhcpd to support arbitrary interface names - Fix NetworkManager dispatcher script for dhcpd to support arbitrary interface names