From 739201d710eb3819361c87b53f9a4bf82d618310564082c783acb4ef2170b798 Mon Sep 17 00:00:00 2001 From: OBS User mrdocs Date: Mon, 28 Jul 2014 03:30:41 +0000 Subject: [PATCH] Accepting request 242642 from home:elvigia:branches:network:utilities - Do not apply previous patch to distros without systemd. - Limit init script usage only to legacy products. - openslp.sd_notify.diff make slpd systemd service of type notify instead of simple, to avoid startup races. OBS-URL: https://build.opensuse.org/request/show/242642 OBS-URL: https://build.opensuse.org/package/show/network:utilities/openslp?expand=0&rev=34 --- openslp.changes | 12 ++++++++++++ openslp.sd_notify.diff | 41 +++++++++++++++++++++++++++++++++++++++++ openslp.spec | 31 ++++++++++++++++++++++--------- slpd.service | 1 + 4 files changed, 76 insertions(+), 9 deletions(-) create mode 100644 openslp.sd_notify.diff diff --git a/openslp.changes b/openslp.changes index 90cc472..d2094d1 100644 --- a/openslp.changes +++ b/openslp.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Mon Jul 28 02:36:48 UTC 2014 - crrodriguez@opensuse.org + +- Do not apply previous patch to distros without systemd. +- Limit init script usage only to legacy products. + +------------------------------------------------------------------- +Sun Jul 27 21:18:25 UTC 2014 - crrodriguez@opensuse.org + +- openslp.sd_notify.diff make slpd systemd service of type + notify instead of simple, to avoid startup races. + ------------------------------------------------------------------- Thu Apr 10 16:56:24 CEST 2014 - mls@suse.de diff --git a/openslp.sd_notify.diff b/openslp.sd_notify.diff new file mode 100644 index 0000000..bd1a6e2 --- /dev/null +++ b/openslp.sd_notify.diff @@ -0,0 +1,41 @@ +--- slpd/slpd_main.c.orig ++++ slpd/slpd_main.c +@@ -59,6 +59,8 @@ + #include "slp_net.h" + #include "slp_network.h" + ++#include ++ + int G_SIGALRM; + int G_SIGTERM; + int G_SIGHUP; +@@ -748,6 +750,7 @@ int main(int argc, char * argv[]) + alarm(2); + + /* Main loop */ ++ sd_notify(0, "READY=1"); + SLPDLog("Startup complete entering main run loop ...\n\n"); + G_SIGALRM = 0; + G_SIGTERM = 0; +--- configure.ac.orig ++++ configure.ac +@@ -35,6 +35,10 @@ AC_CHECK_LIB([nsl], [gethostbyname]) + AC_CHECK_LIB([m], [log10]) + AC_CHECK_LIB([pthread], [pthread_create]) + ++PKG_PROG_PKG_CONFIG ++ ++PKG_CHECK_MODULES([SYSTEMD], [libsystemd-daemon]) ++ + # + # Checks for header files + # +--- slpd/Makefile.am.orig ++++ slpd/Makefile.am +@@ -95,5 +95,5 @@ noinst_HEADERS = \ + slpd_initda.h + + #if you're building on Irix, replace .la with .a below +-slpd_LDADD = ../common/libcommonslpd.la ../libslpattr/libslpattr.la ++slpd_LDADD = $(SYSTEMD_LIBS) ../common/libcommonslpd.la ../libslpattr/libslpattr.la + diff --git a/openslp.spec b/openslp.spec index 07b015d..e0879e2 100644 --- a/openslp.spec +++ b/openslp.spec @@ -21,7 +21,9 @@ BuildRequires: bison BuildRequires: flex BuildRequires: libtool BuildRequires: openssl-devel +BuildRequires: pkgconfig %if 0%{?suse_version} > 1140 +BuildRequires: pkgconfig(libsystemd-daemon) BuildRequires: pkgconfig(systemd) %define has_systemd 1 %endif @@ -58,7 +60,9 @@ Patch8: openslp.cloexec.diff Patch9: openslp.hardmtu.diff Patch10: openslp.tcplocal.diff Patch11: openslp.localtime.diff - +%if 0%{?has_systemd} +Patch12: openslp.sd_notify.diff +%endif %description Service Location Protocol is an IETF standards track protocol that provides a framework that allows networking applications to discover @@ -122,7 +126,9 @@ such applications. %patch9 %patch10 %patch11 - +%if 0%{?has_systemd} +%patch12 +%endif %build autoreconf -fiv %configure --disable-static --with-pic --enable-slpv1 \ @@ -148,10 +154,15 @@ mkdir -p ${RPM_BUILD_ROOT}%_defaultdocdir/%name find . -name CVS -o -name .cvsignore -o -name .xvpics | xargs rm -rf cp -a AUTHORS COPYING README FAQ doc/doc/rfc doc/doc/html %SOURCE2 \ ${RPM_BUILD_ROOT}%_defaultdocdir/%name +%if ! 0%{?has_systemd} mkdir -p ${RPM_BUILD_ROOT}/etc/init.d/ install -m 755 %{SOURCE1} ${RPM_BUILD_ROOT}/etc/init.d/slpd ln -sf ../../etc/init.d/slpd ${RPM_BUILD_ROOT}/usr/sbin/rcslpd ln -sf ../../etc/init.d/slpd ${RPM_BUILD_ROOT}/usr/sbin/rcopenslp +%else +ln -s %{_sbindir}/service ${RPM_BUILD_ROOT}/usr/sbin/rcslpd +ln -s %{_sbindir}/service ${RPM_BUILD_ROOT}/usr/sbin/rcopenslp +%endif install -D -m 0644 %{SOURCE5} ${RPM_BUILD_ROOT}/etc/logrotate.d/openslp-server # install susehelp file mkdir -p $RPM_BUILD_ROOT/usr/share/susehelp/meta/Administration/ @@ -192,13 +203,10 @@ install -D -m 644 %{S:9} %{buildroot}%{_unitdir}/slpd.service %endif %post server -%if 0%{?sles_version} == 9 || 0%{?sles_version} == 10 -%{fillup_and_insserv -y slpd} -%else -%{fillup_and_insserv slpd} -%endif %if 0%{?has_systemd} %service_add_post slpd.service +%else +%{fillup_and_insserv slpd} %endif %postun server @@ -206,12 +214,16 @@ install -D -m 644 %{S:9} %{buildroot}%{_unitdir}/slpd.service %insserv_cleanup %if 0%{?has_systemd} %service_del_postun slpd.service +%else +%restart_on_update slpd +%insserv_cleanup %endif %preun server -%stop_on_removal slpd %if 0%{?has_systemd} %service_del_preun slpd.service +%else +%stop_on_removal slpd %endif %files @@ -243,7 +255,6 @@ install -D -m 644 %{S:9} %{buildroot}%{_unitdir}/slpd.service /usr/sbin/rcopenslp /usr/sbin/rcslpd /usr/sbin/slpd -%config /etc/init.d/slpd %config(noreplace) /etc/slp.reg %config(noreplace) /etc/logrotate.d/openslp-server /usr/share/omc/svcinfo.d/slpd.xml @@ -252,6 +263,8 @@ install -D -m 644 %{S:9} %{buildroot}%{_unitdir}/slpd.service %endif %if 0%{?has_systemd} %{_unitdir}/slpd.service +%else +%config /etc/init.d/slpd %endif %files devel diff --git a/slpd.service b/slpd.service index 03a29ea..85800a8 100644 --- a/slpd.service +++ b/slpd.service @@ -3,6 +3,7 @@ Description=OpenSLP daemon for the Service Location Protocol After=network.target nss-lookup.target [Service] +Type=notify ExecStart=/usr/sbin/slpd -d ExecReload=/bin/kill -HUP $MAINPID [Install]