Shift crosutils scripts to use the common.sh they were written against.

Rather than trying to use an old/stale common.sh, use the common.sh
from the invocation point- if invoked via /usr/lib/crosutils, use that
common.sh.  If invoked via src/scripts/, use that, etc.

Trying to intermix it just introduces potential for bugs and invalidly
freezes common.sh api, thus the efforts to revert this and ultimately
revert the existing of a crosutils ebuild.

BUG=chromium-os:27201
TEST=cbuildbot x86-generic-full

Change-Id: I4c6c5fbade3d28c71752bd4c44dccad49af52ec0
Reviewed-on: https://gerrit.chromium.org/gerrit/18303
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
This commit is contained in:
Brian Harring 2012-03-15 18:31:03 -07:00 committed by Gerrit
parent dee866c121
commit aa13ea4658
19 changed files with 21 additions and 306 deletions

View File

@ -10,20 +10,8 @@
# 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.
find_common_sh() {
local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")"))
local path
SCRIPT_ROOT= SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
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" || { echo "Unable to load common.sh"; exit 1; }
# --- END COMMON.SH BOILERPLATE --- # --- END COMMON.SH BOILERPLATE ---

View File

@ -9,7 +9,7 @@
# the given target's root with binary packages turned on. This script will # the given target's root with binary packages turned on. This script will
# build the Chrome OS image using only pre-built binary packages. # build the Chrome OS image using only pre-built binary packages.
SCRIPT_ROOT=$(dirname "$0") SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/build_library/build_common.sh" || exit 1 . "${SCRIPT_ROOT}/build_library/build_common.sh" || exit 1

View File

@ -6,26 +6,8 @@
# Helper script that generates the signed kernel image # Helper script that generates the signed kernel image
# --- BEGIN COMMON.SH BOILERPLATE --- SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
# 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 path
SCRIPT_ROOT=
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
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" || { echo "Unable to load common.sh"; exit 1; }
# --- END COMMON.SH BOILERPLATE ---
get_default_board get_default_board

View File

@ -8,26 +8,8 @@
# failures. This script only affects mountpoints and loopback devices # failures. This script only affects mountpoints and loopback devices
# that were created within this chroot. # that were created within this chroot.
# --- BEGIN COMMON.SH BOILERPLATE --- SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
# 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 path
SCRIPT_ROOT=
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
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" || { echo "Unable to load common.sh"; exit 1;}
# --- END COMMON.SH BOILERPLATE ---
# Script must be run inside the chroot. # Script must be run inside the chroot.
assert_inside_chroot assert_inside_chroot

View File

@ -9,26 +9,8 @@
# NOTE: This script must be run from the chromeos build chroot environment. # NOTE: This script must be run from the chromeos build chroot environment.
# #
# --- BEGIN COMMON.SH BOILERPLATE --- SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
# 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 path
SCRIPT_ROOT=
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
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" || { echo "Unable to load common.sh"; exit 1; }
# --- END COMMON.SH BOILERPLATE ---
# 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

@ -6,27 +6,9 @@
# Script to generate stackdumps from a machine or dmp files. # Script to generate stackdumps from a machine or dmp files.
# --- 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 path
SCRIPT_ROOT= SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
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" || { echo "Unable to load 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" || die "Unable to load remote_access.sh"
assert_inside_chroot assert_inside_chroot

View File

@ -6,26 +6,8 @@
# Prints the path to the most recently built image to stdout. # Prints the path to the most recently built image to stdout.
# --- BEGIN COMMON.SH BOILERPLATE --- SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
# 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 path
SCRIPT_ROOT=
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
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" || { echo "Unable to load common.sh"; exit 1; }
# --- END COMMON.SH BOILERPLATE ---
get_default_board get_default_board

View File

@ -7,26 +7,8 @@
# Lists all package dependencies of a particular package. Useful to find out # Lists all package dependencies of a particular package. Useful to find out
# all packages depended on by chromeos and chromeos-dev. # all packages depended on by chromeos and chromeos-dev.
# --- BEGIN COMMON.SH BOILERPLATE --- SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
# 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 path
SCRIPT_ROOT=
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
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" || { echo "Unable to load common.sh"; exit 1; }
# --- END COMMON.SH BOILERPLATE ---
# Script must be run inside the chroot. # Script must be run inside the chroot.
assert_inside_chroot assert_inside_chroot

View File

@ -6,26 +6,8 @@
# 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.
# --- BEGIN COMMON.SH BOILERPLATE --- SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
# 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 path
SCRIPT_ROOT=
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
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" || { echo "Unable to load common.sh"; exit 1; }
# --- END COMMON.SH BOILERPLATE ---
# 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 ] && \

