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

Unified Diff: src/scripts/mod_image_for_test.sh

Issue 650181: minor fixups to make this functional (Closed)
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scripts/mod_image_for_test.sh
diff --git a/src/scripts/mod_image_for_test.sh b/src/scripts/mod_image_for_test.sh
index 00c0993fe8a93c461e79f94c841171ba2aabb3d8..c544732462db6f8beb78fe135b76ead443820906 100755
--- a/src/scripts/mod_image_for_test.sh
+++ b/src/scripts/mod_image_for_test.sh
@@ -10,15 +10,22 @@
# The path to common.sh should be relative to your script's location.
. "$(dirname "$0")/common.sh"
-IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images"
+DEFAULT_BOARD=x86-generic
ericli 2010/02/22 23:25:48 DEFAULT_BOARD was already defined inside common.sh
+IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${DEFAULT_BOARD}"
DEFAULT_IMAGE="${IMAGES_DIR}/$(ls -t $IMAGES_DIR 2>&-| head -1)/rootfs.image"
+
+DEFINE_string board "$DEFAULT_BOARD" "Board for which the image was built"
DEFINE_string image "$DEFAULT_IMAGE" \
"Location of the rootfs raw image file"
+DEFINE_boolean yes $FLAGS_FALSE "Answer yes to all prompts" "y"
# Parse command line
FLAGS "$@" || exit 1
eval set -- "${FLAGS_ARGV}"
+IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${DEFAULT_BOARD}"
+DEFAULT_IMAGE="${IMAGES_DIR}/$(ls -t $IMAGES_DIR 2>&-| head -1)/rootfs.image"
+
# Make sure anything mounted in the rootfs is cleaned up ok on exit.
cleanup_rootfs_mounts() {
# Occasionally there are some daemons left hanging around that have our
@@ -63,7 +70,17 @@ LOOP_DEV=`sudo losetup -f`
sudo losetup "${LOOP_DEV}" "${FLAGS_image}"
sudo mount "${LOOP_DEV}" "${ROOT_FS_DIR}"
-echo "Modifying image ${FLAGS_image} for test..."
+# Make sure this is really what the user wants, before nuking the device
+if [ $FLAGS_yes -ne $FLAGS_TRUE ]; then
+ read -p "Modifying image ${FLAGS_image} for test; are you sure (y/N)? " SURE
+ SURE="${SURE:0:1}" # Get just the first character
+ if [ "$SURE" != "y" ]; then
+ echo "Ok, better safe than sorry."
+ exit 1
+ fi
+else
+ echo "Modifying image ${FLAGS_image} for test..."
+fi
MOD_SCRIPTS_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_test_scripts"
sudo mkdir -p "${ROOT_FS_DIR}/modify_scripts"
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698