From c1b14b52d0730be6fd58736acc875f3b02400d07 Mon Sep 17 00:00:00 2001 From: Chris Sosa Date: Tue, 5 Oct 2010 13:23:50 -0700 Subject: [PATCH] Add defaults for cros_make_image_bootable. This will allow dev who didn't build an image to still use cros_make_image_bootable to update their image -- including mod_image_for_test / image_to_vm. Change-Id: I1ba4292223b28b21d5416745e7744641100fa4ad BUG=7370 TEST=Ran image_to_vm with other image and image I built myself. Also ran cros_make_image_bootable directly on a the same two images. Review URL: http://codereview.chromium.org/3569015 --- bin/cros_make_image_bootable | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/bin/cros_make_image_bootable b/bin/cros_make_image_bootable index 20c21911d6..3ea148145f 100755 --- a/bin/cros_make_image_bootable +++ b/bin/cros_make_image_bootable @@ -28,8 +28,9 @@ if [ $# -lt 2 ]; then exit 1 fi -BOOT_DESC_FILE="${1}/boot.desc" -IMAGE="${1}/${2}" +IMAGE_DIR="$(readlink -f "${1}")" +BOOT_DESC_FILE="${IMAGE_DIR}/boot.desc" +IMAGE="${IMAGE_DIR}/${2}" shift shift FLAG_OVERRIDES="${@}" @@ -233,6 +234,16 @@ make_image_bootable() { -s "${FLAGS_statefulfs_mountpoint}" } +# Use default of current image location if the output dir doesn't exist. +if [ ! -d ${FLAGS_output_dir} ]; then + warn "Output dir not found, using ${IMAGE_DIR}." + FLAGS_output_dir="${IMAGE_DIR}" + FLAGS_rootfs_hash="${IMAGE_DIR}/rootfs.hash" + FLAGS_rootfs_mountpoint="${IMAGE_DIR}/rootfs_dir" + FLAGS_statefulfs_mountpoint="${IMAGE_DIR}/stateful_dir" + FLAGS_espfs_mountpoint="${IMAGE_DIR}/esp" +fi + # Create the directories if they don't exist. mkdir -p ${FLAGS_rootfs_mountpoint} mkdir -p ${FLAGS_statefulfs_mountpoint}