Panu Matilainen wrote:
It's not the script itself that's bad and bizarre, it's
the entire
%pretrans mechanism that's problematic.
%pretrans runs before fingerprinting (this is required for the
directory/symlink replacing tricks to work at all), which means that the
transaction can abort due to file conflicts /after/ %pretrans scripts have
already modified the system. A further complication is that yum runs a
test-transcation first, where %pretrans (obviously) doesn't run, so it can
fail with file conflicts on the test transaction that wouldn't exist if
%pretrans had run.
While %pretrans script /can/ be used to work around the symlink/directory
issue to some extent, it should be only considered as a very last resort.
So, think hard before making a choice that might involve
directory<->symlink transitions, and certainly don't /design/ on using
%pretrans for this.
Does this even need %pretrans at all? Rex Dieter used this in kde-settings-
kdm:
%pre kdm
## KDM fixup(s)
# [snip similar hack for a moved/symlinked %config file]
# handle %%_datadir/config/kdm -> /etc/kde/kdm
[ -d %{_datadir}/config/kdm -a ! -L %{_datadir}/config/kdm ] && \
%{__mv} -v %{_datadir}/config/kdm %{_datadir}/config/kdm.rpmorig ||:
AFAIK, this worked while it was relevant. (It can probably be removed now,
the transition happened eons ago.)
Kevin Kofler