Set up correct environment variables for builds
The implementation in 9aa12369 didn’t take into account that deb_chroot
wasn’t consistently used, and the su -
would have re-set these variables anyway.
To fix this, consistently use deb_chroot
wrapper where su
isn’t used, and use a newly created wrapper su_deb_chroot
elsewhere.
Since DEBIAN_*
variables are only needed when preparing the build chroot, don’t set them in su_deb_chroot
.
With this change applied, I’m getting this output:
[ 333s] ==== Environment variables in build chroot ====
[ 333s]
[ 333s] HOME=/home/abuild
[ 333s] LOGNAME=abuild
[ 333s] MAIL=/var/mail/abuild
[ 333s] PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
[ 333s] PWD=/home/abuild
[ 333s] SHELL=/bin/bash
[ 333s] SHLVL=0
[ 333s] USER=abuild
[ 333s] _=/usr/bin/env