Simplify boilerplate common.sh code in src/scripts.

Currently, the scripts in src/scripts have multiple implementations
for handling when common.sh fails to load, some of which are buggy.
To simplify the boilerplate, these scripts now just exit if common.sh
fails to load. The shell itself will print the following message if
common.sh is not found:
  /usr/lib/crosutils/common.sh: No such file or directory

BUG=chromium-os:32442
TEST=Run these scripts with and without common.sh installed.

Change-Id: Ie54420b6c649774f9cb039c14c80f4cf6c6ebc07
Reviewed-on: https://gerrit.chromium.org/gerrit/27058
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
Commit-Ready: David James <davidjames@chromium.org>
This commit is contained in:
David James 2012-07-10 13:09:48 -07:00 committed by Gerrit
parent d712ae9007
commit 359d3e119d
31 changed files with 73 additions and 89 deletions

View File

@ -6,14 +6,8 @@
# Script to take an archived build result and prepare a hwqual release. # Script to take an archived build result and prepare a hwqual release.
# --- 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.
SCRIPT_ROOT=$(dirname $(readlink -f "$0")) SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; } . "${SCRIPT_ROOT}/common.sh" || exit 1
# --- END COMMON.SH BOILERPLATE ---
# Flags # Flags
DEFINE_string from "" "Directory with build archive (zipname)" DEFINE_string from "" "Directory with build archive (zipname)"

View File

@ -12,20 +12,20 @@
# /usr/lib/crosutils. Outside the chroot we find it relative to the script's # /usr/lib/crosutils. Outside the chroot we find it relative to the script's
# location. # location.
find_common_sh() { find_common_sh() {
local common_paths=(/usr/lib/crosutils "$(dirname "$(readlink -f "$0")")/..") local common_paths=("$(dirname "$(readlink -f "$0")")/.." /usr/lib/crosutils)
local path local path
SCRIPT_ROOT= SCRIPT_ROOT="${common_paths[0]}"
for path in "${common_paths[@]}"; do for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then if [ -r "${path}/common.sh" ]; then
SCRIPT_ROOT=${path} SCRIPT_ROOT="${path}"
break break
fi fi
done done
} }
find_common_sh find_common_sh
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; } . "${SCRIPT_ROOT}/common.sh" || exit 1
# --- END COMMON.SH BOILERPLATE --- # --- END COMMON.SH BOILERPLATE ---
get_default_board get_default_board

View File

@ -11,23 +11,23 @@
# /usr/lib/crosutils. Outside the chroot we find it relative to the script's # /usr/lib/crosutils. Outside the chroot we find it relative to the script's
# location. # location.
find_common_sh() { find_common_sh() {
local common_paths=(/usr/lib/crosutils "$(dirname "$(readlink -f "$0")")/..") local common_paths=("$(dirname "$(readlink -f "$0")")/.." /usr/lib/crosutils)
local path local path
SCRIPT_ROOT= SCRIPT_ROOT="${common_paths[0]}"
for path in "${common_paths[@]}"; do for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then if [ -r "${path}/common.sh" ]; then
SCRIPT_ROOT=${path} SCRIPT_ROOT="${path}"
break break
fi fi
done done
} }
find_common_sh find_common_sh
. "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) . "${SCRIPT_ROOT}/common.sh" || exit 1
# --- END COMMON.SH BOILERPLATE --- # --- END COMMON.SH BOILERPLATE ---
. "${SCRIPT_ROOT}/remote_access.sh" || die "Unable to load remote_access.sh" . "${SCRIPT_ROOT}/remote_access.sh" || exit 1
FLAGS "$@" || exit 1 FLAGS "$@" || exit 1

View File

