From 0ed13f31d4e169e6938aa4a0423e45decf23e1a17beab3f958f5bc31fd24bd6c Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Wed, 13 Nov 2019 14:15:14 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/network/dnsmasq?expand=0&rev=117 --- dnsmasq.spec | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/dnsmasq.spec b/dnsmasq.spec index 7e0761c..8f20dd9 100644 --- a/dnsmasq.spec +++ b/dnsmasq.spec @@ -16,6 +16,12 @@ # +%if 0%{?suse_version} < 1550 +%bcond_with tftp_user_package +%else +%bcond_without tftp_user_package +%endif + Name: dnsmasq Summary: DNS Forwarder and DHCP Server License: GPL-2.0-only OR GPL-3.0-only @@ -46,7 +52,12 @@ BuildRequires: pkg-config BuildRequires: pkgconfig(libnetfilter_conntrack) BuildRequires: pkgconfig(systemd) Requires(pre): group(nogroup) +%if %with_tftp_user_package Requires(pre): user(tftp) +%else +Requires(pre): /usr/sbin/useradd +%else +%endif %description Dnsmasq provides network infrastructure for small networks: DNS, @@ -112,6 +123,15 @@ export LDFLAGS="-Wl,-z,relro,-z,now -pie" make %{?_smp_mflags} AWK=gawk all-i18n CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" COPTS=%{_copts} %pre +%if %without_tftp_user_package +if ! /usr/bin/getent group tftp >/dev/null; then + %{_sbindir}/groupadd -r tftp +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 +fi +%endif 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 @@ -144,6 +164,9 @@ install -m 644 %SOURCE3 %{buildroot}/%{_sysconfdir}/slp.reg.d/ install -d 755 %{buildroot}/etc/dbus-1/system.d/ install -m 644 dbus/dnsmasq.conf %{buildroot}/etc/dbus-1/system.d/dnsmasq.conf install -D -m 0644 %SOURCE4 %{buildroot}%{_unitdir}/dnsmasq.service +%if %without_tftp_user_package +install -d -m 0755 %{buildroot}/srv/tftpboot +%endif ln -sf %{_sbindir}/service %{buildroot}/usr/sbin/rcdnsmasq install -d -m 755 %{buildroot}/%{_sysconfdir}/dnsmasq.d install -m 644 trust-anchors.conf %{buildroot}/%{_sysconfdir}/dnsmasq.d/trust-anchors.conf @@ -180,6 +203,8 @@ rm -rf contrib/MacOSX-launchd %dir %{_sysconfdir}/dnsmasq.d %config(noreplace) %{_sysconfdir}/dnsmasq.d/trust-anchors.conf +%dir %attr(0755,tftp,tftp) /srv/tftpboot + %files utils %{_bindir}/dhcp_* %{_mandir}/man1/dhcp_*