diff --git a/openslp.changes b/openslp.changes index 5b4ade0..c193c7e 100644 --- a/openslp.changes +++ b/openslp.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Dec 22 23:42:12 UTC 2011 - crrodriguez@opensuse.org + +- Add native systemd unit + ------------------------------------------------------------------- Wed Nov 16 08:19:02 UTC 2011 - coolo@suse.com diff --git a/openslp.spec b/openslp.spec index 408ba4b..d45a630 100644 --- a/openslp.spec +++ b/openslp.spec @@ -19,6 +19,11 @@ Name: openslp BuildRequires: bison flex libtool openssl-devel +%if 0%{?suse_version} > 1140 +BuildRequires: systemd +%{?systemd_requires} +%define has_systemd 1 +%endif Summary: An OpenSLP Implementation of Service Location Protocol V2 Version: 1.2.0 Release: 186 @@ -40,6 +45,7 @@ Source5: openslp.logrotate Source6: slpd.xml Source7: openslp.SuSEfirewall2 Source8: baselibs.conf +Source9: slpd.service Patch1: openslp.diff Patch2: openslp.audit.diff Patch3: extensions.diff @@ -225,7 +231,9 @@ install -m 0644 %SOURCE6 $RPM_BUILD_ROOT/usr/share/omc/svcinfo.d install -D -m 644 %{S:7} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/openslp %endif -nm -C -D %{buildroot}%_libdir/libslp.so +%if 0%{?has_systemd} +install -D -m 644 %{S:9} %{buildroot}%{_unitdir}/slpd.service +%endif %post -p /sbin/ldconfig @@ -233,6 +241,9 @@ nm -C -D %{buildroot}%_libdir/libslp.so %pre server /usr/sbin/useradd -r -g daemon -d /var/lib/empty -s /sbin/nologin -c "openslp daemon" openslp 2>/dev/null || : +%if 0%{?has_systemd} +%service_add_pre slpd.service +%endif %post server %if 0%{?sles_version} == 9 || 0%{?sles_version} == 10 @@ -240,13 +251,22 @@ nm -C -D %{buildroot}%_libdir/libslp.so %else %{fillup_and_insserv slpd} %endif +%if 0%{?has_systemd} +%service_add_post slpd.service +%endif %postun server %restart_on_update slpd %insserv_cleanup +%if 0%{?has_systemd} +%service_del_postun slpd.service +%endif %preun server %stop_on_removal slpd +%if 0%{?has_systemd} +%service_del_preun slpd.service +%endif %clean rm -rf $RPM_BUILD_ROOT @@ -287,6 +307,9 @@ rm -rf $RPM_BUILD_ROOT %if 0%{?suse_version} > 0 %config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/openslp %endif +%if 0%{?has_systemd} +%{_unitdir}/slpd.service +%endif %files devel %defattr(-,root,root) diff --git a/slpd.service b/slpd.service new file mode 100644 index 0000000..03a29ea --- /dev/null +++ b/slpd.service @@ -0,0 +1,9 @@ +[Unit] +Description=OpenSLP daemon for the Service Location Protocol +After=network.target nss-lookup.target + +[Service] +ExecStart=/usr/sbin/slpd -d +ExecReload=/bin/kill -HUP $MAINPID +[Install] +WantedBy=multi-user.target \ No newline at end of file