On Monday, January 20, 2025 12:25:19 PM MST Soren Stoutner wrote:
> I do appreciate you taking the time to comment.  Often nobody makes any
> comments to questions that are asked on the forums, and reading your 
comments
> has caused me to think more deeply about dpkg-divert.  In this case I
> personally like the original script because I find it very readable and I
> don’t feel there are any real concerns with how it functions.

In case anyone ends up reading this with the view of copying this example, I 
realized there was a formatting problem with the check that caused it to never 
run.  The fixed script is as follows:

    # 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 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

One of the advantages of using this check instead of a package version number 
is that it can be tested on a machine by manually creating diversions and then 
running the script to see if it removes them, which is how I caught the 
problem.

-- 
Soren Stoutner
so...@debian.org

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to