Make $HOME in the chroot be reasonable.

With sudo -E $HOME is inherited, which is nearly always wrong.

Change-Id: Ic77b9c2892c19a2fc08a07d35f76da79a346ebac
This commit is contained in:
Robert Collins 2013-08-10 01:15:18 +12:00
parent c7d80ddeed
commit d6d941a8f1

View File

@ -60,7 +60,10 @@ function run_in_target () {
# will preserve the PATH syntax until after the sh command runs
cmd="PATH=\$PATH:/usr/local/bin ; $@"
# -E to preserve http_proxy
ORIG_HOME=$HOME
export HOME=/root
sudo -E chroot $TMP_MOUNT_PATH sh -c "$cmd"
export HOME=$ORIG_HOME
}
# Helper function to run a directory of scripts inside the chroot