From 359d3e119d22f603bdf2aaeac190a017d78cf3a7 Mon Sep 17 00:00:00 2001 From: David James Date: Tue, 10 Jul 2012 13:09:48 -0700 Subject: [PATCH] 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 Tested-by: David James Commit-Ready: David James --- archive_hwqual | 8 +------- bin/cros_download_latest_image | 8 ++++---- bin/cros_get_chrome_version | 10 +++++----- bin/cros_make_image_bootable | 13 ++++++------- bin/cros_package_to_live | 10 +++++----- bin/cros_resign_image.sh | 11 +++++------ bin/cros_run_cell_tests.sh | 8 ++++---- bin/cros_run_wifi_tests.sh | 8 ++++---- bin/cros_sign_to_ssd | 11 +++++------ bin/cros_workon_make | 8 ++++---- build_kernel_image.sh | 2 +- clean_loopback_devices | 2 +- cros_generate_breakpad_symbols | 2 +- cros_generate_stacks_bvt | 2 +- cros_show_stacks | 4 ++-- get_latest_image.sh | 2 +- get_package_list | 2 +- image_to_usb.sh | 5 ++--- image_to_vm.sh | 9 +++------ make_netboot.sh | 2 +- mod_test_image_for_dbusspy.sh | 2 +- mod_test_image_for_pyauto.sh | 2 +- mount_gpt_image.sh | 5 ++--- run_chroot_version_hooks | 2 +- set_shared_user_password.sh | 2 +- ssh_test.sh | 4 ++-- start_devserver | 2 +- update_bootloaders.sh | 5 ++--- update_kernel.sh | 4 ++-- upload_symbols | 2 +- verify_rootfs_chksum.sh | 5 ++--- 31 files changed, 73 insertions(+), 89 deletions(-) diff --git a/archive_hwqual b/archive_hwqual index bb11c9a41d..5e2aac90b6 100755 --- a/archive_hwqual +++ b/archive_hwqual @@ -6,14 +6,8 @@ # 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}/common.sh" || { echo "Unable to load common.sh"; exit 1; } -# --- END COMMON.SH BOILERPLATE --- +. "${SCRIPT_ROOT}/common.sh" || exit 1 # Flags DEFINE_string from "" "Directory with build archive (zipname)" diff --git a/bin/cros_download_latest_image b/bin/cros_download_latest_image index c0ac6e8790..e2cd0f4b4f 100755 --- a/bin/cros_download_latest_image +++ b/bin/cros_download_latest_image @@ -12,20 +12,20 @@ # /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=("$(dirname "$(readlink -f "$0")")/.." /usr/lib/crosutils) local path - SCRIPT_ROOT= + SCRIPT_ROOT="${common_paths[0]}" for path in "${common_paths[@]}"; do if [ -r "${path}/common.sh" ]; then - SCRIPT_ROOT=${path} + SCRIPT_ROOT="${path}" break fi done } 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 --- get_default_board diff --git a/bin/cros_get_chrome_version b/bin/cros_get_chrome_version index e5c9467909..80267c5528 100755 --- a/bin/cros_get_chrome_version +++ b/bin/cros_get_chrome_version @@ -11,23 +11,23 @@ # /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=("$(dirname "$(readlink -f "$0")")/.." /usr/lib/crosutils) local path - SCRIPT_ROOT= + SCRIPT_ROOT="${common_paths[0]}" for path in "${common_paths[@]}"; do if [ -r "${path}/common.sh" ]; then - SCRIPT_ROOT=${path} + SCRIPT_ROOT="${path}" break fi done } 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 --- -. "${SCRIPT_ROOT}/remote_access.sh" || die "Unable to load remote_access.sh" +. "${SCRIPT_ROOT}/remote_access.sh" || exit 1 FLAGS "$@" || exit 1 diff --git a/bin/cros_make_image_bootable b/bin/cros_make_image_bootable index c538a094ad..d0c877aed3 100755 --- a/bin/cros_make_image_bootable +++ b/bin/cros_make_image_bootable @@ -12,29 +12,28 @@ # /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=("$(dirname "$(readlink -f "$0")")/.." /usr/lib/crosutils) local path - SCRIPT_ROOT= + SCRIPT_ROOT="${common_paths[0]}" for path in "${common_paths[@]}"; do if [ -r "${path}/common.sh" ]; then - SCRIPT_ROOT=${path} + SCRIPT_ROOT="${path}" break fi done } 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 --- # 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" || \ - die "Unable to load /usr/lib/installer/chromeos-common.sh" -. "${SCRIPTS_DIR}/build_library/build_image_util.sh" || die "No build_image_util" +. /usr/lib/installer/chromeos-common.sh || exit 1 +. "${SCRIPTS_DIR}/build_library/build_image_util.sh" || exit 1 switch_to_strict_mode diff --git a/bin/cros_package_to_live b/bin/cros_package_to_live index 7f9b4b9bec..09288f0b5d 100755 --- a/bin/cros_package_to_live +++ b/bin/cros_package_to_live @@ -12,23 +12,23 @@ # /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=("$(dirname "$(readlink -f "$0")")/.." /usr/lib/crosutils) local path - SCRIPT_ROOT= + SCRIPT_ROOT="${common_paths[0]}" for path in "${common_paths[@]}"; do if [ -r "${path}/common.sh" ]; then - SCRIPT_ROOT=${path} + SCRIPT_ROOT="${path}" break fi done } 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 --- -. "${SCRIPT_ROOT}/remote_access.sh" || die "Unable to load remote_access.sh" +. "${SCRIPT_ROOT}/remote_access.sh" || exit 1 get_default_board diff --git a/bin/cros_resign_image.sh b/bin/cros_resign_image.sh index 21f76553fd..8f957894df 100755 --- a/bin/cros_resign_image.sh +++ b/bin/cros_resign_image.sh @@ -12,28 +12,27 @@ # /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=("$(dirname "$(readlink -f "$0")")/.." /usr/lib/crosutils) local path - SCRIPT_ROOT= + SCRIPT_ROOT="${common_paths[0]}" for path in "${common_paths[@]}"; do if [ -r "${path}/common.sh" ]; then - SCRIPT_ROOT=${path} + SCRIPT_ROOT="${path}" break fi done } 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 --- # 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" || \ - die "Unable to load /usr/lib/installer/chromeos-common.sh" +. /usr/lib/installer/chromeos-common.sh || exit 1 locate_gpt diff --git a/bin/cros_run_cell_tests.sh b/bin/cros_run_cell_tests.sh index 91e0700e55..b6924d7bf6 100755 --- a/bin/cros_run_cell_tests.sh +++ b/bin/cros_run_cell_tests.sh @@ -14,20 +14,20 @@ # /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=("$(dirname "$(readlink -f "$0")")/.." /usr/lib/crosutils) local path - SCRIPT_ROOT= + SCRIPT_ROOT="${common_paths[0]}" for path in "${common_paths[@]}"; do if [ -r "${path}/common.sh" ]; then - SCRIPT_ROOT=${path} + SCRIPT_ROOT="${path}" break fi done } 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 --- # Figure out the default chromelab server name. In order for this to diff --git a/bin/cros_run_wifi_tests.sh b/bin/cros_run_wifi_tests.sh index 840a00e01c..d674d44a08 100755 --- a/bin/cros_run_wifi_tests.sh +++ b/bin/cros_run_wifi_tests.sh @@ -12,20 +12,20 @@ # /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=("$(dirname "$(readlink -f "$0")")/.." /usr/lib/crosutils) local path - SCRIPT_ROOT= + SCRIPT_ROOT="${common_paths[0]}" for path in "${common_paths[@]}"; do if [ -r "${path}/common.sh" ]; then - SCRIPT_ROOT=${path} + SCRIPT_ROOT="${path}" break fi done } 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 --- # Figure out the default chromelab server name. In order for this to diff --git a/bin/cros_sign_to_ssd b/bin/cros_sign_to_ssd index dfd9d7301d..2b3a9c4416 100755 --- a/bin/cros_sign_to_ssd +++ b/bin/cros_sign_to_ssd @@ -12,28 +12,27 @@ # /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=("$(dirname "$(readlink -f "$0")")/.." /usr/lib/crosutils) local path - SCRIPT_ROOT= + SCRIPT_ROOT="${common_paths[0]}" for path in "${common_paths[@]}"; do if [ -r "${path}/common.sh" ]; then - SCRIPT_ROOT=${path} + SCRIPT_ROOT="${path}" break fi done } 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 --- # 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" || \ - die "Unable to load /usr/lib/installer/chromeos-common.sh" +. /usr/lib/installer/chromeos-common.sh || exit 1 locate_gpt diff --git a/bin/cros_workon_make b/bin/cros_workon_make index 9bed17cd6f..bf47de2627 100755 --- a/bin/cros_workon_make +++ b/bin/cros_workon_make @@ -12,20 +12,20 @@ # /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=("$(dirname "$(readlink -f "$0")")/.." /usr/lib/crosutils) local path - SCRIPT_ROOT= + SCRIPT_ROOT="${common_paths[0]}" for path in "${common_paths[@]}"; do if [ -r "${path}/common.sh" ]; then - SCRIPT_ROOT=${path} + SCRIPT_ROOT="${path}" break fi done } 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 --- die_notrace \ diff --git a/build_kernel_image.sh b/build_kernel_image.sh index 33bac8d03d..af53c817fc 100755 --- a/build_kernel_image.sh +++ b/build_kernel_image.sh @@ -7,7 +7,7 @@ # Helper script that generates the signed kernel image 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 diff --git a/clean_loopback_devices b/clean_loopback_devices index d8ab5811b8..1e774cb23c 100755 --- a/clean_loopback_devices +++ b/clean_loopback_devices @@ -9,7 +9,7 @@ # that were created within this chroot. 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. assert_inside_chroot diff --git a/cros_generate_breakpad_symbols b/cros_generate_breakpad_symbols index 249d03c0ea..df3b17d875 100755 --- a/cros_generate_breakpad_symbols +++ b/cros_generate_breakpad_symbols @@ -10,7 +10,7 @@ # 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 restart_in_chroot_if_needed "$@" diff --git a/cros_generate_stacks_bvt b/cros_generate_stacks_bvt index 21d061344d..5e6f112ab8 100755 --- a/cros_generate_stacks_bvt +++ b/cros_generate_stacks_bvt @@ -7,7 +7,7 @@ # Script to generate stackdumps from BVT failures. # 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 "$@" usage() { diff --git a/cros_show_stacks b/cros_show_stacks index c60ff3e241..5a155dc4cb 100755 --- a/cros_show_stacks +++ b/cros_show_stacks @@ -8,8 +8,8 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0")) -. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; } -. "${SCRIPT_ROOT}/remote_access.sh" || die "Unable to load remote_access.sh" +. "${SCRIPT_ROOT}/common.sh" || exit 1 +. "${SCRIPT_ROOT}/remote_access.sh" || exit 1 assert_inside_chroot diff --git a/get_latest_image.sh b/get_latest_image.sh index 7829a1f201..a7ddee57cc 100755 --- a/get_latest_image.sh +++ b/get_latest_image.sh @@ -7,7 +7,7 @@ # Prints the path to the most recently built image to stdout. 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 diff --git a/get_package_list b/get_package_list index d5d48cfbe7..84149bb81c 100755 --- a/get_package_list +++ b/get_package_list @@ -8,7 +8,7 @@ # all packages depended on by chromeos and chromeos-dev. 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. assert_inside_chroot diff --git a/image_to_usb.sh b/image_to_usb.sh index 7d61545744..e4a58a8835 100755 --- a/image_to_usb.sh +++ b/image_to_usb.sh @@ -7,15 +7,14 @@ # Script to convert the output of build_image.sh to a usb or SD image. 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 [ -f /usr/lib/installer/chromeos-common.sh ] && \ INSTALLER_ROOT=/usr/lib/installer || \ INSTALLER_ROOT=$(dirname "$(readlink -f "$0")") -. "${INSTALLER_ROOT}/chromeos-common.sh" || \ - die "Unable to load chromeos-common.sh" +. "${INSTALLER_ROOT}/chromeos-common.sh" || exit 1 # In case chromeos-common.sh doesn't support MMC yet declare -F list_mmc_disks >/dev/null || list_mmc_disks() { true; } diff --git a/image_to_vm.sh b/image_to_vm.sh index ab5466e733..6ebc0aefa4 100755 --- a/image_to_vm.sh +++ b/image_to_vm.sh @@ -9,17 +9,14 @@ # Helper scripts should be run from the same location as this script. 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 assert_inside_chroot # Load functions and constants for chromeos-install -. "/usr/lib/installer/chromeos-common.sh" || \ - die "Unable to load /usr/lib/installer/chromeos-common.sh" - -. "${SCRIPT_ROOT}/lib/cros_vm_constants.sh" || \ - die "Unable to load ${SCRIPT_ROOT}/lib/cros_vm_constants.sh" +. /usr/lib/installer/chromeos-common.sh || exit 1 +. "${SCRIPT_ROOT}/lib/cros_vm_constants.sh" || exit 1 get_default_board diff --git a/make_netboot.sh b/make_netboot.sh index 38d87cc401..07e26237d2 100755 --- a/make_netboot.sh +++ b/make_netboot.sh @@ -13,7 +13,7 @@ # "netboot" subfolder. 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. restart_in_chroot_if_needed "$@" diff --git a/mod_test_image_for_dbusspy.sh b/mod_test_image_for_dbusspy.sh index 80a9cc75b2..8ec6b77e84 100755 --- a/mod_test_image_for_dbusspy.sh +++ b/mod_test_image_for_dbusspy.sh @@ -16,7 +16,7 @@ # Dbusspy-instrumented systems are only intended for narrow use cases, like # 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 diff --git a/mod_test_image_for_pyauto.sh b/mod_test_image_for_pyauto.sh index 6afc26a3de..b30648bf2e 100644 --- a/mod_test_image_for_pyauto.sh +++ b/mod_test_image_for_pyauto.sh @@ -7,7 +7,7 @@ # Script to modify a keyfob-based chromeos test image to install pyauto. 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() { "${SCRIPTS_DIR}/mount_gpt_image.sh" -u -r "$ROOT_FS_DIR" -s "$STATEFUL_FS_DIR" diff --git a/mount_gpt_image.sh b/mount_gpt_image.sh index b8a0e21cff..9cd8563161 100755 --- a/mount_gpt_image.sh +++ b/mount_gpt_image.sh @@ -9,7 +9,7 @@ # Helper scripts should be run from the same location as this script. 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 INSTALL_ROOT="$SRC_ROOT/platform/installer/" @@ -17,8 +17,7 @@ else INSTALL_ROOT=/usr/lib/installer/ fi # Load functions and constants for chromeos-install -. "${INSTALL_ROOT}/chromeos-common.sh" || \ - die "Unable to load ${INSTALL_ROOT}/chromeos-common.sh" +. "${INSTALL_ROOT}/chromeos-common.sh" || exit 1 locate_gpt diff --git a/run_chroot_version_hooks b/run_chroot_version_hooks index c9c92b81ec..d62f706ef6 100755 --- a/run_chroot_version_hooks +++ b/run_chroot_version_hooks @@ -7,7 +7,7 @@ # 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. -. "$(dirname "$0")/common.sh" || { echo "Unable to load common.sh"; exit 1; } +. "$(dirname "$0")/common.sh" || exit 1 # Script must run inside the chroot. assert_inside_chroot diff --git a/set_shared_user_password.sh b/set_shared_user_password.sh index 8df7dc7c59..acc2c8a660 100755 --- a/set_shared_user_password.sh +++ b/set_shared_user_password.sh @@ -8,7 +8,7 @@ # password to a file inside chroot, for use by build_image. # This can only run inside the chroot. -. "/usr/lib/crosutils/common.sh" || exit 1 +. "$(dirname "$0")/common.sh" || exit 1 # Die on any errors. switch_to_strict_mode diff --git a/ssh_test.sh b/ssh_test.sh index 1178699ae7..5077600bdf 100755 --- a/ssh_test.sh +++ b/ssh_test.sh @@ -9,8 +9,8 @@ # scripts. SCRIPT_ROOT=$(dirname $(readlink -f "$0")) -. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; } -. "${SCRIPT_ROOT}/remote_access.sh" || die "Unable to load remote_access.sh" +. "${SCRIPT_ROOT}/common.sh" || exit 1 +. "${SCRIPT_ROOT}/remote_access.sh" || exit 1 cleanup() { cleanup_remote_access diff --git a/start_devserver b/start_devserver index 2feee177d1..0ab19bb757 100755 --- a/start_devserver +++ b/start_devserver @@ -6,7 +6,7 @@ # Start the Dev Server after making sure we are running under a chroot. 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. if [[ "$1" != "--archive_dir" ]]; then diff --git a/update_bootloaders.sh b/update_bootloaders.sh index 681f4935eb..1bb5155713 100755 --- a/update_bootloaders.sh +++ b/update_bootloaders.sh @@ -8,14 +8,13 @@ # It does not populate the templates, but can update a loop device. 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 assert_inside_chroot # Load functions and constants for chromeos-install -. "/usr/lib/installer/chromeos-common.sh" || \ - die "Unable to load /usr/lib/installer/chromeos-common.sh" +. /usr/lib/installer/chromeos-common.sh || exit 1 get_default_board diff --git a/update_kernel.sh b/update_kernel.sh index bad1d802a5..65323f0b95 100755 --- a/update_kernel.sh +++ b/update_kernel.sh @@ -7,8 +7,8 @@ # Script to update the kernel on a live running ChromiumOS instance. SCRIPT_ROOT=$(dirname $(readlink -f "$0")) -. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; } -. "${SCRIPT_ROOT}/remote_access.sh" +. "${SCRIPT_ROOT}/common.sh" || exit 1 +. "${SCRIPT_ROOT}/remote_access.sh" || exit 1 # Script must be run inside the chroot. restart_in_chroot_if_needed "$@" diff --git a/upload_symbols b/upload_symbols index 038cfa63ae..982a3e8f0f 100755 --- a/upload_symbols +++ b/upload_symbols @@ -9,7 +9,7 @@ # to only upload the symbols for those executables involved). 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. if [[ "$1" != "--testing" ]]; then diff --git a/verify_rootfs_chksum.sh b/verify_rootfs_chksum.sh index 6921bfc0ce..0246c1ece2 100755 --- a/verify_rootfs_chksum.sh +++ b/verify_rootfs_chksum.sh @@ -7,15 +7,14 @@ # Script to verify integrity of root file system for a GPT-based image 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 [ -f /usr/lib/installer/chromeos-common.sh ] && \ INSTALLER_ROOT=/usr/lib/installer || \ INSTALLER_ROOT=$(dirname "$(readlink -f "$0")") -. "${INSTALLER_ROOT}/chromeos-common.sh" || \ - die "Unable to load chromeos-common.sh" +. "${INSTALLER_ROOT}/chromeos-common.sh" || exit 1 # Needed for partoffset and partsize calls locate_gpt