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

Side by Side Diff: src/scripts/image_to_usb.sh

Issue 1991006: add the ability to umount automounted devices from within the chroot (Closed) Base URL: ssh://git@chromiumos-git//chromeos
Patch Set: Created 10 years, 7 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 unified diff | Download patch
« no previous file with comments | « src/scripts/enter_chroot.sh ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # Script to convert the output of build_image.sh to a usb image. 7 # Script to convert the output of build_image.sh to a usb image.
8 8
9 # Load common constants. This should be the first executable line. 9 # Load common constants. This should be the first executable line.
10 # The path to common.sh should be relative to your script's location. 10 # The path to common.sh should be relative to your script's location.
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 if [ "${SURE}" != "y" ] 225 if [ "${SURE}" != "y" ]
226 then 226 then
227 echo "Ok, better safe than sorry." 227 echo "Ok, better safe than sorry."
228 exit 1 228 exit 1
229 fi 229 fi
230 fi 230 fi
231 231
232 echo "Attempting to unmount any mounts on the USB device..." 232 echo "Attempting to unmount any mounts on the USB device..."
233 for i in $(mount | grep ^"${FLAGS_to}" | awk '{print $1}') 233 for i in $(mount | grep ^"${FLAGS_to}" | awk '{print $1}')
234 do 234 do
235 sudo umount "$i" 235 if sudo umount "$i" 2>&1 >/dev/null | grep "not found"; then
236 echo
237 echo "The device you have specified is already mounted at some point "
238 echo "that is not visible from inside the chroot. Please unmount the "
239 echo "device manually from outside the chroot and try again."
240 echo
241 exit 1
242 fi
236 done 243 done
237 sleep 3 244 sleep 3
238 245
239 echo "Copying ${SRC_IMAGE} to ${FLAGS_to}..." 246 echo "Copying ${SRC_IMAGE} to ${FLAGS_to}..."
240 sudo dd if="${SRC_IMAGE}" of="${FLAGS_to}" bs=4M 247 sudo dd if="${SRC_IMAGE}" of="${FLAGS_to}" bs=4M
241 248
242 echo "Done." 249 echo "Done."
243 else 250 else
244 # Output to a file, so just make a copy. 251 # Output to a file, so just make a copy.
245 echo "Copying ${SRC_IMAGE} to ${FLAGS_to}..." 252 echo "Copying ${SRC_IMAGE} to ${FLAGS_to}..."
246 cp -f "${SRC_IMAGE}" "${FLAGS_to}" 253 cp -f "${SRC_IMAGE}" "${FLAGS_to}"
247 254
248 echo "Done. To copy to a USB drive, outside the chroot, do something like:" 255 echo "Done. To copy to a USB drive, outside the chroot, do something like:"
249 echo " sudo dd if=${FLAGS_to} of=/dev/sdX bs=4M" 256 echo " sudo dd if=${FLAGS_to} of=/dev/sdX bs=4M"
250 echo "where /dev/sdX is the entire drive." 257 echo "where /dev/sdX is the entire drive."
251 if [ ${INSIDE_CHROOT} -eq 1 ] 258 if [ ${INSIDE_CHROOT} -eq 1 ]
252 then 259 then
253 example=$(basename "${FLAGS_to}") 260 example=$(basename "${FLAGS_to}")
254 echo "NOTE: Since you are currently inside the chroot, and you'll need to" 261 echo "NOTE: Since you are currently inside the chroot, and you'll need to"
255 echo "run dd outside the chroot, the path to the USB image will be" 262 echo "run dd outside the chroot, the path to the USB image will be"
256 echo "different (ex: ~/chromeos/trunk/src/build/images/SOME_DIR/$example)." 263 echo "different (ex: ~/chromeos/trunk/src/build/images/SOME_DIR/$example)."
257 fi 264 fi
258 fi 265 fi
OLDNEW
« no previous file with comments | « src/scripts/enter_chroot.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698