Per the Debian Policy Manual, my postinst script is getting called at upgrade and configure time, as "postinst configure old-version", where old-version is the previously installed version (possibly null). I want to determine new-version, i.e. the version that is currently being configured (upgraded to).
The environment variable $DPKG_MAINTSCRIPT_PACKAGE
contains the package name; there does not seem to be an equivalent _VERSION
field. /var/lib/dpkg/status
gets updated AFTER postinst runs, so I can't seem to parse it out of there, either.
Any ideas?