From 3fb76e5890a14d56b2f607d9911d7c79e0662400159b0dd32f140b86f5cf5e81 Mon Sep 17 00:00:00 2001 From: Uwe Gansert Date: Fri, 25 Nov 2011 11:00:57 +0000 Subject: [PATCH 1/6] Accepting request 93543 from home:elvigia:branches:network - Must be of type forking and change uid to dnsmasq - Add systemd startup script OBS-URL: https://build.opensuse.org/request/show/93543 OBS-URL: https://build.opensuse.org/package/show/network/dnsmasq?expand=0&rev=26 --- dnsmasq.changes | 10 ++++++++++ dnsmasq.service | 11 +++++++++++ dnsmasq.spec | 3 +++ 3 files changed, 24 insertions(+) create mode 100644 dnsmasq.service diff --git a/dnsmasq.changes b/dnsmasq.changes index 0a010c3..9cde372 100644 --- a/dnsmasq.changes +++ b/dnsmasq.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Thu Nov 24 20:45:37 UTC 2011 - crrodriguez@opensuse.org + +- Must be of type forking and change uid to dnsmasq + +------------------------------------------------------------------- +Thu Nov 24 20:19:11 UTC 2011 - crrodriguez@opensuse.org + +- Add systemd startup script + ------------------------------------------------------------------- Thu Oct 20 15:58:50 CEST 2011 - ug@suse.de diff --git a/dnsmasq.service b/dnsmasq.service new file mode 100644 index 0000000..1a441d0 --- /dev/null +++ b/dnsmasq.service @@ -0,0 +1,11 @@ +[Unit] +Description=DNS caching server. +After=syslog.target network.target + +[Service] +Type=forking +PIDFile=/var/run/dnsmasq.pid +ExecStart=/usr/sbin/dnsmasq -u dnsmasq + +[Install] +WantedBy=multi-user.target diff --git a/dnsmasq.spec b/dnsmasq.spec index 752aa3e..16ff670 100644 --- a/dnsmasq.spec +++ b/dnsmasq.spec @@ -28,6 +28,7 @@ PreReq: /usr/sbin/useradd %fillup_prereq %insserv_prereq /bin/mkdir Url: http://www.thekelleys.org.uk/dnsmasq/ Source: %{name}-%{version}.tar.bz2 Source1: vendor-files.tar.bz2 +Source2: dnsmasq.service Patch1: group_and_isc.diff Patch3: manpage.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -83,6 +84,7 @@ install -m 644 SuSEFirewall.dnsmasq-dns ${RPM_BUILD_ROOT}/%{_sysconfdir}/sysconf install -m 644 SuSEFirewall.dnsmasq-dhcp ${RPM_BUILD_ROOT}/%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/dnsmasq-dhcp install -d 755 ${RPM_BUILD_ROOT}/etc/dbus-1/system.d/ install -m 644 dbus/dnsmasq.conf ${RPM_BUILD_ROOT}/etc/dbus-1/system.d/dnsmasq.conf +install -D -m 0644 %SOURCE2 %{buildroot}/lib/systemd/system/dnsmasq.service %find_lang %{name} %files -f %{name}.lang @@ -100,5 +102,6 @@ install -m 644 dbus/dnsmasq.conf ${RPM_BUILD_ROOT}/etc/dbus-1/system.d/dnsmasq.c %{_mandir}/fr/man8/dnsmasq.8.gz %{_mandir}/es/man8/dnsmasq.8.gz /etc/dbus-1/system.d/dnsmasq.conf +/lib/systemd/system/dnsmasq.service %changelog From 123bb2c55a27aa084170d71fb275cd6bce91dcb0b2692275487fe3d3d68f0a77 Mon Sep 17 00:00:00 2001 From: Uwe Gansert Date: Fri, 25 Nov 2011 13:14:46 +0000 Subject: [PATCH 2/6] removed systemd config for pre-12.1 OBS-URL: https://build.opensuse.org/package/show/network/dnsmasq?expand=0&rev=27 --- dnsmasq.changes | 5 +++++ dnsmasq.spec | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/dnsmasq.changes b/dnsmasq.changes index 9cde372..ae1033b 100644 --- a/dnsmasq.changes +++ b/dnsmasq.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Nov 25 13:14:41 CET 2011 - ug@suse.de + +- removed systemd config for pre-12.1 + ------------------------------------------------------------------- Thu Nov 24 20:45:37 UTC 2011 - crrodriguez@opensuse.org diff --git a/dnsmasq.spec b/dnsmasq.spec index 16ff670..99d5dd3 100644 --- a/dnsmasq.spec +++ b/dnsmasq.spec @@ -84,7 +84,9 @@ install -m 644 SuSEFirewall.dnsmasq-dns ${RPM_BUILD_ROOT}/%{_sysconfdir}/sysconf install -m 644 SuSEFirewall.dnsmasq-dhcp ${RPM_BUILD_ROOT}/%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/dnsmasq-dhcp install -d 755 ${RPM_BUILD_ROOT}/etc/dbus-1/system.d/ install -m 644 dbus/dnsmasq.conf ${RPM_BUILD_ROOT}/etc/dbus-1/system.d/dnsmasq.conf +%if 0%{?suse_version} >= 1210 install -D -m 0644 %SOURCE2 %{buildroot}/lib/systemd/system/dnsmasq.service +%endif %find_lang %{name} %files -f %{name}.lang @@ -102,6 +104,8 @@ install -D -m 0644 %SOURCE2 %{buildroot}/lib/systemd/system/dnsmasq.service %{_mandir}/fr/man8/dnsmasq.8.gz %{_mandir}/es/man8/dnsmasq.8.gz /etc/dbus-1/system.d/dnsmasq.conf +%if 0%{?suse_version} >= 1210 /lib/systemd/system/dnsmasq.service +%endif %changelog From 138204aee29d0231e5c27c588d508c7038f41f5787b06c2587e9172749787777 Mon Sep 17 00:00:00 2001 From: Uwe Gansert Date: Thu, 19 Jan 2012 15:28:49 +0000 Subject: [PATCH 3/6] Accepting request 100647 from home:elvigia:branches:network - --enable-dbus must be explicit in systemd unit - default user is provided in config file or takes defaults on group_and_isc.diff - dnsmasq has dbus support, use it for systemd service. OBS-URL: https://build.opensuse.org/request/show/100647 OBS-URL: https://build.opensuse.org/package/show/network/dnsmasq?expand=0&rev=28 --- dnsmasq.changes | 12 ++++++++++++ dnsmasq.service | 8 +++++--- dnsmasq.spec | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/dnsmasq.changes b/dnsmasq.changes index ae1033b..75d9696 100644 --- a/dnsmasq.changes +++ b/dnsmasq.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Thu Jan 19 04:22:44 UTC 2012 - crrodriguez@opensuse.org + +- --enable-dbus must be explicit in systemd unit +- default user is provided in config file or takes defaults on + group_and_isc.diff + +------------------------------------------------------------------- +Wed Jan 18 21:34:25 UTC 2012 - crrodriguez@opensuse.org + +- dnsmasq has dbus support, use it for systemd service. + ------------------------------------------------------------------- Fri Nov 25 13:14:41 CET 2011 - ug@suse.de diff --git a/dnsmasq.service b/dnsmasq.service index 1a441d0..137df60 100644 --- a/dnsmasq.service +++ b/dnsmasq.service @@ -3,9 +3,11 @@ Description=DNS caching server. After=syslog.target network.target [Service] -Type=forking -PIDFile=/var/run/dnsmasq.pid -ExecStart=/usr/sbin/dnsmasq -u dnsmasq +Type=dbus +BusName=uk.org.thekelleys.dnsmasq +ExecStartPre=/usr/sbin/dnsmasq --test +ExecStart=/usr/sbin/dnsmasq --enable-dbus --keep-in-foreground +ExecReload=/bin/kill -HUP $MAINPID [Install] WantedBy=multi-user.target diff --git a/dnsmasq.spec b/dnsmasq.spec index 99d5dd3..b2b07ad 100644 --- a/dnsmasq.spec +++ b/dnsmasq.spec @@ -1,7 +1,7 @@ # # spec file for package dnsmasq # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed From c6ed0facf8777479dab87423186304480c8c746d1d8d0d85f1512c749cbacc77 Mon Sep 17 00:00:00 2001 From: Uwe Gansert Date: Tue, 7 Feb 2012 15:24:59 +0000 Subject: [PATCH 4/6] Accepting request 102948 from home:elvigia:branches:network - Use systemd macros correctly - build with PIE and full RELRO. OBS-URL: https://build.opensuse.org/request/show/102948 OBS-URL: https://build.opensuse.org/package/show/network/dnsmasq?expand=0&rev=29 --- dnsmasq.changes | 6 ++++++ dnsmasq.spec | 28 +++++++++++++++------------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/dnsmasq.changes b/dnsmasq.changes index 75d9696..397a9ea 100644 --- a/dnsmasq.changes +++ b/dnsmasq.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Feb 6 22:25:05 UTC 2012 - crrodriguez@opensuse.org + +- Use systemd macros correctly +- build with PIE and full RELRO. + ------------------------------------------------------------------- Thu Jan 19 04:22:44 UTC 2012 - crrodriguez@opensuse.org diff --git a/dnsmasq.spec b/dnsmasq.spec index b2b07ad..6c9a91a 100644 --- a/dnsmasq.spec +++ b/dnsmasq.spec @@ -16,13 +16,12 @@ # - Name: dnsmasq Summary: Lightweight, Easy-to-Configure DNS Forwarder and DHCP Server -Version: 2.59 -Release: 1 -License: GPLv2+ +License: GPL-2.0+ Group: Productivity/Networking/DNS/Servers +Version: 2.59 +Release: 0 Provides: dns_daemon PreReq: /usr/sbin/useradd %fillup_prereq %insserv_prereq /bin/mkdir Url: http://www.thekelleys.org.uk/dnsmasq/ @@ -32,7 +31,12 @@ Source2: dnsmasq.service Patch1: group_and_isc.diff Patch3: manpage.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: dbus-1-devel libidn libidn-devel pkg-config +BuildRequires: dbus-1-devel +BuildRequires: libidn +BuildRequires: libidn-devel +BuildRequires: pkg-config +BuildRequires: systemd +%{?systemd_requires} %description Dnsmasq is a lightweight, easy-to-configure DNS forwarder and DHCP @@ -53,23 +57,25 @@ echo "#define HAVE_DBUS" >> src/config.h %build mv po/no.po po/nb.po -export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" +export RPM_OPT_FLAGS="$RPM_OPT_FLAGS -fPIC -DPIC -fpie -fno-strict-aliasing" +export LDFLAGS="-Wl,-z,relro,-z,now -pie" make %{?_smp_mflags} AWK=gawk all-i18n %pre if ! /usr/bin/getent passwd dnsmasq >/dev/null; then /usr/sbin/useradd -r -d /var/lib/empty -s /bin/false -c "dnsmasq" -g nogroup dnsmasq || : fi - +%service_add_pre %{name}.service %post %{fillup_and_insserv dnsmasq} - +%service_add_post %{name}.service %preun %stop_on_removal dnsmasq - +%service_del_preun %{name}.service %postun %restart_on_update dnsmasq %{insserv_cleanup} +%service_del_postun %{name}.service %install make install-i18n DESTDIR=$RPM_BUILD_ROOT PREFIX=/usr AWK=gawk @@ -84,9 +90,7 @@ install -m 644 SuSEFirewall.dnsmasq-dns ${RPM_BUILD_ROOT}/%{_sysconfdir}/sysconf install -m 644 SuSEFirewall.dnsmasq-dhcp ${RPM_BUILD_ROOT}/%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/dnsmasq-dhcp install -d 755 ${RPM_BUILD_ROOT}/etc/dbus-1/system.d/ install -m 644 dbus/dnsmasq.conf ${RPM_BUILD_ROOT}/etc/dbus-1/system.d/dnsmasq.conf -%if 0%{?suse_version} >= 1210 install -D -m 0644 %SOURCE2 %{buildroot}/lib/systemd/system/dnsmasq.service -%endif %find_lang %{name} %files -f %{name}.lang @@ -104,8 +108,6 @@ install -D -m 0644 %SOURCE2 %{buildroot}/lib/systemd/system/dnsmasq.service %{_mandir}/fr/man8/dnsmasq.8.gz %{_mandir}/es/man8/dnsmasq.8.gz /etc/dbus-1/system.d/dnsmasq.conf -%if 0%{?suse_version} >= 1210 /lib/systemd/system/dnsmasq.service -%endif %changelog From 67215239bf6d34006cb691d1011d37af280c90dcdbb1a1c713fd8569fa6a2c1c Mon Sep 17 00:00:00 2001 From: Uwe Gansert Date: Wed, 8 Feb 2012 16:00:07 +0000 Subject: [PATCH 5/6] added tftp group (bnc#738905) OBS-URL: https://build.opensuse.org/package/show/network/dnsmasq?expand=0&rev=30 --- dnsmasq.changes | 6 ++++++ dnsmasq.spec | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/dnsmasq.changes b/dnsmasq.changes index 397a9ea..195464d 100644 --- a/dnsmasq.changes +++ b/dnsmasq.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Feb 8 16:56:35 CET 2012 - ug@suse.de + +- added correct group for tftp + (bnc#738905) + ------------------------------------------------------------------- Mon Feb 6 22:25:05 UTC 2012 - crrodriguez@opensuse.org diff --git a/dnsmasq.spec b/dnsmasq.spec index 6c9a91a..afe4e0f 100644 --- a/dnsmasq.spec +++ b/dnsmasq.spec @@ -16,6 +16,7 @@ # + Name: dnsmasq Summary: Lightweight, Easy-to-Configure DNS Forwarder and DHCP Server License: GPL-2.0+ @@ -62,16 +63,23 @@ export LDFLAGS="-Wl,-z,relro,-z,now -pie" make %{?_smp_mflags} AWK=gawk all-i18n %pre -if ! /usr/bin/getent passwd dnsmasq >/dev/null; then - /usr/sbin/useradd -r -d /var/lib/empty -s /bin/false -c "dnsmasq" -g nogroup dnsmasq || : +if ! /usr/bin/getent group tftp >/dev/null; then + %{_sbindir}/groupadd -r tftp 2>/dev/null || : fi +if ! /usr/bin/getent passwd dnsmasq >/dev/null; then + /usr/sbin/useradd -r -d /var/lib/empty -s /bin/false -c "dnsmasq" -g nogroup -G tftp dnsmasq || : +fi + %service_add_pre %{name}.service + %post %{fillup_and_insserv dnsmasq} %service_add_post %{name}.service + %preun %stop_on_removal dnsmasq %service_del_preun %{name}.service + %postun %restart_on_update dnsmasq %{insserv_cleanup} @@ -91,6 +99,7 @@ install -m 644 SuSEFirewall.dnsmasq-dhcp ${RPM_BUILD_ROOT}/%{_sysconfdir}/syscon install -d 755 ${RPM_BUILD_ROOT}/etc/dbus-1/system.d/ install -m 644 dbus/dnsmasq.conf ${RPM_BUILD_ROOT}/etc/dbus-1/system.d/dnsmasq.conf install -D -m 0644 %SOURCE2 %{buildroot}/lib/systemd/system/dnsmasq.service +install -d -m 0750 ${RPM_BUILD_ROOT}/srv/tftpboot %find_lang %{name} %files -f %{name}.lang @@ -109,5 +118,6 @@ install -D -m 0644 %SOURCE2 %{buildroot}/lib/systemd/system/dnsmasq.service %{_mandir}/es/man8/dnsmasq.8.gz /etc/dbus-1/system.d/dnsmasq.conf /lib/systemd/system/dnsmasq.service +%dir %attr(0750,root,tftp) /srv/tftpboot %changelog From 057a9ef8e713fd3b5d7dbfe8e504bf6b31560726bbb4438ec1241df7eb9e0a5e Mon Sep 17 00:00:00 2001 From: Uwe Gansert Date: Wed, 8 Feb 2012 16:16:51 +0000 Subject: [PATCH 6/6] tftp user is needed too OBS-URL: https://build.opensuse.org/package/show/network/dnsmasq?expand=0&rev=31 --- dnsmasq.spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dnsmasq.spec b/dnsmasq.spec index afe4e0f..77671fe 100644 --- a/dnsmasq.spec +++ b/dnsmasq.spec @@ -66,6 +66,10 @@ make %{?_smp_mflags} AWK=gawk all-i18n if ! /usr/bin/getent group tftp >/dev/null; then %{_sbindir}/groupadd -r tftp 2>/dev/null || : fi +if ! /usr/bin/getent passwd tftp >/dev/null; then + %{_sbindir}/useradd -c "TFTP account" -d /srv/tftpboot -G tftp -g tftp \ + -r -s /bin/false tftp 2>/dev/null || : +fi if ! /usr/bin/getent passwd dnsmasq >/dev/null; then /usr/sbin/useradd -r -d /var/lib/empty -s /bin/false -c "dnsmasq" -g nogroup -G tftp dnsmasq || : fi