OLD | NEW |
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 modify a keyfob-based chromeos system image for testability. | 7 # Script to modify a keyfob-based chromeos system image for testability. |
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. |
11 . "$(dirname "$0")/common.sh" | 11 . "$(dirname "$0")/common.sh" |
12 | 12 |
13 get_default_board | 13 get_default_board |
14 | 14 |
15 DEFINE_string board "$DEFAULT_BOARD" "Board for which the image was built" | 15 DEFINE_string board "$DEFAULT_BOARD" "Board for which the image was built" |
16 DEFINE_string image "" "Location of the rootfs raw image file" | 16 DEFINE_string image "" "Location of the rootfs raw image file" |
17 DEFINE_boolean yes $FLAGS_FALSE "Answer yes to all prompts" "y" | 17 DEFINE_boolean yes $FLAGS_FALSE "Answer yes to all prompts" "y" |
18 | 18 |
19 # Parse command line | 19 # Parse command line |
20 FLAGS "$@" || exit 1 | 20 FLAGS "$@" || exit 1 |
21 eval set -- "${FLAGS_ARGV}" | 21 eval set -- "${FLAGS_ARGV}" |
22 | 22 |
23 # No board, no default and no image set then we can't find the image | 23 # No board, no default and no image set then we can't find the image |
24 if [ -z $FLAGS_IMAGE ] && [ -z $FLAGS_board ] ; then | 24 if [ -z $FLAGS_IMAGE ] && [ -z $FLAGS_board ] ; then |
25 setup_board_warning | 25 setup_board_warning |
26 echo "*** mod_image_for_test failed. No board set and no image set" | 26 echo "*** mod_image_for_test failed. No board set and no image set" |
27 exit 1 | 27 exit 1 |
28 fi | 28 fi |
29 | 29 |
30 # We have a board name but no image set. Use image at default location | 30 # We have a board name but no image set. Use image at default location |
31 if [ -z $FLAGS_image ] ; then | 31 if [ -z $FLAGS_image ] ; then |
32 IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${FLAGS_board}" | 32 IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${FLAGS_board}" |
33 FLAGS_image="${IMAGES_DIR}/$(ls -t $IMAGES_DIR 2>&-| head -1)/rootfs.image" | 33 FLAGS_image="${IMAGES_DIR}/$(ls -t $IMAGES_DIR 2>&-| head -1)/rootfs.image" |
34 fi | 34 fi |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 # Run test setup script inside chroot jail to modify the image | 102 # Run test setup script inside chroot jail to modify the image |
103 sudo chroot "${ROOT_FS_DIR}" "/modify_scripts/test_setup.sh" | 103 sudo chroot "${ROOT_FS_DIR}" "/modify_scripts/test_setup.sh" |
104 | 104 |
105 sudo umount "${ROOT_FS_DIR}/modify_scripts" | 105 sudo umount "${ROOT_FS_DIR}/modify_scripts" |
106 sudo rmdir "${ROOT_FS_DIR}/modify_scripts" | 106 sudo rmdir "${ROOT_FS_DIR}/modify_scripts" |
107 | 107 |
108 cleanup | 108 cleanup |
109 trap - EXIT | 109 trap - EXIT |
110 | 110 |
OLD | NEW |