initscripts.postinst: avoid calling uname for non-empty DPKG_ROOT
The output of "uname -s" is potentially not correct when creating a chroot for an architecture with a different kernel, for example when creating a hurd chroot on linux. Creating such a chroot can only be done with dpkg --force-script-chrootless which sets $DPKG_ROOT to the chroot directory.
This commit only calls "uname -s" if $DPKG_ROOT is empty (the normal case). If $DPKG_ROOT is not empty (the chrootless case), then the first block setting up /dev/pts and /dev/shm can be skipped entirely. The second block setting up the alternative for "runsystem" can be conditionalized on whether /etc/hurd/runsystem is already registered in the dpkg alternatives system.
Closes: #1063639
Edited by Johannes Schauer Marin Rodrigues