@ -12,29 +12,28 @@
# /usr/lib/crosutils. Outside the chroot we find it relative to the script's # /usr/lib/crosutils. Outside the chroot we find it relative to the script's
# location. # location.
find_common_sh() { find_common_sh() {
local common_paths=(/usr/lib/crosutils "$(dirname "$(readlink -f "$0")")/..") local common_paths=("$(dirname "$(readlink -f "$0")")/.." /usr/lib/crosutils)
local path local path
SCRIPT_ROOT= SCRIPT_ROOT="${common_paths[0]}"
for path in "${common_paths[@]}"; do for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then if [ -r "${path}/common.sh" ]; then
SCRIPT_ROOT=${path} SCRIPT_ROOT="${path}"
break break
fi fi
done done
} }
find_common_sh find_common_sh
. "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) . "${SCRIPT_ROOT}/common.sh" || exit 1
# --- END COMMON.SH BOILERPLATE --- # --- END COMMON.SH BOILERPLATE ---
# Need to be inside the chroot to load chromeos-common.sh # Need to be inside the chroot to load chromeos-common.sh
assert_inside_chroot assert_inside_chroot
# Load functions and constants for chromeos-install # Load functions and constants for chromeos-install
. "/usr/lib/installer/chromeos-common.sh" || \ . /usr/lib/installer/chromeos-common.sh || exit 1
die "Unable to load /usr/lib/installer/chromeos-common.sh" . "${SCRIPTS_DIR}/build_library/build_image_util.sh" || exit 1
. "${SCRIPTS_DIR}/build_library/build_image_util.sh" || die "No build_image_util"
switch_to_strict_mode switch_to_strict_mode

View File

@ -12,23 +12,23 @@
# /usr/lib/crosutils. Outside the chroot we find it relative to the script's # /usr/lib/crosutils. Outside the chroot we find it relative to the script's
# location. # location.
find_common_sh() { find_common_sh() {
local common_paths=(/usr/lib/crosutils "$(dirname "$(readlink -f "$0")")/..") local common_paths=("$(dirname "$(readlink -f "$0")")/.." /usr/lib/crosutils)
local path local path
SCRIPT_ROOT= SCRIPT_ROOT="${common_paths[0]}"
for path in "${common_paths[@]}"; do for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then if [ -r "${path}/common.sh" ]; then
SCRIPT_ROOT=${path} SCRIPT_ROOT="${path}"
break break
fi fi
done done
} }
find_common_sh find_common_sh
. "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) . "${SCRIPT_ROOT}/common.sh" || exit 1
# --- END COMMON.SH BOILERPLATE --- # --- END COMMON.SH BOILERPLATE ---
. "${SCRIPT_ROOT}/remote_access.sh" || die "Unable to load remote_access.sh" . "${SCRIPT_ROOT}/remote_access.sh" || exit 1
get_default_board get_default_board

View File

@ -12,28 +12,27 @@
# /usr/lib/crosutils. Outside the chroot we find it relative to the script's # /usr/lib/crosutils. Outside the chroot we find it relative to the script's
# location. # location.
find_common_sh() { find_common_sh() {
local common_paths=(/usr/lib/crosutils "$(dirname "$(readlink -f "$0")")/..") local common_paths=("$(dirname "$(readlink -f "$0")")/.." /usr/lib/crosutils)
local path local path
SCRIPT_ROOT= SCRIPT_ROOT="${common_paths[0]}"
for path in "${common_paths[@]}"; do for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then if [ -r "${path}/common.sh" ]; then
SCRIPT_ROOT=${path} SCRIPT_ROOT="${path}"
break break
fi fi
done done
} }
find_common_sh find_common_sh
. "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) . "${SCRIPT_ROOT}/common.sh" || exit 1
# --- END COMMON.SH BOILERPLATE --- # --- END COMMON.SH BOILERPLATE ---
# Need to be inside the chroot to load chromeos-common.sh # Need to be inside the chroot to load chromeos-common.sh
assert_inside_chroot assert_inside_chroot
# Load functions and constants for chromeos-install # Load functions and constants for chromeos-install
. "/usr/lib/installer/chromeos-common.sh" || \ . /usr/lib/installer/chromeos-common.sh || exit 1
die "Unable to load /usr/lib/installer/chromeos-common.sh"
locate_gpt locate_gpt

View File

