Fix upgrades from non-alternativized versions

Both of the same package and of other packages (genisoimage and wodim
from cdrkit).

Inspired by https://src.fedoraproject.org/rpms/mandoc/pull-request/4

Resolves: RHEL-74055
This commit is contained in:
Pavel Cahyna 2025-01-14 19:08:07 +01:00
parent e3a52310e1
commit f01b24d060

View File

@ -69,6 +69,7 @@ Requires: kf5-filesystem >= 5
Requires(post): /sbin/install-info
Requires(preun): /sbin/install-info
%endif
Requires(pre): %{_sbindir}/alternatives, coreutils
Requires(post): %{_sbindir}/alternatives, coreutils
Requires(preun): %{_sbindir}/alternatives
Provides: cdrecord
@ -178,6 +179,16 @@ cd releng
%ldconfig_scriptlets
%pre -n xorriso%{?variant}
# remove alternativized files if they are not symlinks
# otherwise upgrades from non-alternativized versions do not work
# the list of files should be kept in sync with the "alternatives"
# commands in %%post
for f in cdrecord wodim mkisofs genisoimage ; do
[ -L %{_bindir}/$f ] || %{__rm} -f %{_bindir}/$f || :
[ -L %{_mandir}/man1/$f.1.gz ] || %{__rm} -f %{_mandir}/man1/$f.1.gz || :
done
%post -n xorriso%{?variant}
%if 0%{?rhel} == 7
/sbin/install-info %{_infodir}/xorrecord.info.gz %{_infodir}/dir || :