OLD | NEW |
(Empty) | |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 # |
| 5 # Force cleans loopback devices from within your chroot environment. This |
| 6 # script is to help mitigate losing loopback devices on build_images |
| 7 # failures. This script only affects mountpoints and loopback devices |
| 8 # that were created within this chroot. |
| 9 |
| 10 # Load common constants. This should be the first executable line. |
| 11 # The path to common.sh should be relative to your script's location. |
| 12 . "$(dirname "$0")/common.sh" |
| 13 |
| 14 # Script must be run inside the chroot. |
| 15 assert_inside_chroot |
| 16 |
| 17 DEFINE_string output_root "$DEFAULT_BUILD_ROOT/images" \ |
| 18 "Directory in which to place image result directories (named by version)" |
| 19 DEFINE_string board "$DEFAULT_BOARD" \ |
| 20 "The board to build an image for." |
| 21 |
| 22 OUTPUT_DIR="${FLAGS_output_root}/${FLAGS_board}" |
| 23 |
| 24 echo "This will unmount any directory under $OUTPUT_DIR:" |
| 25 read -p "Are you sure (y/N)? " SURE |
| 26 SURE="${SURE:0:1}" # Get just the first character |
| 27 if [ "${SURE}" != "y" ] |
| 28 then |
| 29 echo "Ok, better safe than sorry." |
| 30 exit 1 |
| 31 fi |
| 32 |
| 33 sudo umount "$OUTPUT_DIR"/*/* 2> /dev/null |
| 34 sudo losetup -d /dev/loop* 2> /dev/null |
OLD | NEW |