From f01b24d06015c6886adb17c867edd5b36c0d69e2 Mon Sep 17 00:00:00 2001 From: Pavel Cahyna Date: Tue, 14 Jan 2025 19:08:07 +0100 Subject: [PATCH] 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 --- libisoburn.spec | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libisoburn.spec b/libisoburn.spec index df5fc8b..2b67273 100644 --- a/libisoburn.spec +++ b/libisoburn.spec @@ -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 || :