diff --git a/radvd.service b/radvd.service new file mode 100644 index 0000000..18d0c98 --- /dev/null +++ b/radvd.service @@ -0,0 +1,14 @@ +[Unit] +Description=router advertisement daemon for IPv6 +Requires=network.target +After=network.target + +[Service] +EnvironmentFile=/etc/sysconfig/radvd +ExecStart=/usr/sbin/radvd $OPTIONS +StandardOutput=syslog +Type=forking +PIDFile=/var/run/radvd/radvd.pid + +[Install] +WantedBy=multi-user.target diff --git a/radvd.spec b/radvd.spec index 54b2a04..4ad5077 100644 --- a/radvd.spec +++ b/radvd.spec @@ -1,11 +1,10 @@ %define initdir %{_sysconfdir}/rc.d/init.d -#%(if test -d %{_sysconfdir}/init.d/. ; then echo %{_sysconfdir}/init.d ; else echo %{_sysconfdir}/rc.d/init.d ; fi) %define RADVD_UID 75 Summary: A Router Advertisement daemon Name: radvd Version: 1.7 -Release: 1%{?dist} +Release: 2%{?dist} # The code includes the advertising clause, so it's GPL-incompatible License: BSD with advertising Group: System Environment/Daemons @@ -13,6 +12,7 @@ URL: http://www.litech.org/radvd/ Source: http://www.litech.org/radvd/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 @@ -52,29 +52,40 @@ 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 install -m 644 redhat/radvd.conf.empty $RPM_BUILD_ROOT%{_sysconfdir}/radvd.conf install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{initdir}/radvd install -m 644 redhat/radvd.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/radvd install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d -install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/radvd.conf +install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/radvd.conf +install -m 644 %{SOURCE3} ${RPM_BUILD_ROOT}/lib/systemd/system %clean [ $RPM_BUILD_ROOT != "/" ] && rm -rf $RPM_BUILD_ROOT %postun +/bin/systemctl daemon-reload >/dev/null 2>&1 || : + 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 + /bin/systemctl daemon-reload >/dev/null 2>&1 || : +fi %preun if [ $1 = 0 ]; then /sbin/service radvd stop >/dev/null 2>&1 /sbin/chkconfig --del radvd + + /bin/systemctl disable radvd.service > /dev/null 2>&1 || : + /bin/systemctl stop radvd.service > /dev/null 2>&1 || : fi %pre @@ -86,6 +97,7 @@ exit 0 %files %defattr(-,root,root,-) %doc COPYRIGHT README CHANGES INTRO.html TODO +/lib/systemd/system/radvd.service %config(noreplace) %{_sysconfdir}/radvd.conf %config(noreplace) %{_sysconfdir}/sysconfig/radvd %config(noreplace) %{_sysconfdir}/tmpfiles.d/radvd.conf @@ -97,6 +109,9 @@ exit 0 %{_sbindir}/radvdump %changelog +* Wed Feb 09 2011 Jiri Skala - 1.7-2 +- fixes #679821 - provides native systemd service file + * Wed Feb 09 2011 Jiri Skala - 1.7-1 - update to latest upstream version 1.7