@ -14,20 +14,20 @@
# /usr/lib/crosutils. Outside the chroot we find it relative to the script's # /usr/lib/crosutils. Outside the chroot we find it relative to the script's
# location. # location.
find_common_sh() { find_common_sh() {
local common_paths=(/usr/lib/crosutils "$(dirname "$(readlink -f "$0")")/..") local common_paths=("$(dirname "$(readlink -f "$0")")/.." /usr/lib/crosutils)
local path local path
SCRIPT_ROOT= SCRIPT_ROOT="${common_paths[0]}"
for path in "${common_paths[@]}"; do for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then if [ -r "${path}/common.sh" ]; then
SCRIPT_ROOT=${path} SCRIPT_ROOT="${path}"
break break
fi fi
done done
} }
find_common_sh find_common_sh
. "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) . "${SCRIPT_ROOT}/common.sh" || exit 1
# --- END COMMON.SH BOILERPLATE --- # --- END COMMON.SH BOILERPLATE ---
# Figure out the default chromelab server name. In order for this to # Figure out the default chromelab server name. In order for this to

View File

@ -12,20 +12,20 @@
# /usr/lib/crosutils. Outside the chroot we find it relative to the script's # /usr/lib/crosutils. Outside the chroot we find it relative to the script's
# location. # location.
find_common_sh() { find_common_sh() {
local common_paths=(/usr/lib/crosutils "$(dirname "$(readlink -f "$0")")/..") local common_paths=("$(dirname "$(readlink -f "$0")")/.." /usr/lib/crosutils)
local path local path
SCRIPT_ROOT= SCRIPT_ROOT="${common_paths[0]}"
for path in "${common_paths[@]}"; do for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then if [ -r "${path}/common.sh" ]; then
SCRIPT_ROOT=${path} SCRIPT_ROOT="${path}"
break break
fi fi
done done
} }
find_common_sh find_common_sh
. "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) . "${SCRIPT_ROOT}/common.sh" || exit 1
# --- END COMMON.SH BOILERPLATE --- # --- END COMMON.SH BOILERPLATE ---
# Figure out the default chromelab server name. In order for this to # Figure out the default chromelab server name. In order for this to

View File

@ -12,28 +12,27 @@
# /usr/lib/crosutils. Outside the chroot we find it relative to the script's # /usr/lib/crosutils. Outside the chroot we find it relative to the script's
# location. # location.
find_common_sh() { find_common_sh() {
local common_paths=(/usr/lib/crosutils "$(dirname "$(readlink -f "$0")")/..") local common_paths=("$(dirname "$(readlink -f "$0")")/.." /usr/lib/crosutils)
local path local path
SCRIPT_ROOT= SCRIPT_ROOT="${common_paths[0]}"
for path in "${common_paths[@]}"; do for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then if [ -r "${path}/common.sh" ]; then
SCRIPT_ROOT=${path} SCRIPT_ROOT="${path}"
break break
fi fi
done done
} }
find_common_sh find_common_sh
. "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) . "${SCRIPT_ROOT}/common.sh" || exit 1
# --- END COMMON.SH BOILERPLATE --- # --- END COMMON.SH BOILERPLATE ---
# Need to be inside the chroot to load chromeos-common.sh # Need to be inside the chroot to load chromeos-common.sh
assert_inside_chroot assert_inside_chroot
# Load functions and constants for chromeos-install # Load functions and constants for chromeos-install
. "/usr/lib/installer/chromeos-common.sh" || \ . /usr/lib/installer/chromeos-common.sh || exit 1
die "Unable to load /usr/lib/installer/chromeos-common.sh"
locate_gpt locate_gpt

View File

@ -12,20 +12,20 @@
# /usr/lib/crosutils. Outside the chroot we find it relative to the script's # /usr/lib/crosutils. Outside the chroot we find it relative to the script's
# location. # location.
find_common_sh() { find_common_sh() {
local common_paths=(/usr/lib/crosutils "$(dirname "$(readlink -f "$0")")/..") local common_paths=("$(dirname "$(readlink -f "$0")")/.." /usr/lib/crosutils)
local path local path
SCRIPT_ROOT= SCRIPT_ROOT="${common_paths[0]}"
for path in "${common_paths[@]}"; do for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then if [ -r "${path}/common.sh" ]; then
SCRIPT_ROOT=${path} SCRIPT_ROOT="${path}"
break break
fi fi
done done
} }
find_common_sh find_common_sh
. "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) . "${SCRIPT_ROOT}/common.sh" || exit 1
# --- END COMMON.SH BOILERPLATE --- # --- END COMMON.SH BOILERPLATE ---
die_notrace \ die_notrace \

View File

