| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 echo "Modifying image ${FLAGS_image} for test..." | 166 echo "Modifying image ${FLAGS_image} for test..." |
| 167 fi | 167 fi |
| 168 | 168 |
| 169 set -e | 169 set -e |
| 170 | 170 |
| 171 IMAGE_DIR="$(dirname "$FLAGS_image")" | 171 IMAGE_DIR="$(dirname "$FLAGS_image")" |
| 172 IMAGE_NAME="$(basename "$FLAGS_image")" | 172 IMAGE_NAME="$(basename "$FLAGS_image")" |
| 173 ROOT_FS_DIR="$IMAGE_DIR/rootfs" | 173 ROOT_FS_DIR="$IMAGE_DIR/rootfs" |
| 174 STATEFUL_DIR="$IMAGE_DIR/stateful_partition" | 174 STATEFUL_DIR="$IMAGE_DIR/stateful_partition" |
| 175 SCRIPTS_DIR=$(dirname "$0") | 175 SCRIPTS_DIR=$(dirname "$0") |
| 176 DEV_USER="chronos" |
| 176 | 177 |
| 177 trap cleanup EXIT | 178 trap cleanup EXIT |
| 178 | 179 |
| 179 # Mounts gpt image and sets up var, /usr/local and symlinks. | 180 # Mounts gpt image and sets up var, /usr/local and symlinks. |
| 180 "$SCRIPTS_DIR/mount_gpt_image.sh" -i "$IMAGE_NAME" -f "$IMAGE_DIR" \ | 181 "$SCRIPTS_DIR/mount_gpt_image.sh" -i "$IMAGE_NAME" -f "$IMAGE_DIR" \ |
| 181 -r "$ROOT_FS_DIR" -s "$STATEFUL_DIR" | 182 -r "$ROOT_FS_DIR" -s "$STATEFUL_DIR" |
| 182 | 183 |
| 183 if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then | 184 if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then |
| 184 # We don't want to emerge test packages on factory install, otherwise we run | 185 # We don't want to emerge test packages on factory install, otherwise we run |
| 185 # out of space. | 186 # out of space. |
| 186 | 187 |
| 187 # Run factory setup script to modify the image. | 188 # Run factory setup script to modify the image. |
| 188 sudo $EMERGE_BOARD_CMD --root=$ROOT_FS_DIR --usepkgonly \ | 189 sudo $EMERGE_BOARD_CMD --root=$ROOT_FS_DIR --usepkgonly \ |
| 189 --root-deps=rdeps --nodeps chromeos-factoryinstall | 190 --root-deps=rdeps --nodeps chromeos-factoryinstall |
| 190 | 191 |
| 191 # Set factory server if necessary. | 192 # Set factory server if necessary. |
| 192 if [ "${FACTORY_SERVER}" != "" ]; then | 193 if [ "${FACTORY_SERVER}" != "" ]; then |
| 193 sudo sed -i \ | 194 sudo sed -i \ |
| 194 "s/CHROMEOS_AUSERVER=.*$/CHROMEOS_AUSERVER=\ | 195 "s/CHROMEOS_AUSERVER=.*$/CHROMEOS_AUSERVER=\ |
| 195 http:\/\/${FACTORY_SERVER}:8080\/update/" \ | 196 http:\/\/${FACTORY_SERVER}:8080\/update/" \ |
| 196 ${ROOT_FS_DIR}/etc/lsb-release | 197 ${ROOT_FS_DIR}/etc/lsb-release |
| 197 fi | 198 fi |
| 198 else | 199 else |
| 199 emerge_chromeos_test | 200 emerge_chromeos_test |
| 200 | 201 |
| 202 # Mark "OOBE completed" flag so that OEM partition is not mounted on startup. |
| 203 sudo touch "${ROOT_FS_DIR}/home/${DEV_USER}/.oobe_completed" |
| 204 |
| 201 MOD_TEST_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_test_scripts" | 205 MOD_TEST_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_test_scripts" |
| 202 # Run test setup script to modify the image | 206 # Run test setup script to modify the image |
| 203 sudo GCLIENT_ROOT="${GCLIENT_ROOT}" ROOT_FS_DIR="${ROOT_FS_DIR}" \ | 207 sudo GCLIENT_ROOT="${GCLIENT_ROOT}" ROOT_FS_DIR="${ROOT_FS_DIR}" \ |
| 204 STATEFUL_DIR="${STATEFUL_DIR}" ARCH="${ARCH}" "${MOD_TEST_ROOT}/test_setup
.sh" | 208 STATEFUL_DIR="${STATEFUL_DIR}" ARCH="${ARCH}" "${MOD_TEST_ROOT}/test_setup
.sh" |
| 205 | 209 |
| 206 if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then | 210 if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then |
| 207 install_autotest | 211 install_autotest |
| 208 | 212 |
| 209 MOD_FACTORY_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_factory_scripts" | 213 MOD_FACTORY_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_factory_scripts" |
| 210 # Run factory setup script to modify the image | 214 # Run factory setup script to modify the image |
| (...skipping 13 matching lines...) Expand all Loading... |
| 224 cleanup | 228 cleanup |
| 225 | 229 |
| 226 # Now make it bootable with the flags from build_image | 230 # Now make it bootable with the flags from build_image |
| 227 ${SCRIPTS_DIR}/bin/cros_make_image_bootable $(dirname "${FLAGS_image}") \ | 231 ${SCRIPTS_DIR}/bin/cros_make_image_bootable $(dirname "${FLAGS_image}") \ |
| 228 $(basename "${FLAGS_image}") | 232 $(basename "${FLAGS_image}") |
| 229 | 233 |
| 230 print_time_elapsed | 234 print_time_elapsed |
| 231 | 235 |
| 232 trap - EXIT | 236 trap - EXIT |
| 233 | 237 |
| OLD | NEW |