Force the inclusion of /usr/local/bin in PATH.
Sudo compiled with the --with-secure-path option enabled (default on Ubuntu, Fedora and potentially other distros) will cause sudo to ignore any changes made to the PATH variable in the user's environment (even when the -E option is used). Also, some distros might not have /usr/local/bin set in their sudoers secure_path causing the diskimage-builder to fail when building an image using such distros as host. This patch will force the inclusion of the /usr/local/bin in the PATH enviroment variable inside the chroot. Change-Id: Idb7156d8ff124bfe685cc721337d9bb21f49dc9e Fixes: bug #1175980
This commit is contained in:
parent
d5d775e9b4
commit
e537e046d1
@ -99,8 +99,13 @@ function mount_proc_dev_sys () {
|
||||
|
||||
# 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.
|
||||
# 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 ; $@"
|
||||
# -E to preserve http_proxy
|
||||
sudo -E chroot $TMP_MOUNT_PATH "$@"
|
||||
sudo -E chroot $TMP_MOUNT_PATH sh -c "$cmd"
|
||||
}
|
||||
|
||||
# Helper function to run a directory of scripts inside the chroot
|
||||
|
Loading…
Reference in New Issue
Block a user