From 4a2939c207eb948ee6e9be496536422073e244bf Mon Sep 17 00:00:00 2001 From: Ben Kero Date: Wed, 15 Apr 2015 14:15:49 -0700 Subject: [PATCH] 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 --- lib/img-functions | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/img-functions b/lib/img-functions index 6e94423b9..adda8a545 100644 --- a/lib/img-functions +++ b/lib/img-functions @@ -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