| 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. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 ROOT_FS_DIR="`dirname ${FLAGS_image}`/rootfs" | 59 ROOT_FS_DIR="`dirname ${FLAGS_image}`/rootfs" |
| 60 mkdir -p "${ROOT_FS_DIR}" | 60 mkdir -p "${ROOT_FS_DIR}" |
| 61 | 61 |
| 62 LOOP_DEV=`sudo losetup -f` | 62 LOOP_DEV=`sudo losetup -f` |
| 63 sudo losetup "${LOOP_DEV}" "${FLAGS_image}" | 63 sudo losetup "${LOOP_DEV}" "${FLAGS_image}" |
| 64 sudo mount "${LOOP_DEV}" "${ROOT_FS_DIR}" | 64 sudo mount "${LOOP_DEV}" "${ROOT_FS_DIR}" |
| 65 | 65 |
| 66 echo "Modifying image ${FLAGS_image} for test..." | 66 echo "Modifying image ${FLAGS_image} for test..." |
| 67 | 67 |
| 68 # Run build steps for modify for test | |
| 69 sudo mkdir -p "${ROOT_FS_DIR}/modify_build" | |
| 70 scripts_dir="${GCLIENT_ROOT}/src/scripts/mod_for_test_scripts" | |
| 71 for script in "${scripts_dir}"/b[0-9][0-9][0-9]*[!$~]; do | |
| 72 . ${script} | |
| 73 done | |
| 74 | |
| 75 MOD_SCRIPTS_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_test_scripts" | 68 MOD_SCRIPTS_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_test_scripts" |
| 76 sudo mkdir -p "${ROOT_FS_DIR}/modify_scripts" | 69 sudo mkdir -p "${ROOT_FS_DIR}/modify_scripts" |
| 77 sudo mount --bind "${MOD_SCRIPTS_ROOT}" "${ROOT_FS_DIR}/modify_scripts" | 70 sudo mount --bind "${MOD_SCRIPTS_ROOT}" "${ROOT_FS_DIR}/modify_scripts" |
| 78 | 71 |
| 79 # Run test setup script inside chroot jail to modify the image | 72 # Run test setup script inside chroot jail to modify the image |
| 80 sudo chroot "${ROOT_FS_DIR}" "/modify_scripts/test_setup.sh" | 73 sudo chroot "${ROOT_FS_DIR}" "/modify_scripts/test_setup.sh" |
| 81 | 74 |
| 82 sudo umount "${ROOT_FS_DIR}/modify_scripts" | 75 sudo umount "${ROOT_FS_DIR}/modify_scripts" |
| 83 sudo rmdir "${ROOT_FS_DIR}/modify_scripts" | 76 sudo rmdir "${ROOT_FS_DIR}/modify_scripts" |
| 84 sudo rm -rf "${ROOT_FS_DIR}/modify_build" | |
| 85 | 77 |
| 86 cleanup | 78 cleanup |
| 87 trap - EXIT | 79 trap - EXIT |
| 88 | 80 |
| OLD | NEW |