View File

@ -12,29 +12,9 @@
# shim kernel image, bundled as a uboot gz/uimg, and places them in a # shim kernel image, bundled as a uboot gz/uimg, and places them in a
# "netboot" subfolder. # "netboot" subfolder.
# This script is intended to be called mainly form archive_build.sh, where SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
# these files are added to the factory install artifacts generated on buildbot.
# --- 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 path
SCRIPT_ROOT=
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
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" || { echo "Unable to load common.sh"; exit 1; }
# --- END COMMON.SH BOILERPLATE ---
# 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 @@
# kernel. Alternatively, a signed recovery kernel can be used to # kernel. Alternatively, a signed recovery kernel can be used to
# create a Chromium OS recovery image. # create a Chromium OS recovery image.
SCRIPT_ROOT=$(dirname "$0") SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/build_library/build_common.sh" || exit 1 . "${SCRIPT_ROOT}/build_library/build_common.sh" || exit 1
# Default recovery kernel name. # Default recovery kernel name.

View File

@ -15,7 +15,7 @@
# #
# TODO(vlaviano): delete this script. # TODO(vlaviano): delete this script.
SCRIPT_ROOT=$(dirname "$0") SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/build_library/build_common.sh" || exit 1 . "${SCRIPT_ROOT}/build_library/build_common.sh" || exit 1

View File

@ -6,30 +6,13 @@
# Script to modify a keyfob-based chromeos test image to install pyauto. # Script to modify a keyfob-based chromeos test image to install pyauto.
# --- BEGIN COMMON.SH BOILERPLATE --- SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
# Load common CrOS utilities. Inside the chroot this file is installed in . "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; }
# /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 path
SCRIPT_ROOT=
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
SCRIPT_ROOT=${path}
break
fi
done
}
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"
} }
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 # Need to be inside the chroot to load chromeos-common.sh
assert_inside_chroot assert_inside_chroot

View File

@ -8,27 +8,8 @@
# a code of 0 if successful and non-zero otherwise. Used by test infrastructure # a code of 0 if successful and non-zero otherwise. Used by test infrastructure
# scripts. # scripts.
# --- BEGIN COMMON.SH BOILERPLATE --- SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
# 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 path
SCRIPT_ROOT=
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
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" || { echo "Unable to load 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" || die "Unable to load remote_access.sh"
function cleanup { function cleanup {

View File

@ -5,26 +5,8 @@
# 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.
# --- BEGIN COMMON.SH BOILERPLATE --- SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
# 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 path
SCRIPT_ROOT=
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
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" || { echo "Unable to load common.sh"; exit 1; }
# --- END COMMON.SH BOILERPLATE ---
# 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

@ -7,26 +7,8 @@
# Helper script that generates the legacy/efi bootloader partitions. # Helper script that generates the legacy/efi bootloader partitions.
# It does not populate the templates, but can update a loop device. # It does not populate the templates, but can update a loop device.
# --- BEGIN COMMON.SH BOILERPLATE --- SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
# 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 path
SCRIPT_ROOT=
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
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" || { echo "Unable to load common.sh"; exit 1; }
# --- 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

View File

@ -6,27 +6,8 @@
# Script to update the kernel on a live running ChromiumOS instance. # Script to update the kernel on a live running ChromiumOS instance.
# --- BEGIN COMMON.SH BOILERPLATE --- SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
# 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 path
SCRIPT_ROOT=
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
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" || { echo "Unable to load common.sh"; exit 1; }
# --- END COMMON.SH BOILERPLATE ---
. "${SCRIPT_ROOT}/remote_access.sh" . "${SCRIPT_ROOT}/remote_access.sh"
# Script must be run inside the chroot. # Script must be run inside the chroot.

View File

@ -8,26 +8,8 @@
# symbols or to debug crashes on non-release builds (in which case try # symbols or to debug crashes on non-release builds (in which case try
# to only upload the symbols for those executables involved). # to only upload the symbols for those executables involved).
# --- BEGIN COMMON.SH BOILERPLATE --- SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
# 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 path
SCRIPT_ROOT=
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
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" || { echo "Unable to load common.sh"; exit 1; }
# --- END COMMON.SH BOILERPLATE ---
# 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

@ -6,26 +6,8 @@
# 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
# --- BEGIN COMMON.SH BOILERPLATE --- SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
# 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 path
SCRIPT_ROOT=
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
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" || { echo "Unable to load common.sh"; exit 1; }
# --- END COMMON.SH BOILERPLATE ---
# 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 ] && \