diff --git a/enter_chroot.sh b/enter_chroot.sh index 77b4722897..236aa02c09 100755 --- a/enter_chroot.sh +++ b/enter_chroot.sh @@ -24,6 +24,8 @@ DEFINE_string build_number "" \ "The build-bot build number (when called by buildbot only)." "b" DEFINE_string chrome_root "" \ "The root of your chrome browser source. Should contain a 'src' subdir." +DEFINE_string automount_dir "/media" \ + "The directory in which your host OS creates mountpoints for external media." DEFINE_boolean official_build $FLAGS_FALSE \ "Set CHROMEOS_OFFICIAL=1 for release builds." @@ -100,6 +102,13 @@ function setup_env { die "Could not mount $MOUNTED_PATH" fi + MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}${FLAGS_automount_dir}")" + if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ] + then + sudo mount --bind "${FLAGS_automount_dir}" "$MOUNTED_PATH" || \ + die "Could not mount $MOUNTED_PATH" + fi + MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}$CHROOT_TRUNK_DIR")" if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ] then diff --git a/image_to_usb.sh b/image_to_usb.sh index ff1a1bbd80..d1ac0b28a2 100755 --- a/image_to_usb.sh +++ b/image_to_usb.sh @@ -232,7 +232,14 @@ then echo "Attempting to unmount any mounts on the USB device..." for i in $(mount | grep ^"${FLAGS_to}" | awk '{print $1}') do - sudo umount "$i" + if sudo umount "$i" 2>&1 >/dev/null | grep "not found"; then + echo + echo "The device you have specified is already mounted at some point " + echo "that is not visible from inside the chroot. Please unmount the " + echo "device manually from outside the chroot and try again." + echo + exit 1 + fi done sleep 3