Lorenzo,
On Friday, January 17, 2025 2:07:22 AM MST Lorenzo wrote:
> Upgrade is available in preinstall and postinstall [1] so it needs to be
> one of the two, not sure which one is better, (maybe preinstall? but if
> it fails it goes back the the old version, see dpkg chart)
>
> I'm not sure, but I would try something like
>
> if [ "$1" = "upgrade" ]; then
> #test if the diversion is installed and then remove it
> fi
>
> to test if the diversion is installed you can probably use
>
> dpkg-divert --list | grep courier-mta
Thanks for the pointer. I have added the following code:
# Delete the old diversions if they exist, which are no longer needed.
# These commands can be removed in trixie +1.
# See <https://github.com/svarshavchik/courier/issues/56>
# See also <https://lists.debian.org/debian-mentors/2025/01/msg00219.html>
if [ dpkg-divert --list | grep courier-mta ]; then
dpkg-divert --package courier-mta --remove --rename \
--divert /usr/bin/addcr.ucspi-tcp /usr/bin/addcr
dpkg-divert --package courier-mta --remove --rename \
--divert /usr/share/man/man1/addcr.ucspi-tcp.1.gz /usr/share/man/man1/addcr.1.gz
fi
https://salsa.debian.org/debian/courier/-/blob/master/debian/courier-mta.postinst?ref_type=heads#L19
--
Soren Stoutner
soren@debian.org
Attachment:
signature.asc
Description: This is a digitally signed message part.