Force empty $TMPDIR inside the chroot

There are some situations (use of libpam-tmpdir) where the $TMPDIR is
defined per user, so any sudo call will define an specific $TMPDIR for
the root user which doesn't exist inside the chroot.

Change-Id: I866651fed520007506c7be83837d3791ed9f2235
Closes-Bug: #1330290
This commit is contained in:
Ghe Rivero 2014-10-15 15:58:47 +00:00
parent 97678dcda5
commit d3c89d85b6

View File

@ -64,7 +64,10 @@ function run_in_target () {
# -E to preserve http_proxy
ORIG_HOME=$HOME
export HOME=/root
sudo -E chroot $TMP_MOUNT_PATH sh -c "$cmd"
# Force an empty TMPDIR inside the chroot. There is no need to use an user
# defined tmp dir which may not exist in the chroot.
# Bug: #1330290
sudo -E TMPDIR= chroot $TMP_MOUNT_PATH sh -c "$cmd"
export HOME=$ORIG_HOME
}