support DPKG_ROOT in preinst and postinst (closes: #990122)
We're working on a way to install packages into a chroot without actually using the chroot system call. A consequence of doing so is that maintainer scripts are run outside the chroot and are supposed to still operate on the chroot whose location is communicated via the DPKG_ROOT environment variable.
base-passwd contains two maintainer scripts that manage /etc/passwd and /etc/group. These need to be adapted to work with the mode depicted above.
Please refer to https://wiki.debian.org/Teams/Dpkg/Spec/InstallBootstrap for more information.
We tested the patch using the scripts at https://salsa.debian.org/helmutg/dpkg-root-demo and can show that a chroot created that way is bit-by-bit identical to one that was created normally.