Accepting request 103393 from network

- added correct group for tftp
  (bnc#738905)

- Use systemd macros correctly 
- build with PIE and full RELRO.

- --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. 

- removed systemd config for pre-12.1

- Must be of type forking and change uid to dnsmasq 

- Add systemd startup script

OBS-URL: https://build.opensuse.org/request/show/103393
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/dnsmasq?expand=0&rev=36
This commit is contained in:
Stephan Kulow 2012-02-10 16:12:50 +00:00 committed by Git OBS Bridge
commit 9166f0b6ec
3 changed files with 83 additions and 8 deletions

View File

@ -1,3 +1,42 @@
-------------------------------------------------------------------
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
- Use systemd macros correctly
- build with PIE and full RELRO.
-------------------------------------------------------------------
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
- removed systemd config for pre-12.1
-------------------------------------------------------------------
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

13
dnsmasq.service Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=DNS caching server.
After=syslog.target network.target
[Service]
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

View File

@ -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
@ -19,19 +19,25 @@
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/
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
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
@ -52,23 +58,36 @@ 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 || :
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
%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
@ -83,6 +102,8 @@ 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
install -d -m 0750 ${RPM_BUILD_ROOT}/srv/tftpboot
%find_lang %{name}
%files -f %{name}.lang
@ -100,5 +121,7 @@ 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
%dir %attr(0750,root,tftp) /srv/tftpboot
%changelog