Guillaume Rousse <[EMAIL PROTECTED]> writes:
> To be more precise, using just update-alternatives --remove in %preun and
> update-alternatives --add in %post is wrong, but i'm not sure about the best
> way to solve this.
My experience showed that the main problem is when upgrading a
package which is not alternativeszificated to a package which is.
When upgrading, you need to run the "update-alternatives" once
the old files are removed, and the problem is that in %post of
the new version, they are not here yet.
So to have it working with upgrades we need to put the call in
%triggerpostun - but with a check because %triggerpostun is also
called when the package is removed! also, we need to put it in
%post for simple installation (and in upgrades,
update-alternatives doesn't care to be called if the alternatives
are already here, so no check is necessary). Yep this becomes a
mess :-(.
Well, for postfix here's how I did it:
%post
%{alternatives_install_cmd}
%triggerpostun -- postfix
[ -e %{_sbindir}/sendmail.postfix ] && %{alternatives_install_cmd} || :
%preun
if [ $1 = 0 ]; then
%{alternatives_remove_cmd}
fi
--
Guillaume Cottenceau - http://people.mandrakesoft.com/~gc/