Remove *.leases files from packages: they can be created automatically if the directory exists.

Directories are created by %post scripts.
Don't remove *.leases no packages uninstallation.
This commit is contained in:
Mikhail Novosyolov 2018-10-08 20:52:42 +03:00
parent 9a5baa4982
commit 5761711189
2 changed files with 4 additions and 12 deletions

View file

@ -24,6 +24,9 @@ let's use /etc/sysconfig/dhcpd for both IPv4 and IPv6
* /var/lib/dhcpd and /var/lib/dhclient are now defined as variables in the RPM spec
Note: they are hardcoded in systemd units
* .leases files are not packaged any more, because modern dhcpd and dhclient can create them automatically,
but the directoiry, e.g. /var/lib/dhclient, has to exist and be writable.
* TODO(?): Fedora's patch dhcp-paths.patch
* TODO: should we ship a separate config of systemd tmpfiles for '/run/dhcpd'?
Probable no, it's created automatically (https://www.freedesktop.org/software/systemd/man/systemd.exec.html#Sandboxing)

View file

@ -234,11 +234,6 @@ cat > %{buildroot}%{_sysconfdir}/sysconfig/dhcpd <<EOF
OPTIONS="-q"
EOF
install -d %{buildroot}%{var_dhcpd}
touch %{buildroot}%{var_dhcpd}/dhcpd.leases
install -d %{buildroot}%{var_dhclient}
touch %{buildroot}%{var_dhclient}/dhclient.leases
cat > %{buildroot}%{_sysconfdir}/sysconfig/dhcrelay <<EOF
# Define SERVERS with a list of one or more DHCP servers where
# DHCP packets are to be relayed to and from. This is mandatory.
@ -305,14 +300,11 @@ EOF
%post client
# migrate from root:root as it was before ROSA package v4.4.1
# create this directory if it does not esist and then chmod it to allow dhcpd to work properly
#%sysusers_create isc-dhcp-client.conf
[ ! -d %{var_dhclient}/ ] && mkdir -p %{var_dhclient}/
touch %{var_dhclient}/dhclient.leases || true
#[ -d %{var_dhclient} ] && chown -R isc-dhcp-client:isc-dhcp-client %{var_dhclient}/
%tmpfiles_create dhclient.conf
%postun client
rm -rf %{var_dhclient}/dhclient.leases
:
%postun server
# Migrate from dhcpd user created by scripts
@ -347,7 +339,6 @@ rm -rf %{var_dhclient}/dhclient.leases
%{_mandir}/man5/dhcp-eval.5*
%{_mandir}/man8/dhcpd.8*
%dir %{var_dhcpd}
%config(noreplace) %ghost %{var_dhcpd}/dhcpd.leases
%config %{_sysusersdir}/isc-dhcpd.conf
%files relay
@ -368,8 +359,6 @@ rm -rf %{var_dhclient}/dhclient.leases
%{_mandir}/man8/dhclient.8*
%{_mandir}/man8/dhclient-script.8*
%dir %{var_dhclient}
%config(noreplace) %ghost %{var_dhclient}/dhclient.leases
%config %{_sysusersdir}/isc-dhcp-client.conf
%files devel
%{_includedir}/*