Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(806)

Unified Diff: sync_build_test.sh

Issue 6240018: This starts to fix the scripts so that they load from /usr/lib/crosutils (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: fixing bad merge Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « start_devserver ('k') | test_image » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync_build_test.sh
diff --git a/sync_build_test.sh b/sync_build_test.sh
index 72585087dadf7c27110b3b9f0b8528b4ee3c15d8..b7dad2747e46aa128d5bba69320e6d12cb153e53 100755
--- a/sync_build_test.sh
+++ b/sync_build_test.sh
@@ -41,11 +41,28 @@
# CHRONOS_PASSWD - default value for --chronos_passwd
#
-# Load common constants. This should be the first executable line.
-# The path to common.sh should be relative to your script's location.
-. "$(dirname "$0")/common.sh"
-# Allow remote access (for learning board type)
-. "$(dirname "$0")/remote_access.sh"
+# --- 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)
+# --- END COMMON.SH BOILERPLATE ---
+
+. "${SCRIPT_ROOT}/remote_access.sh"
DEFINE_string board "" "Board setting"
DEFINE_boolean build ${FLAGS_TRUE} \
@@ -122,7 +139,7 @@ function validate_and_set_param_defaults() {
if [[ -z "${FLAGS_top}" ]]; then
# Use the top directory based on where this script runs from
- FLAGS_top=$(dirname $(dirname $(dirname $0)))
+ FLAGS_top=${GCLIENT_ROOT}
fi
# Canonicalize any symlinks
@@ -487,7 +504,7 @@ function grab_buildbot() {
export GSDCURL_USERNAME
read -s -p "Password: " GSDCURL_PASSWORD
export GSDCURL_PASSWORD
- CURL="$(dirname $0)/bin/cros_gsdcurl.py"
+ CURL="${SCRIPTS_DIR}/bin/cros_gsdcurl.py"
if [[ "${FLAGS_grab_buildbot}" == "LATEST" ]]; then
local latest=$(${CURL} "${FLAGS_buildbot_uri}/LATEST")
if [[ -z "${latest}" ]]; then
@@ -507,7 +524,7 @@ function grab_buildbot() {
cd "${dl_dir}"
unzip image.zip
- local image_basename=$(basename $(dirname "${FLAGS_grab_buildbot}"))
+ local image_basename=$(basename "$(dirname "${FLAGS_grab_buildbot}")")
local image_base_dir="${FLAGS_top}/src/build/images/${FLAGS_board}"
local image_dir="${image_base_dir}/${image_basename}"
info "Copying in build image to ${image_dir}"
« no previous file with comments | « start_devserver ('k') | test_image » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698