| 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 21 matching lines...) Expand all Loading... |
| 32 "Location of qualified component file" d | 32 "Location of qualified component file" d |
| 33 DEFINE_boolean yes $FLAGS_FALSE "Answer yes to all prompts" y | 33 DEFINE_boolean yes $FLAGS_FALSE "Answer yes to all prompts" y |
| 34 DEFINE_string build_root "/build" \ | 34 DEFINE_string build_root "/build" \ |
| 35 "The root location for board sysroots." | 35 "The root location for board sysroots." |
| 36 | 36 |
| 37 | 37 |
| 38 # Parse command line | 38 # Parse command line |
| 39 FLAGS "$@" || exit 1 | 39 FLAGS "$@" || exit 1 |
| 40 eval set -- "${FLAGS_ARGV}" | 40 eval set -- "${FLAGS_ARGV}" |
| 41 | 41 |
| 42 EMERGE_CMD="emerge" |
| 43 EMERGE_BOARD_CMD="emerge-${FLAGS_board}" |
| 44 if [ -e "${TOP_SCRIPTS_DIR}/.emerge" ]; then |
| 45 . "${TOP_SCRIPTS_DIR}/.emerge" |
| 46 fi |
| 47 |
| 42 # No board, no default and no image set then we can't find the image | 48 # No board, no default and no image set then we can't find the image |
| 43 if [ -z $FLAGS_image ] && [ -z $FLAGS_board ] ; then | 49 if [ -z $FLAGS_image ] && [ -z $FLAGS_board ] ; then |
| 44 setup_board_warning | 50 setup_board_warning |
| 45 die "mod_image_for_test failed. No board set and no image set" | 51 die "mod_image_for_test failed. No board set and no image set" |
| 46 fi | 52 fi |
| 47 | 53 |
| 48 # We have a board name but no image set. Use image at default location | 54 # We have a board name but no image set. Use image at default location |
| 49 if [ -z $FLAGS_image ] ; then | 55 if [ -z $FLAGS_image ] ; then |
| 50 IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${FLAGS_board}" | 56 IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${FLAGS_board}" |
| 51 FILENAME="chromiumos_image.bin" | 57 FILENAME="chromiumos_image.bin" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 82 # Emerges chromeos-test onto the image. | 88 # Emerges chromeos-test onto the image. |
| 83 emerge_chromeos_test() { | 89 emerge_chromeos_test() { |
| 84 INSTALL_MASK="" | 90 INSTALL_MASK="" |
| 85 if [[ $FLAGS_installmask -eq ${FLAGS_TRUE} ]]; then | 91 if [[ $FLAGS_installmask -eq ${FLAGS_TRUE} ]]; then |
| 86 INSTALL_MASK="$DEFAULT_INSTALL_MASK" | 92 INSTALL_MASK="$DEFAULT_INSTALL_MASK" |
| 87 fi | 93 fi |
| 88 | 94 |
| 89 # Determine the root dir for test packages. | 95 # Determine the root dir for test packages. |
| 90 ROOT_DEV_DIR="$ROOT_FS_DIR/usr/local" | 96 ROOT_DEV_DIR="$ROOT_FS_DIR/usr/local" |
| 91 | 97 |
| 92 INSTALL_MASK="$INSTALL_MASK" emerge-${FLAGS_board} \ | 98 INSTALL_MASK="$INSTALL_MASK" $EMERGE_BOARD_CMD \ |
| 93 --root="$ROOT_DEV_DIR" --root-deps=rdeps \ | 99 --root="$ROOT_DEV_DIR" --root-deps=rdeps \ |
| 94 --usepkgonly chromeos-test $EMERGE_JOBS | 100 --usepkgonly chromeos-test $EMERGE_JOBS |
| 95 } | 101 } |
| 96 | 102 |
| 97 | 103 |
| 98 install_autotest() { | 104 install_autotest() { |
| 99 SYSROOT="${FLAGS_build_root}/${FLAGS_board}" | 105 SYSROOT="${FLAGS_build_root}/${FLAGS_board}" |
| 100 AUTOTEST_SRC="${SYSROOT}/usr/local/autotest" | 106 AUTOTEST_SRC="${SYSROOT}/usr/local/autotest" |
| 101 stateful_root="${ROOT_FS_DIR}/usr/local" | 107 stateful_root="${ROOT_FS_DIR}/usr/local" |
| 102 autotest_client="/autotest" | 108 autotest_client="/autotest" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 155 |
| 150 # Mounts gpt image and sets up var, /usr/local and symlinks. | 156 # Mounts gpt image and sets up var, /usr/local and symlinks. |
| 151 "$SCRIPTS_DIR/mount_gpt_image.sh" -i "$IMAGE_NAME" -f "$IMAGE_DIR" \ | 157 "$SCRIPTS_DIR/mount_gpt_image.sh" -i "$IMAGE_NAME" -f "$IMAGE_DIR" \ |
| 152 -r "$ROOT_FS_DIR" -s "$STATEFUL_DIR" | 158 -r "$ROOT_FS_DIR" -s "$STATEFUL_DIR" |
| 153 | 159 |
| 154 if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then | 160 if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then |
| 155 # We don't want to emerge test packages on factory install, otherwise we run | 161 # We don't want to emerge test packages on factory install, otherwise we run |
| 156 # out of space. | 162 # out of space. |
| 157 | 163 |
| 158 # Run factory setup script to modify the image. | 164 # Run factory setup script to modify the image. |
| 159 sudo emerge-${FLAGS_board} --root=$ROOT_FS_DIR --usepkgonly \ | 165 sudo $EMERGE_BOARD_CMD --root=$ROOT_FS_DIR --usepkgonly \ |
| 160 --root-deps=rdeps --nodeps chromeos-factoryinstall | 166 --root-deps=rdeps --nodeps chromeos-factoryinstall |
| 161 | 167 |
| 162 # Set factory server if necessary. | 168 # Set factory server if necessary. |
| 163 if [ "${FACTORY_SERVER}" != "" ]; then | 169 if [ "${FACTORY_SERVER}" != "" ]; then |
| 164 sudo sed -i \ | 170 sudo sed -i \ |
| 165 "s/CHROMEOS_AUSERVER=.*$/CHROMEOS_AUSERVER=\ | 171 "s/CHROMEOS_AUSERVER=.*$/CHROMEOS_AUSERVER=\ |
| 166 http:\/\/${FACTORY_SERVER}:8080\/update/" \ | 172 http:\/\/${FACTORY_SERVER}:8080\/update/" \ |
| 167 ${ROOT_FS_DIR}/etc/lsb-release | 173 ${ROOT_FS_DIR}/etc/lsb-release |
| 168 fi | 174 fi |
| 169 else | 175 else |
| (...skipping 18 matching lines...) Expand all Loading... |
| 188 # Let's have a look at the image just in case.. | 194 # Let's have a look at the image just in case.. |
| 189 if [ "${VERIFY}" = "true" ]; then | 195 if [ "${VERIFY}" = "true" ]; then |
| 190 pushd "${ROOT_FS_DIR}" | 196 pushd "${ROOT_FS_DIR}" |
| 191 bash | 197 bash |
| 192 popd | 198 popd |
| 193 fi | 199 fi |
| 194 | 200 |
| 195 cleanup | 201 cleanup |
| 196 trap - EXIT | 202 trap - EXIT |
| 197 | 203 |
| OLD | NEW |