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

Unified Diff: bin/cros_package_to_live

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 | « bin/cros_overlay_list ('k') | bin/cros_resign_image.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/cros_package_to_live
diff --git a/bin/cros_package_to_live b/bin/cros_package_to_live
index 699bf237c4e1b8a9136cb8618e02a1b46331d86d..2430333c36fe1c6219e482295256d0a5d10dd788 100755
--- a/bin/cros_package_to_live
+++ b/bin/cros_package_to_live
@@ -7,16 +7,28 @@
# Script to update a running device with an optionally built package out
# of your build directory
-# Load common constants. This should be the first executable line.
-# The path to common.sh should be relative to your script's location.
+# --- 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 $0)
-if [ -f ${script_root}/../common.sh ] ; then
- script_root=${script_root}/..
-fi
+find_common_sh
+. "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1)
+# --- END COMMON.SH BOILERPLATE ---
-. "${script_root}/common.sh"
-. "${script_root}/remote_access.sh"
+. "${SCRIPT_ROOT}/remote_access.sh" || die "Unable to load remote_access.sh"
get_default_board
@@ -89,8 +101,8 @@ for pkg in $@; do
echo "Could not find latest built version of ${pkg}"
exit 1
fi
- pkg_dir=$(basename $(dirname $latest_pkg))
- pkg_name=$(basename $latest_pkg)
+ pkg_dir=$(basename "$(dirname "$latest_pkg")")
+ pkg_name=$(basename "$latest_pkg")
echo "Installing ${latest_pkg}..."
remote_sh "mktemp -d /tmp/cros_package_to_live.XXXX"
« no previous file with comments | « bin/cros_overlay_list ('k') | bin/cros_resign_image.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698