mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-23 14:41:31 +02:00
add the ability to umount automounted devices from within the chroot
Talked to kmixter, and we felt that bindmounting the directory in which the host os creates mount points for automounted external devices is the cleanest solution to the inside/outside the chroot problem. By doing this, image_to_usb can be run from inside the chroot without concern. That means that (as far as I understand) the factory install flow can all be done inside the chroot, as well as modding images for test and everything else. Review URL: http://codereview.chromium.org/1991006
This commit is contained in:
parent
19197c8ac8
commit
99c6a289f4
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user