mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-09 14:06:58 +02:00
Verify that SCRIPTS_DIR exists in build_image.
This hack is necessary for old chroots to ensure that we source a good common.sh when the one inside the chroot is out of date. We'll be able to get rid of this after everybody has updated their chroot to have a working version of common.sh and/or we have deprecated running scripts from the source directory. Also fix logic for when common.sh is missing to exit properly. BUG=chromium-os:11598 TEST=Verify that build_image still works when the old common.sh is present in the chroot. Change-Id: I2e8c2fd5ad06446e669ad665ee2e70f4364958fe Review URL: http://codereview.chromium.org/6286084
This commit is contained in:
parent
a0e7ea185a
commit
17d44e3659
@ -9,17 +9,17 @@
|
||||
# the given target's root with binary packages turned on. This script will
|
||||
# build the Chrome OS image using only pre-built binary packages.
|
||||
|
||||
# --- BEGIN COMMON.SH BOILERPLATE ---
|
||||
# Load common CrOS utilities. Inside the chroot this file is installed in
|
||||
# /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 common_paths=(/usr/lib/crosutils $(dirname "$0"))
|
||||
local path
|
||||
|
||||
SCRIPT_ROOT=
|
||||
for path in "${common_paths[@]}"; do
|
||||
if [ -r "${path}/common.sh" ]; then
|
||||
local common="${path}/common.sh"
|
||||
if ([ -r "${common}" ] && . "${common}" && [ -d "${SCRIPTS_DIR}" ]); then
|
||||
SCRIPT_ROOT=${path}
|
||||
break
|
||||
fi
|
||||
@ -27,8 +27,7 @@ find_common_sh() {
|
||||
}
|
||||
|
||||
find_common_sh
|
||||
. "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1)
|
||||
# --- END COMMON.SH BOILERPLATE ---
|
||||
. "${SCRIPT_ROOT}/common.sh" || ! echo "Unable to load common.sh" || exit 1
|
||||
|
||||
# Load functions and constants for chromeos-install
|
||||
[ -f /usr/lib/installer/chromeos-common.sh ] && \
|
||||
|
Loading…
Reference in New Issue
Block a user