Fix systemd unit handling

This commit is contained in:
Petr Písař 2012-04-03 17:00:41 +02:00
parent 62c31789c1
commit 06e96528b6
2 changed files with 11 additions and 10 deletions

View File

@ -1,5 +1,5 @@
[Unit]
Description=router advertisement daemon for IPv6
Description=Router advertisement daemon for IPv6
Requires=network.target
After=network.target

View File

@ -13,10 +13,11 @@ Source: %{url}dist/%{name}-%{version}.tar.gz
Source1: radvd.init
Source2: radvd-tmpfs.conf
Source3: radvd.service
Requires(postun): chkconfig, /usr/sbin/userdel, initscripts
Requires(preun): chkconfig, initscripts
Requires(post): chkconfig
Requires(postun): chkconfig, /usr/sbin/userdel, initscripts, systemd-units
Requires(preun): chkconfig, initscripts, systemd-units
Requires(post): chkconfig, systemd-units
Requires(pre): /usr/sbin/useradd
BuildRequires: systemd-units
BuildRequires: flex, flex-static, byacc
%description
@ -54,7 +55,7 @@ make DESTDIR=$RPM_BUILD_ROOT install
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
mkdir -p $RPM_BUILD_ROOT%{initdir}
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/radvd
mkdir -p $RPM_BUILD_ROOT/lib/systemd/system
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
install -m 644 redhat/radvd.conf.empty $RPM_BUILD_ROOT%{_sysconfdir}/radvd.conf
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{initdir}/radvd
@ -62,24 +63,24 @@ install -m 644 redhat/radvd.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ra
install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d
install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/radvd.conf
install -m 644 %{SOURCE3} ${RPM_BUILD_ROOT}/lib/systemd/system
install -m 644 %{SOURCE3} ${RPM_BUILD_ROOT}%{_unitdir}
%postun
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ "$1" -ge "1" ]; then
if [ "$1" -ge 1 ]; then
/sbin/service radvd condrestart >/dev/null 2>&1
/bin/systemctl try-restart radvd.service >/dev/null 2>&1 || :
fi
%post
/sbin/chkconfig --add radvd
if [ $1 -eq 1 ]; then
if [ "$1" -eq 1 ]; then
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
%preun
if [ $1 = 0 ]; then
if [ "$1" -eq 0 ]; then
/sbin/service radvd stop >/dev/null 2>&1
/sbin/chkconfig --del radvd
@ -95,7 +96,7 @@ exit 0
%files
%doc COPYRIGHT README CHANGES INTRO.html TODO
/lib/systemd/system/radvd.service
%{_unitdir}/radvd.service
%config(noreplace) %{_sysconfdir}/radvd.conf
%config(noreplace) %{_sysconfdir}/sysconfig/radvd
%config(noreplace) %{_sysconfdir}/tmpfiles.d/radvd.conf