From c27658fca1eef90418db73deb13c8edb65edd4218c629a44e7337d761889d243 Mon Sep 17 00:00:00 2001 From: Navin Kukreja Date: Thu, 8 Feb 2018 13:15:18 +0000 Subject: [PATCH] Accepting request 574119 from home:nkukreja:branches:network - Implement systemd init scripts for bind and lwresd (fate#323155) OBS-URL: https://build.opensuse.org/request/show/574119 OBS-URL: https://build.opensuse.org/package/show/network/bind?expand=0&rev=230 --- bind.changes | 5 +++++ bind.spec | 42 +++++++++++++++++++++++++++++++++++------- vendor-files.tar.bz2 | 4 ++-- 3 files changed, 42 insertions(+), 9 deletions(-) diff --git a/bind.changes b/bind.changes index bc3aebf..c192bb1 100644 --- a/bind.changes +++ b/bind.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Feb 7 15:17:17 UTC 2018 - navin.kukreja@suse.com + +- Implement systemd init scripts for bind and lwresd (fate#323155) + ------------------------------------------------------------------- Tue Jan 23 21:59:24 UTC 2018 - navin.kukreja@suse.com diff --git a/bind.spec b/bind.spec index 415f06d..1aa574c 100644 --- a/bind.spec +++ b/bind.spec @@ -43,7 +43,12 @@ %define GROUPADD_NAMED getent group %{NAMED_GID_NAME} >/dev/null || %{_sbindir}/groupadd -g %{NAMED_GID} -o -r %{NAMED_GID_NAME} %define USERADD_NAMED getent passwd %{NAMED_UID_NAME} >/dev/null || %{_sbindir}/useradd -r -o -g %{NAMED_GID_NAME} -u %{NAMED_UID} -s %{NAMED_SHELL} -c "%{NAMED_COMMENT}" -d %{NAMED_HOMEDIR} %{NAMED_UID_NAME} %define USERMOD_NAMED getent passwd %{NAMED_UID_NAME} >/dev/null || %{_sbindir}/usermod -s %{NAMED_SHELL} -d %{NAMED_HOMEDIR} %{NAMED_UID_NAME} +%if 0%{?suse_version} >= 1500 +%define with_systemd 1 +%else %define with_systemd 0 +%endif + #Compat macro for new _fillupdir macro introduced in Nov 2017 %if ! %{defined _fillupdir} %define _fillupdir %{_localstatedir}/adm/fillup-templates @@ -99,9 +104,11 @@ Provides: bind9 Provides: dns_daemon Obsoletes: bind8 < %{version} Obsoletes: bind9 < %{version} -%{?systemd_requires} %if %{with_systemd} BuildRequires: systemd-rpm-macros +BuildRequires: pkgconfig(libsystemd) +BuildRequires: pkgconfig(systemd) +%{?systemd_requires} %else Requires(post): %insserv_prereq %endif @@ -313,12 +320,11 @@ function replaceStrings() sed -e "s@__NSD__@/lib@g" \ -e "s@__BIND_PACKAGE_NAME__@%{name}@g" \ -e "s@__VENDOR__@%{VENDOR}@g" \ - -e "s@___lib__@%{_lib}@g" \ -e "s@__openssl__@$(pkg-config --variable=enginesdir libcrypto)@g" \ -i "${file}" } pushd vendor-files -for file in docu/README tools/createNamedConfInclude config/{README,named.conf} init/{named,lwresd} sysconfig/{named-common,named-named,syslog-named}; do +for file in docu/README tools/createNamedConfInclude config/{README,named.conf} init/{named,lwresd} system/{named.init,lwresd.init} sysconfig/{named-common,named-named,syslog-named}; do replaceStrings ${file} done popd @@ -349,6 +355,9 @@ export CFLAGS="%{optflags}" --with-gssapi=yes \ --disable-isc-spnego \ --enable-fixed-rrset \ +%if %{with_systemd} + --with-systemd \ +%endif --enable-full-report # disable rpath sed -i ' @@ -387,10 +396,19 @@ mv vendor-files/config/rndc-access.conf %{buildroot}/%{_sysconfdir}/named.d for file in lwresd.conf named.conf.include rndc.key; do touch %{buildroot}/%{_sysconfdir}/${file} done -for file in lwresd named; do - install -m 0754 vendor-files/init/${file} %{buildroot}%{_initddir}/${file} - ln -sf %{_initddir}/${file} %{buildroot}%{_sbindir}/rc${file} -done + +%if %{with_systemd} + for file in lwresd named; do + install -D -m 0644 vendor-files/system/${file}.service %{buildroot}%{_unitdir}/${file}.service + install -m 0755 vendor-files/system/${file}.init %{buildroot}/usr/sbin/${file}.init + ln -s /sbin/service %{buildroot}%{_sbindir}/rc${file} + done +%else + for file in lwresd named; do + install -m 0754 vendor-files/init/${file} %{buildroot}%{_initddir}/${file} + ln -sf %{_initddir}/${file} %{buildroot}%{_sbindir}/rc${file} + done +%endif install -m 0644 ${RPM_SOURCE_DIR}/named.root %{buildroot}%{_localstatedir}/lib/named/root.hint mv vendor-files/config/{127.0.0,localhost}.zone %{buildroot}%{_localstatedir}/lib/named install -m 0754 vendor-files/tools/createNamedConfInclude %{buildroot}/%{_datadir}/bind @@ -674,7 +692,12 @@ fi %attr(0644,root,root) /%{_sysconfdir}/slp.reg.d/bind.reg %attr(0644,root,named) %ghost /%{_sysconfdir}/named.conf.include %attr(0640,root,named) %ghost %config(noreplace) /%{_sysconfdir}/rndc.key +%if %{with_systemd} +%config %{_unitdir}/named.service +%{_sbindir}/named.init +%else %config /%{_sysconfdir}/init.d/named +%endif %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/bind %{_bindir}/bind9-config %{_bindir}/named-rrchecker @@ -766,7 +789,12 @@ fi %files lwresd %ghost %attr(0644,root,named) %config(noreplace) /%{_sysconfdir}/lwresd.conf +%if %{with_systemd} +%config %{_unitdir}/lwresd.service +%{_sbindir}/lwresd.init +%else %config %{_initddir}/lwresd +%endif %{_sbindir}/rclwresd %{_sbindir}/lwresd %{_mandir}/man8/lwresd.8%{ext_man} diff --git a/vendor-files.tar.bz2 b/vendor-files.tar.bz2 index 47c9f6c..965a058 100644 --- a/vendor-files.tar.bz2 +++ b/vendor-files.tar.bz2 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bfee484250131455a86adddc0377a72b8a744bd7c012d97c26aec1ac3d96b51d -size 22291 +oid sha256:fe5609bed079427793fef2bdc22a16d397b2dd358fd986e7e5315f567de2dc1e +size 23552