scripts: allow calling cros_generate_update_payload from outside the chroot

This was broken by 798d75f3be614af161d5687d9335956730d28e45 and there
isn't a proper way to fix it right now, as that commit generally moves
everything inside the chroot. The few remaining scripts that need to be
called from outside need to do a path magic here or there to survive.

BUG=n0ne
TEST=below
1) generate_au_zip.py, unzip it outside the chroot and try running the script
2) cros_au_test_harness

Change-Id: I14bf0267ba2864d7946d657b23812b3dcd512f48

Review URL: http://codereview.chromium.org/6602018
This commit is contained in:
Zdenek Behan 2011-03-01 00:27:19 +01:00
parent 5d184029ef
commit b9a951a13d

View File

@ -12,7 +12,8 @@
# /usr/lib/crosutils. Outside the chroot we find it relative to the script's
# location.
find_common_sh() {
local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")"))
local thisdir="$(dirname "$(readlink -f "$0")")"
local common_paths=(/usr/lib/crosutils "${thisdir}")
local path
SCRIPT_ROOT=
@ -22,17 +23,22 @@ find_common_sh() {
break
fi
done
# HACK(zbehan): We have to fake GCLIENT_ROOT in case we're running inside
# au_zip enviroment. GCLIENT_ROOT detection became fatal...
[ "${SCRIPT_ROOT}" == "${thisdir}" ] && \
export GCLIENT_ROOT="."
}
find_common_sh
. "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1)
# --- END COMMON.SH BOILERPLATE ---
# Need to be inside the chroot to load chromeos-common.sh
assert_inside_chroot
# Load functions and constants for chromeos-install
. "/usr/lib/installer/chromeos-common.sh" || \
# NOTE: Needs to be called from outside the chroot.
. "/usr/lib/installer/chromeos-common.sh" &> /dev/null || \
. "${SRC_ROOT}/platform/installer/chromeos-common.sh" &> /dev/null || \
. "./chromeos-common.sh" || \
die "Unable to load /usr/lib/installer/chromeos-common.sh"
SRC_MNT=""