Fix post-uninstall cleanup of /var/lib/nfs

b63be16 ("Rely on presets and use standard macros for systemd unit
handling (bz 2218006)") moved the logic to clean up /var/lib/nfs into
the %posttrans scriptlet.  The problem is that the %posttrans scriptlet
runs during install and upgrade, not during uninstall.  That creates a
scenario where uninstalling nfs-utils leaves the nfs-server.cleanup
file behind in /var/lib/rpm-state.  When a subsequent install of
nfs-utils encounters this file, it will delete /var/lib/nfs/statd
and /var/lib/nfs/v4recovery:

--8<--
$ rpm --verify nfs-utils-1:2.7.1-2.el10.x86_64
missing     /var/lib/nfs/statd
missing     /var/lib/nfs/statd/sm
missing     /var/lib/nfs/statd/sm.bak
missing     /var/lib/nfs/v4recovery
--8<--

Resolves: RHEL-65824
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
This commit is contained in:
Scott Mayhew 2024-11-05 14:39:51 -05:00
parent a80d8799c2
commit 50a3520400

View File

@ -2,7 +2,7 @@ Summary: NFS utilities and supporting clients and daemons for the kernel NFS ser
Name: nfs-utils
URL: http://linux-nfs.org/
Version: 2.7.1
Release: 3%{?dist}
Release: 4%{?dist}
Epoch: 1
# group all 32bit related archs
@ -256,16 +256,14 @@ if [ $1 -eq 0 ]; then
: >%{_localstatedir}/lib/rpm-state/nfs-server.cleanup
fi
%posttrans
%postun
%systemd_postun_with_reload nfs-client.target nfs-server.service
if [ -f %{_localstatedir}/lib/rpm-state/nfs-server.cleanup ]; then
rm %{_localstatedir}/lib/rpm-state/nfs-server.cleanup || :
rm -rf /var/lib/nfs/statd || :
rm -rf /var/lib/nfs/v4recovery || :
fi
%postun
%systemd_postun_with_reload nfs-client.target nfs-server.service
%triggerin -- nfs-utils > 1:2.6.2-1
/bin/systemctl try-restart gssproxy || :
rm -rf /etc/systemd/system/nfs-*.requires
@ -429,6 +427,9 @@ rm -rf /etc/systemd/system/rpc-*.requires
%{_mandir}/*/nfsiostat.8.gz
%changelog
* Thu Nov 14 2024 Scott Mayhew <smayhew@redhat.com> 2.7.1-4
- Fix post-uninstall cleanup of /var/lib/nfs (RHEL-65824)
* Tue Nov 12 2024 Scott Mayhew <smayhew@redhat.com> - 2.7.1-3
- Fix the functional gating test (RHEL-65829)