toolchain_util: fix bash syntax when running as root

Apparently expanding an empty string before a variable assignment forces
that assignment to be interpreted as a command instead. Instead of an
empty string use env as our sudo alternative when running as root.
This commit is contained in:
Michael Marineau 2014-08-18 14:27:43 -07:00
parent 9f79898507
commit b3ecb2c550

View File

@ -192,7 +192,7 @@ _configure_sysroot() {
local profile="$1"
# may be called from either catalyst (root) or setup_board (user)
local sudo=
local sudo="env"
if [[ $(id -u) -ne 0 ]]; then
sudo="sudo -E"
fi
@ -234,7 +234,7 @@ install_cross_toolchain() {
cross_flags+=( --portage "${safe_flags[*]}" )
# may be called from either catalyst (root) or upgrade_chroot (user)
local sudo=
local sudo="env"
if [[ $(id -u) -ne 0 ]]; then
sudo="sudo -E"
fi
@ -273,7 +273,7 @@ install_cross_libs() {
local package_provided="$ROOT/etc/portage/profile/package.provided"
# may be called from either catalyst (root) or setup_board (user)
local sudo=
local sudo="env"
if [[ $(id -u) -ne 0 ]]; then
sudo="sudo -E"
fi