Append full path to img-functions:run_in_target

The build host might not necessarily have a complete set of dirs
required in its PATH. It will likely be better to statically code a
complete(ish) set of PATH entries inside the function.

Some distros (ex: archlinux) are lacking some dirs commonly found in a
PATH. If this is used as a host OS, it will transfer this incomplete
PATH into the chroot, where other guests (ubuntu, centos) will fail to
find basic binaries due to the lack of a /bin entry.

Change-Id: I084aff7e449f5de811a6169ec90e352ada7da439
This commit is contained in:
Ben Kero 2015-04-15 14:15:49 -07:00
parent 07da09b4f4
commit 4a2939c207

View File

@ -56,11 +56,11 @@ function ensure_sudo () {
# Helper function to run a command inside the chroot
function run_in_target () {
# Force the inclusion of /usr/local/bin in PATH, this is needed for some
# distros that does not include /usr/local/bin in the sudoers secure_path.
# Force the inclusion of a typical set of dirs in PATH, this is needed for guest
# distros that have path elements not in the host PATH.
# Note that we're not expanding PATH during argument processing, the \$
# will preserve the PATH syntax until after the sh command runs
cmd="PATH=\$PATH:/usr/local/bin ; $@"
cmd="PATH=\$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ; $@"
# -E to preserve http_proxy
ORIG_HOME=$HOME
export HOME=/root