Package: dpkg
Version: 1.21.1
Severity: wishlist

Dear Maintainer,

it would be useful if Debian-specific programs called from a maintainer
script would know which dpkg operation (i.e.  install / upgrade /
configure / remove / purge) is currently being executed.

For example, a future enhanced version of deluser might have functions
to lock an account on uninstall and remove it on purge of the
requesting package.

Currently, that would need postrm code like

case "$1" in
  uninstall)
    deluser --uninstall $user
    ;;
  purge)
    deluser --purge $user
    ;;
esac

If dpkg would define an environment variable DPKG_MAINTSCRIPT_OPERATION
in addition to the already existing DPKG_MAINTSCRIPT_NAME, a simple cal
of deluser --system $user could know by itself whether it is called from
a postrm executing an uninstall or a purge operation and behave
appropriately.

I am pretty sure that I could come up with other usecases that would
augment the already existing DPKG_MAINTSCRIPT_* envvars, it's just the
operation that seems to be missing.

Thanks for considering.

Greetings
Marc

Reply via email to