#2 Slight modernization and create user in %pre
Merged 6 years ago by itamarjp. Opened 6 years ago by zbyszek.
rpms/ zbyszek/dnsmasq create-user-in-pre  into  master

file modified
+15 -14
@@ -13,10 +13,9 @@ 

  

  Name:           dnsmasq

  Version:        2.78

- Release:        5%{?extraversion:.%{extraversion}}%{?dist}

+ Release:        6%{?extraversion:.%{extraversion}}%{?dist}

  Summary:        A lightweight DHCP/caching DNS server

  

- Group:          System Environment/Daemons

  License:        GPLv2 or GPLv3

  URL:            http://www.thekelleys.org.uk/dnsmasq/

  Source0:        http://www.thekelleys.org.uk/dnsmasq/%{?extrapath}%{name}-%{version}%{?extraversion}.tar.xz
@@ -35,9 +34,7 @@ 

  Buildrequires:  gcc

  

  BuildRequires:  systemd

- Requires(post): systemd

- Requires(preun): systemd

- Requires(postun): systemd

+ %{?systemd_requires}

  

  %description

  Dnsmasq is lightweight, easy to configure DNS forwarder and DHCP server.
@@ -51,11 +48,10 @@ 

  

  %package        utils

  Summary:        Utilities for manipulating DHCP server leases

- Group:          System Environment/Daemons

  

  %description    utils

- Utilities that use the standard DHCP protocol to

- query/remove a DHCP server's leases.

+ Utilities that use the standard DHCP protocol to query/remove a DHCP

+ server's leases.

  

  

  %prep
@@ -90,12 +86,11 @@ 

  

  

  %build

- make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"

- make -C contrib/lease-tools %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"

+ %make_build CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"

+ %make_build -C contrib/lease-tools CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"

  

  

  %install

- rm -rf $RPM_BUILD_ROOT

  # normally i'd do 'make install'...it's a bit messy, though

  mkdir -p $RPM_BUILD_ROOT%{_sbindir} \

          $RPM_BUILD_ROOT%{_mandir}/man8 \
@@ -124,7 +119,11 @@ 

  rm -rf %{buildroot}%{_initrddir}

  

  #install systemd sysuser file

- install -Dpm 644 %{SOURCE2} $RPM_BUILD_ROOT/usr/lib/sysusers.d/dnsmasq.conf

+ install -Dpm 644 %{SOURCE2} %{buildroot}%{_sysusersdir}/dnsmasq.conf

+ 

+ %pre

+ #precreate users so that rpm can install files owned by that user

+ %sysusers_create_inline '%(cat %{SOURCE2})'

  

  %post

  #https://fedoraproject.org/wiki/Changes/SystemdSysusers
@@ -138,7 +137,6 @@ 

  %systemd_postun_with_restart dnsmasq.service

  

  %files

- %defattr(-,root,root,-)

  %doc CHANGELOG FAQ doc.html setup.html dbus/DBus-interface

  %license COPYING COPYING-v3

  %config(noreplace) %attr(644,root,root) %{_sysconfdir}/dnsmasq.conf
@@ -151,7 +149,7 @@ 

  %dir %{_datadir}/%{name}

  %{_datadir}/%{name}/trust-anchors.conf

  %dir /usr/lib/sysusers.d

- /usr/lib/sysusers.d/dnsmasq.conf

+ %{_sysusersdir}/dnsmasq.conf

  

  %files utils

  %license COPYING COPYING-v3
@@ -159,6 +157,9 @@ 

  %{_mandir}/man1/dhcp_*

  

  %changelog

+ * Sun Feb 25 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.78-6

+ - Create user before installing files (#1548050)

+ 

  * Fri Feb 23 2018 Petr Menšík <pemensik@redhat.com> - 2.78-5

  - Create user first and then restart service

  

no initial comment

Pull-Request has been merged by itamarjp

6 years ago

this version looks good, what do you think about updating the fc26 rpm ?