Migrate to systemd.

This commit is contained in:
Jon Ciesla 2012-04-19 13:47:08 -05:00
parent 3c9a495909
commit ea7131d149
2 changed files with 54 additions and 12 deletions

14
ipvsadm.service Normal file
View File

@ -0,0 +1,14 @@
[Unit]
Description=Initialise the Linux Virtual Server
After=syslog.target network.target
[Service]
Type=oneshot
ExecStart=/bin/bash -c "exec /sbin/ipvsadm-restore < /etc/sysconfig/ipvsadm"
ExecStop=/bin/bash -c "exec /sbin/ipvsadm-save -n > /etc/sysconfig/ipvsadm"
ExecStop=/sbin/ipvsadm -C
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@ -1,19 +1,22 @@
Summary: Utility to administer the Linux Virtual Server
Name: ipvsadm
Version: 1.26
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://www.linuxvirtualserver.org/software/ipvs.html
Source0: http://www.linuxvirtualserver.org/software/kernel-2.6/ipvsadm-%{version}.tar.gz
Source1: ipvsadm.init
Source1: ipvsadm.service
Source2: ipvsadm-config
Patch0: ipvsadm-1.26-popt.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
Buildrequires: libnl-devel
Buildrequires: popt-devel
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
# For triggerun
Requires(post): systemd-sysv
%description
ipvsadm is a utility to administer the IP Virtual Server services
@ -34,8 +37,9 @@ CFLAGS="%{optflags}" make
rm -rf %{buildroot}
mkdir -p %{buildroot}/etc/rc.d/init.d
make install BUILD_ROOT=%{buildroot} MANDIR=%{_mandir}
# Overwrite the provided init script with our flexible and LSB compliant one
install -p -m 0755 %{SOURCE1} %{buildroot}/etc/rc.d/init.d/ipvsadm
# Remove the provided init script
rm -f %{buildroot}/etc/rc.d/init.d/ipvsadm
install -D -p -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/ipvsadm.service
# Install config file which controls the service behavior
install -D -p -m 0600 %{SOURCE2} %{buildroot}/etc/sysconfig/ipvsadm-config
@ -45,18 +49,39 @@ rm -rf %{buildroot}
%post
/sbin/chkconfig --add ipvsadm
%preun
if [ $1 -eq 0 ]; then
/sbin/chkconfig --del ipvsadm
if [ $1 -eq 1 ] ; then
# Initial installation
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
%preun
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
/bin/systemctl --no-reload disable ipvsadm.service > /dev/null 2>&1 || :
/bin/systemctl stop ipvsadm.service > /dev/null 2>&1 || :
fi
%postun
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/bin/systemctl try-restart ipvsadm.service >/dev/null 2>&1 || :
fi
%triggerun -- ipvsadm < 1.26-4
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply ipvsadm
# to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save ipvsadm >/dev/null 2>&1 ||:
# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del ipvsadm >/dev/null 2>&1 || :
/bin/systemctl try-restart ipvsadm.service >/dev/null 2>&1 || :
%files
%defattr(-,root,root)
%doc README
/etc/rc.d/init.d/ipvsadm
%{_unitdir}/ipvsadm.service
%config(noreplace) /etc/sysconfig/ipvsadm-config
/sbin/ipvsadm
/sbin/ipvsadm-restore
@ -67,6 +92,9 @@ fi
%changelog
* Thu Apr 19 2012 Jon Ciesla <limburgher@gmail.com> - 1.26-4
- Migrate to systemd, BZ 720175.
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.26-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild