diff --git a/dhcpcd.spec b/dhcpcd.spec index 05a0e90..c50a9fb 100644 --- a/dhcpcd.spec +++ b/dhcpcd.spec @@ -12,8 +12,9 @@ Source1: %{name}.service Source2: %{name}@.service Source3: http://roy.marples.name/downloads/%{name}/%{name}-%{version}.tar.xz.distinfo.asc Source4: http://keys.gnupg.net/pks/lookup?op=get&search=0x597F97EA9AD45549&options=mr#/roy-marples.name.asc -BuildRequires: gcc -BuildRequires: systemd +Source5: systemd-sysusers.conf +BuildRequires: gcc +BuildRequires: systemd-rpm-macros BuildRequires: chrony BuildRequires: systemd-devel BuildRequires: ypbind @@ -21,9 +22,7 @@ BuildRequires: make %if %{with SIGCHECK} BuildRequires: gnupg2 %endif -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd +%{?systemd_requires} %description The dhcpcd package provides a minimalistic network configuration daemon that supports IPv4 and IPv6 configuration including configuration discovery @@ -55,14 +54,17 @@ install -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service install -D -m 644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}@.service install -d %{buildroot}%{_sharedstatedir}/%{_name} +%pre +%sysusers_create_compat %{SOURCE5} + %post -%systemd_post dhcpcd.service +%systemd_post %{name}.service %preun -%systemd_preun dhcpcd.service +%systemd_preun %{name}.service %postun -%systemd_postun_with_restart dhcpcd.service +%systemd_postun_with_restart %{name}.service %files %config(noreplace) %{_sysconfdir}/%{name}.conf @@ -79,6 +81,7 @@ install -d %{buildroot}%{_sharedstatedir}/%{_name} %{_sbindir}/%{name} %{_unitdir}/%{name}.service %{_unitdir}/%{name}@.service +%defattr(0664,dhcpcd,root,0775) %{_sharedstatedir}/%{name} %changelog diff --git a/dhcpcd@.service b/dhcpcd@.service index c81bb05..e5cdd0a 100644 --- a/dhcpcd@.service +++ b/dhcpcd@.service @@ -2,12 +2,10 @@ Description=dhcpcd on %I Wants=network.target Before=network.target -BindsTo=sys-subsystem-net-devices-%i.device -After=sys-subsystem-net-devices-%i.device [Service] Type=forking -PIDFile=/run/dhcpcd-%I.pid +PIDFile=/run/dhcpcd/%I.pid ExecStart=/usr/sbin/dhcpcd -q %I ExecStop=/usr/sbin/dhcpcd -x %I diff --git a/systemd-sysusers.conf b/systemd-sysusers.conf new file mode 100644 index 0000000..5e60da3 --- /dev/null +++ b/systemd-sysusers.conf @@ -0,0 +1 @@ +u dhcpcd - "Minimalistic DHCP client" /var/lib/dhcpcd