Improve Fedora build host support.

Sudo command (even using -E) resets $PATH for security reasons, Fedora
and other distos might have to explicitly add /usr/local/bin to $PATH
in order to run the commands in the chroot environment.

Change-Id: I95068ecf1e7437152e11c6d6789f59bcfd6ae9cc
This commit is contained in:
Lucas Alvares Gomes 2013-04-17 11:18:20 +01:00
parent 26ba473c72
commit 591059ffd3
2 changed files with 8 additions and 2 deletions

View File

@ -25,6 +25,11 @@ export LANG=C
export DIB_ARGS="$@"
export DIB_ENV=$(export)
# Fedora and others don't always have /usr/local/bin in $PATH
if [[ ! "$PATH" == */usr/local/bin* ]] ; then
export PATH="${PATH}:/usr/local/bin/"
fi
SCRIPTNAME=$(basename $0)
SCRIPT_HOME=$(dirname $0)
export _LIB=$(dirname $0)/../lib

View File

@ -102,8 +102,9 @@ function create_base () {
# Helper function to run a command inside the chroot
function run_in_target() {
# -E to preserve http_proxy
sudo -E chroot $TMP_MOUNT_PATH "$@"
# Explicitly set PATH to prevent sudo from resetting it
# and -E to preserve http_proxy
sudo -E PATH=${PATH} chroot $TMP_MOUNT_PATH "$@"
}
# Helper function to run a directory of scripts inside the chroot