@ -7,7 +7,7 @@
# Helper script that generates the signed kernel image # Helper script that generates the signed kernel image
SCRIPT_ROOT=$(dirname $(readlink -f "$0")) SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; } . "${SCRIPT_ROOT}/common.sh" || exit 1
get_default_board get_default_board

View File

@ -9,7 +9,7 @@
# that were created within this chroot. # that were created within this chroot.
SCRIPT_ROOT=$(dirname $(readlink -f "$0")) SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1;} . "${SCRIPT_ROOT}/common.sh" || exit 1
# Script must be run inside the chroot. # Script must be run inside the chroot.
assert_inside_chroot assert_inside_chroot

View File

@ -10,7 +10,7 @@
# #
SCRIPT_ROOT=$(dirname $(readlink -f "$0")) SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; } . "${SCRIPT_ROOT}/common.sh" || exit 1
# Script must be run inside the chroot # Script must be run inside the chroot
restart_in_chroot_if_needed "$@" restart_in_chroot_if_needed "$@"

View File

@ -7,7 +7,7 @@
# Script to generate stackdumps from BVT failures. # Script to generate stackdumps from BVT failures.
# This can only run inside the chroot since we need minidump_stackwalk. # This can only run inside the chroot since we need minidump_stackwalk.
. "$(dirname $0)/common.sh" || { echo "Unable to load common.sh"; exit 1; } . "$(dirname $0)/common.sh" || exit 1
assert_inside_chroot "$@" assert_inside_chroot "$@"
usage() { usage() {

View File

@ -8,8 +8,8 @@
SCRIPT_ROOT=$(dirname $(readlink -f "$0")) SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; } . "${SCRIPT_ROOT}/common.sh" || exit 1
. "${SCRIPT_ROOT}/remote_access.sh" || die "Unable to load remote_access.sh" . "${SCRIPT_ROOT}/remote_access.sh" || exit 1
assert_inside_chroot assert_inside_chroot

View File

@ -7,7 +7,7 @@
# Prints the path to the most recently built image to stdout. # Prints the path to the most recently built image to stdout.
SCRIPT_ROOT=$(dirname $(readlink -f "$0")) SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; } . "${SCRIPT_ROOT}/common.sh" || exit 1
get_default_board get_default_board

View File

@ -8,7 +8,7 @@
# all packages depended on by chromeos and chromeos-dev. # all packages depended on by chromeos and chromeos-dev.
SCRIPT_ROOT=$(dirname $(readlink -f "$0")) SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; } . "${SCRIPT_ROOT}/common.sh" || exit 1
# Script must be run inside the chroot. # Script must be run inside the chroot.
assert_inside_chroot assert_inside_chroot

View File

@ -7,15 +7,14 @@
# Script to convert the output of build_image.sh to a usb or SD image. # Script to convert the output of build_image.sh to a usb or SD image.
SCRIPT_ROOT=$(dirname $(readlink -f "$0")) SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; } . "${SCRIPT_ROOT}/common.sh" || exit 1
# Load functions and constants for chromeos-install # Load functions and constants for chromeos-install
[ -f /usr/lib/installer/chromeos-common.sh ] && \ [ -f /usr/lib/installer/chromeos-common.sh ] && \
INSTALLER_ROOT=/usr/lib/installer || \ INSTALLER_ROOT=/usr/lib/installer || \
INSTALLER_ROOT=$(dirname "$(readlink -f "$0")") INSTALLER_ROOT=$(dirname "$(readlink -f "$0")")
. "${INSTALLER_ROOT}/chromeos-common.sh" || \ . "${INSTALLER_ROOT}/chromeos-common.sh" || exit 1
die "Unable to load chromeos-common.sh"
# In case chromeos-common.sh doesn't support MMC yet # In case chromeos-common.sh doesn't support MMC yet
declare -F list_mmc_disks >/dev/null || list_mmc_disks() { true; } declare -F list_mmc_disks >/dev/null || list_mmc_disks() { true; }

View File

