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

Unified Diff: src/scripts/image_to_usb.sh

Issue 656023: Changes to use default board when set by setup_board (Closed)
Patch Set: Fix build_autotest Created 10 years, 10 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 | « src/scripts/common.sh ('k') | src/scripts/mod_image_for_test.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scripts/image_to_usb.sh
diff --git a/src/scripts/image_to_usb.sh b/src/scripts/image_to_usb.sh
index c674e2f8fdc777cfa5f3e7bb7d9a984c0a062fda..b1e533ee494627dde2652d5ff54a2afc17c6ccd0 100755
--- a/src/scripts/image_to_usb.sh
+++ b/src/scripts/image_to_usb.sh
@@ -10,9 +10,10 @@
# The path to common.sh should be relative to your script's location.
. "$(dirname "$0")/common.sh"
+get_default_board
# Flags
-DEFINE_string board "" "Board for which the image was built"
+DEFINE_string board "$DEFAULT_BOARD" "Board for which the image was built"
DEFINE_string from "" \
"Directory containing rootfs.image and mbr.image"
DEFINE_string to "" "$DEFAULT_TO_HELP"
@@ -38,12 +39,23 @@ fi
# Die on any errors.
set -e
-# If from isn't explicitly set
+# No board, no default and no image set then we can't find the image
+if [ -z $FLAGS_from ] && [ -z $FLAGS_board ] ; then
+ setup_board_warning
+ exit 1
+fi
+
+# We have a board name but no image set. Use image at default location
if [ -z "$FLAGS_from" ]; then
IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${FLAGS_board}"
FLAGS_from="${IMAGES_DIR}/$(ls -t $IMAGES_DIR 2>&-| head -1)"
fi
+if [ ! -d "$FLAGS_from" ] ; then
+ echo "Cannot find image directory $FLAGS_from"
+ exit 1
+fi
+
# If to isn't explicitly set
if [ -z "$FLAGS_to" ]; then
# Script can be run either inside or outside the chroot.
« no previous file with comments | « src/scripts/common.sh ('k') | src/scripts/mod_image_for_test.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698