Fix startup failures during upgrade due to wrong permissions and ownership
This commit is contained in:
parent
944f9adf4f
commit
72d8d2d3cb
14
kea.spec
14
kea.spec
@ -93,7 +93,7 @@ BuildRequires: gnupg2
|
||||
|
||||
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
||||
%upstream_name_compat %{upstream_name}
|
||||
Requires: util-linux
|
||||
Requires: coreutils util-linux
|
||||
%{?systemd_requires}
|
||||
%{?sysusers_requires_compat}
|
||||
|
||||
@ -261,6 +261,18 @@ install -Dpm 0644 %{S:15} %{buildroot}%{_tmpfilesdir}/kea.conf
|
||||
%sysusers_create_compat %{S:16}
|
||||
|
||||
%post
|
||||
# Kea runs under kea user instead of root now, but if its files got altered, their new
|
||||
# ownership&permissions won't get changed so fix them to prevent startup failures
|
||||
[ "`stat --format '%U:%G' %{_rundir}/kea/logger_lockfile 2>&1 | grep root:root`" = "root:root" ] \
|
||||
&& chown kea:kea %{_rundir}/kea/logger_lockfile
|
||||
[ "`stat --format '%U:%G' %{_sharedstatedir}/kea/kea-leases4.csv 2>&1 | grep root:root`" = "root:root" ] \
|
||||
&& chown kea:kea %{_sharedstatedir}/kea/kea-leases4.csv && chmod 0640 %{_sharedstatedir}/kea/kea-leases4.csv
|
||||
[ "`stat --format '%U:%G' %{_sharedstatedir}/kea/kea-leases6.csv 2>&1 | grep root:root`" = "root:root" ] \
|
||||
&& chown kea:kea %{_sharedstatedir}/kea/kea-leases6.csv && chmod 0640 %{_sharedstatedir}/kea/kea-leases6.csv
|
||||
[ "`stat --format '%U:%G' %{_sharedstatedir}/kea/kea-dhcp6-serverid 2>&1 | grep root:root`" = "root:root" ] \
|
||||
&& chown kea:kea %{_sharedstatedir}/kea/kea-dhcp6-serverid
|
||||
[ "`stat --format '%U:%G' %{_sysconfdir}/kea/kea*.conf 2>&1 | grep root:root | head -1`" = "root:root" ] \
|
||||
&& chown root:kea %{_sysconfdir}/kea/kea*.conf && chmod 0640 %{_sysconfdir}/kea/kea*.conf
|
||||
%systemd_post kea-dhcp4.service kea-dhcp6.service kea-dhcp-ddns.service kea-ctrl-agent.service
|
||||
|
||||
%preun
|
||||
|
Loading…
x
Reference in New Issue
Block a user