@ -9,17 +9,14 @@
# Helper scripts should be run from the same location as this script. # Helper scripts should be run from the same location as this script.
SCRIPT_ROOT=$(dirname "$(readlink -f "$0")") SCRIPT_ROOT=$(dirname "$(readlink -f "$0")")
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; } . "${SCRIPT_ROOT}/common.sh" || exit 1
# Need to be inside the chroot to load chromeos-common.sh # Need to be inside the chroot to load chromeos-common.sh
assert_inside_chroot assert_inside_chroot
# Load functions and constants for chromeos-install # Load functions and constants for chromeos-install
. "/usr/lib/installer/chromeos-common.sh" || \ . /usr/lib/installer/chromeos-common.sh || exit 1
die "Unable to load /usr/lib/installer/chromeos-common.sh" . "${SCRIPT_ROOT}/lib/cros_vm_constants.sh" || exit 1
. "${SCRIPT_ROOT}/lib/cros_vm_constants.sh" || \
die "Unable to load ${SCRIPT_ROOT}/lib/cros_vm_constants.sh"
get_default_board get_default_board

View File

@ -13,7 +13,7 @@
# "netboot" subfolder. # "netboot" subfolder.
SCRIPT_ROOT=$(dirname $(readlink -f "$0")) SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; } . "${SCRIPT_ROOT}/common.sh" || exit 1
# Script must be run inside the chroot. # Script must be run inside the chroot.
restart_in_chroot_if_needed "$@" restart_in_chroot_if_needed "$@"

View File

@ -16,7 +16,7 @@
# Dbusspy-instrumented systems are only intended for narrow use cases, like # Dbusspy-instrumented systems are only intended for narrow use cases, like
# corpus collection for fuzzing, where the above trade-offs are acceptable. # corpus collection for fuzzing, where the above trade-offs are acceptable.
. "/usr/lib/crosutils/common.sh" || { echo "Unable to load common.sh"; exit 1; } . "$(dirname "$0")/common.sh" || exit 1
assert_inside_chroot assert_inside_chroot

View File

@ -7,7 +7,7 @@
# Script to modify a keyfob-based chromeos test image to install pyauto. # Script to modify a keyfob-based chromeos test image to install pyauto.
SCRIPT_ROOT=$(dirname $(readlink -f "$0")) SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; } . "${SCRIPT_ROOT}/common.sh" || exit 1
cleanup() { cleanup() {
"${SCRIPTS_DIR}/mount_gpt_image.sh" -u -r "$ROOT_FS_DIR" -s "$STATEFUL_FS_DIR" "${SCRIPTS_DIR}/mount_gpt_image.sh" -u -r "$ROOT_FS_DIR" -s "$STATEFUL_FS_DIR"

View File

@ -9,7 +9,7 @@
# Helper scripts should be run from the same location as this script. # Helper scripts should be run from the same location as this script.
SCRIPT_ROOT=$(dirname "$(readlink -f "$0")") SCRIPT_ROOT=$(dirname "$(readlink -f "$0")")
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; } . "${SCRIPT_ROOT}/common.sh" || exit 1
if [ $INSIDE_CHROOT -ne 1 ]; then if [ $INSIDE_CHROOT -ne 1 ]; then
INSTALL_ROOT="$SRC_ROOT/platform/installer/" INSTALL_ROOT="$SRC_ROOT/platform/installer/"
@ -17,8 +17,7 @@ else
INSTALL_ROOT=/usr/lib/installer/ INSTALL_ROOT=/usr/lib/installer/
fi fi
# Load functions and constants for chromeos-install # Load functions and constants for chromeos-install
. "${INSTALL_ROOT}/chromeos-common.sh" || \ . "${INSTALL_ROOT}/chromeos-common.sh" || exit 1
die "Unable to load ${INSTALL_ROOT}/chromeos-common.sh"
locate_gpt locate_gpt

View File

@ -7,7 +7,7 @@
# Load common CrOS utilities. Inside the chroot this file is installed in # 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 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's
# location. # location.
. "$(dirname "$0")/common.sh" || { echo "Unable to load common.sh"; exit 1; } . "$(dirname "$0")/common.sh" || exit 1
# Script must run inside the chroot. # Script must run inside the chroot.
assert_inside_chroot assert_inside_chroot

View File

@ -8,7 +8,7 @@
# password to a file inside chroot, for use by build_image. # password to a file inside chroot, for use by build_image.
# This can only run inside the chroot. # This can only run inside the chroot.
. "/usr/lib/crosutils/common.sh" || exit 1 . "$(dirname "$0")/common.sh" || exit 1
# Die on any errors. # Die on any errors.
switch_to_strict_mode switch_to_strict_mode

View File

@ -9,8 +9,8 @@
# scripts. # scripts.
SCRIPT_ROOT=$(dirname $(readlink -f "$0")) SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; } . "${SCRIPT_ROOT}/common.sh" || exit 1
. "${SCRIPT_ROOT}/remote_access.sh" || die "Unable to load remote_access.sh" . "${SCRIPT_ROOT}/remote_access.sh" || exit 1
cleanup() { cleanup() {
cleanup_remote_access cleanup_remote_access

View File

@ -6,7 +6,7 @@
# Start the Dev Server after making sure we are running under a chroot. # Start the Dev Server after making sure we are running under a chroot.
SCRIPT_ROOT=$(dirname $(readlink -f "$0")) SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; } . "${SCRIPT_ROOT}/common.sh" || exit 1
# Script must be run inside the chroot if not in 'always serve' mode. # Script must be run inside the chroot if not in 'always serve' mode.
if [[ "$1" != "--archive_dir" ]]; then if [[ "$1" != "--archive_dir" ]]; then

View File

@ -8,14 +8,13 @@
# It does not populate the templates, but can update a loop device. # It does not populate the templates, but can update a loop device.
SCRIPT_ROOT=$(dirname $(readlink -f "$0")) SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; } . "${SCRIPT_ROOT}/common.sh" || exit 1
# Need to be inside the chroot to load chromeos-common.sh # Need to be inside the chroot to load chromeos-common.sh
assert_inside_chroot assert_inside_chroot
# Load functions and constants for chromeos-install # Load functions and constants for chromeos-install
. "/usr/lib/installer/chromeos-common.sh" || \ . /usr/lib/installer/chromeos-common.sh || exit 1
die "Unable to load /usr/lib/installer/chromeos-common.sh"
get_default_board get_default_board

