[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to safely drop a dpkg-divert



Hi!

On Thu, 16 Jan 2025 14:57:29 -0700
Soren Stoutner <soren@debian.org> wrote:

> Removing the preinst is easy so that the diversion doesn’t happen on
> new installs, but my question is how to correctly handle the postrm
> so that the diversion is removed from current installs on upgrade.

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

or use package versions provided by dpkg to maintscripts

if dpkg --compare-versions "$2" le-nl "1.3.13-1"; then

Lorenzo

[1]https://www.debian.org/doc/debian-policy/ap-flowcharts.html


Reply to: