mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-08 05:26:58 +02:00
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:
parent
dee866c121
commit
aa13ea4658
@ -10,20 +10,8 @@
|
||||
# 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=$(dirname $(readlink -f "$0"))
|
||||
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; }
|
||||
# --- END COMMON.SH BOILERPLATE ---
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
# the given target's root with binary packages turned on. This script will
|
||||
# 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
|
||||
|
||||
|
||||
|
@ -6,26 +6,8 @@
|
||||
|
||||
# Helper script that generates the signed kernel image
|
||||
|
||||
# --- 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=$(dirname $(readlink -f "$0"))
|
||||
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; }
|
||||
# --- END COMMON.SH BOILERPLATE ---
|
||||
|
||||
get_default_board
|
||||
|
||||
|
@ -8,26 +8,8 @@
|
||||
# failures. This script only affects mountpoints and loopback devices
|
||||
# that were created within this chroot.
|
||||
|
||||
# --- 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=$(dirname $(readlink -f "$0"))
|
||||
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1;}
|
||||
# --- END COMMON.SH BOILERPLATE ---
|
||||
|
||||
# Script must be run inside the chroot.
|
||||
assert_inside_chroot
|
||||
|
@ -9,26 +9,8 @@
|
||||
# NOTE: This script must be run from the chromeos build chroot environment.
|
||||
#
|
||||
|
||||
# --- 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=$(dirname $(readlink -f "$0"))
|
||||
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; }
|
||||
# --- END COMMON.SH BOILERPLATE ---
|
||||
|
||||
# Script must be run inside the chroot
|
||||
restart_in_chroot_if_needed "$@"
|
||||
|
@ -6,27 +6,9 @@
|
||||
|
||||
# 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=
|
||||
for path in "${common_paths[@]}"; do
|
||||
if [ -r "${path}/common.sh" ]; then
|
||||
SCRIPT_ROOT=${path}
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
find_common_sh
|
||||
SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
|
||||
. "${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"
|
||||
|
||||
assert_inside_chroot
|
||||
|
@ -6,26 +6,8 @@
|
||||
|
||||
# Prints the path to the most recently built image to stdout.
|
||||
|
||||
# --- 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=$(dirname $(readlink -f "$0"))
|
||||
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; }
|
||||
# --- END COMMON.SH BOILERPLATE ---
|
||||
|
||||
get_default_board
|
||||
|
||||
|
@ -7,26 +7,8 @@
|
||||
# Lists all package dependencies of a particular package. Useful to find out
|
||||
# all packages depended on by chromeos and chromeos-dev.
|
||||
|
||||
# --- 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=$(dirname $(readlink -f "$0"))
|
||||
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; }
|
||||
# --- END COMMON.SH BOILERPLATE ---
|
||||
|
||||
# Script must be run inside the chroot.
|
||||
assert_inside_chroot
|
||||
|
@ -6,26 +6,8 @@
|
||||
|
||||
# Script to convert the output of build_image.sh to a usb or SD image.
|
||||
|
||||
# --- 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=$(dirname $(readlink -f "$0"))
|
||||
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; }
|
||||
# --- END COMMON.SH BOILERPLATE ---
|
||||
|
||||
# Load functions and constants for chromeos-install
|
||||
[ -f /usr/lib/installer/chromeos-common.sh ] && \
|
||||
|
@ -12,29 +12,9 @@
|
||||
# shim kernel image, bundled as a uboot gz/uimg, and places them in a
|
||||
# "netboot" subfolder.
|
||||
|
||||
# This script is intended to be called mainly form archive_build.sh, where
|
||||
# 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=$(dirname $(readlink -f "$0"))
|
||||
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; }
|
||||
# --- END COMMON.SH BOILERPLATE ---
|
||||
|
||||
# Script must be run inside the chroot.
|
||||
restart_in_chroot_if_needed "$@"
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
# kernel. Alternatively, a signed recovery kernel can be used to
|
||||
# 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
|
||||
|
||||
# Default recovery kernel name.
|
||||
|
@ -15,7 +15,7 @@
|
||||
#
|
||||
# TODO(vlaviano): delete this script.
|
||||
|
||||
SCRIPT_ROOT=$(dirname "$0")
|
||||
SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
|
||||
. "${SCRIPT_ROOT}/build_library/build_common.sh" || exit 1
|
||||
|
||||
|
||||
|
@ -6,30 +6,13 @@
|
||||
|
||||
# Script to modify a keyfob-based chromeos test image to install pyauto.
|
||||
|
||||
# --- 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
|
||||
}
|
||||
SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
|
||||
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; }
|
||||
|
||||
cleanup() {
|
||||
"${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
|
||||
assert_inside_chroot
|
||||
|
21
ssh_test.sh
21
ssh_test.sh
@ -8,27 +8,8 @@
|
||||
# a code of 0 if successful and non-zero otherwise. Used by test infrastructure
|
||||
# scripts.
|
||||
|
||||
# --- 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=$(dirname $(readlink -f "$0"))
|
||||
. "${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"
|
||||
|
||||
function cleanup {
|
||||
|
@ -5,26 +5,8 @@
|
||||
|
||||
# Start the Dev Server after making sure we are running under a chroot.
|
||||
|
||||
# --- 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=$(dirname $(readlink -f "$0"))
|
||||
. "${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.
|
||||
if [[ "$1" != "--archive_dir" ]]; then
|
||||
|
@ -7,26 +7,8 @@
|
||||
# Helper script that generates the legacy/efi bootloader partitions.
|
||||
# It does not populate the templates, but can update a loop device.
|
||||
|
||||
# --- 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=$(dirname $(readlink -f "$0"))
|
||||
. "${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
|
||||
|
@ -6,27 +6,8 @@
|
||||
|
||||
# Script to update the kernel on a live running ChromiumOS instance.
|
||||
|
||||
# --- 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=$(dirname $(readlink -f "$0"))
|
||||
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; }
|
||||
# --- END COMMON.SH BOILERPLATE ---
|
||||
|
||||
. "${SCRIPT_ROOT}/remote_access.sh"
|
||||
|
||||
# Script must be run inside the chroot.
|
||||
|
@ -8,26 +8,8 @@
|
||||
# symbols or to debug crashes on non-release builds (in which case try
|
||||
# to only upload the symbols for those executables involved).
|
||||
|
||||
# --- 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=$(dirname $(readlink -f "$0"))
|
||||
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; }
|
||||
# --- END COMMON.SH BOILERPLATE ---
|
||||
|
||||
# Script must be run inside the chroot
|
||||
restart_in_chroot_if_needed "$@"
|
||||
|
@ -6,26 +6,8 @@
|
||||
|
||||
# Script to verify integrity of root file system for a GPT-based image
|
||||
|
||||
# --- 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=$(dirname $(readlink -f "$0"))
|
||||
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; }
|
||||
# --- END COMMON.SH BOILERPLATE ---
|
||||
|
||||
# Load functions and constants for chromeos-install
|
||||
[ -f /usr/lib/installer/chromeos-common.sh ] && \
|
||||
|
Loading…
Reference in New Issue
Block a user