View File

@ -7,8 +7,8 @@
# Script to update the kernel on a live running ChromiumOS instance. # Script to update the kernel on a live running ChromiumOS instance.
SCRIPT_ROOT=$(dirname $(readlink -f "$0")) SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; } . "${SCRIPT_ROOT}/common.sh" || exit 1
. "${SCRIPT_ROOT}/remote_access.sh" . "${SCRIPT_ROOT}/remote_access.sh" || exit 1
# Script must be run inside the chroot. # Script must be run inside the chroot.
restart_in_chroot_if_needed "$@" restart_in_chroot_if_needed "$@"

View File

@ -9,7 +9,7 @@
# to only upload the symbols for those executables involved). # to only upload the symbols for those executables involved).
SCRIPT_ROOT=$(dirname $(readlink -f "$0")) SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; } . "${SCRIPT_ROOT}/common.sh" || exit 1
# Script must be run inside the chroot if not in "testing" mode. # Script must be run inside the chroot if not in "testing" mode.
if [[ "$1" != "--testing" ]]; then if [[ "$1" != "--testing" ]]; then

View File

@ -7,15 +7,14 @@
# Script to verify integrity of root file system for a GPT-based image # Script to verify integrity of root file system for a GPT-based image
SCRIPT_ROOT=$(dirname $(readlink -f "$0")) SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; } . "${SCRIPT_ROOT}/common.sh" || exit 1
# Load functions and constants for chromeos-install # Load functions and constants for chromeos-install
[ -f /usr/lib/installer/chromeos-common.sh ] && \ [ -f /usr/lib/installer/chromeos-common.sh ] && \
INSTALLER_ROOT=/usr/lib/installer || \ INSTALLER_ROOT=/usr/lib/installer || \
INSTALLER_ROOT=$(dirname "$(readlink -f "$0")") INSTALLER_ROOT=$(dirname "$(readlink -f "$0")")
. "${INSTALLER_ROOT}/chromeos-common.sh" || \ . "${INSTALLER_ROOT}/chromeos-common.sh" || exit 1
die "Unable to load chromeos-common.sh"
# Needed for partoffset and partsize calls # Needed for partoffset and partsize calls
locate_gpt locate_gpt