remove dead symlink (firewalld.conf) left over from old package versions

Resolves: rhbz1967201
This commit is contained in:
Eric Garver 2021-06-07 11:39:08 -04:00
parent 6cce7622c0
commit a5371753ab

View File

@ -1,7 +1,7 @@
Summary: A firewall daemon with D-Bus interface providing a dynamic firewall
Name: firewalld
Version: 1.0.0
Release: 0.2.alpha%{?dist}
Release: 0.3.alpha%{?dist}
URL: http://www.firewalld.org
License: GPLv2+
#Source0: https://github.com/firewalld/firewalld/releases/download/v%{version}/firewalld-%{version}.tar.gz
@ -82,6 +82,27 @@ Requires: dbus-x11
The firewall configuration application provides an configuration interface for
firewalld.
%pretrans -p <lua>
-- HACK: Old rpm versions had an untracked (%ghost) symlink for
-- /etc/firewalld/firewalld.conf. RPM won't handle replacing the symlink due to
-- "%config(noreplace)". As such, we remove the symlink here before attempting
-- to install the new version which is a real file. Only replace the symlink if
-- the target matches one of the previous package's expected targets.
--
-- Unfortunately this must be done in pretrans in order to occur before RPM
-- makes decisions about file replacement.
--
local old_package_symlinks = {"firewalld-standard.conf", "firewalld-server.conf",
"firewalld-workstation.conf"}
local symlink_target = posix.readlink("%{_sysconfdir}/firewalld/firewalld.conf")
for k,v in ipairs(old_package_symlinks) do
if symlink_target == v then
posix.unlink("%{_sysconfdir}/firewalld/firewalld.conf")
break
end
end
%prep
%autosetup -p1
@ -202,6 +223,10 @@ install -d -m 755 %{buildroot}%{_prefix}/lib/firewalld/zones/
%{_mandir}/man1/firewall-config*.1*
%changelog
* Mon Jun 07 2021 Eric Garver <egarver@redhat.com> - 1.0.0-0.3.alpha
- remove dead symlink (firewalld.conf) left over from old package versions
before installing new file
* Tue Jun 01 2021 Eric Garver <egarver@redhat.com> - 1.0.0-0.2.alpha
- fix missing policy kit symlink