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 # --- BEGIN COMMON.SH BOILERPLATE --- | 9 # --- BEGIN COMMON.SH BOILERPLATE --- |
10 # Load common CrOS utilities. Inside the chroot this file is installed in | 10 # Load common CrOS utilities. Inside the chroot this file is installed in |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 else | 183 else |
184 echo "Modifying image ${FLAGS_image} for test..." | 184 echo "Modifying image ${FLAGS_image} for test..." |
185 fi | 185 fi |
186 | 186 |
187 set -e | 187 set -e |
188 | 188 |
189 IMAGE_DIR=$(dirname "$FLAGS_image") | 189 IMAGE_DIR=$(dirname "$FLAGS_image") |
190 IMAGE_NAME="$(basename "$FLAGS_image")" | 190 IMAGE_NAME="$(basename "$FLAGS_image")" |
191 ROOT_FS_DIR="$IMAGE_DIR/rootfs" | 191 ROOT_FS_DIR="$IMAGE_DIR/rootfs" |
192 STATEFUL_DIR="$IMAGE_DIR/stateful_partition" | 192 STATEFUL_DIR="$IMAGE_DIR/stateful_partition" |
193 DEV_USER="chronos" | |
194 | 193 |
195 trap cleanup EXIT | 194 trap cleanup EXIT |
196 | 195 |
197 # Mounts gpt image and sets up var, /usr/local and symlinks. | 196 # Mounts gpt image and sets up var, /usr/local and symlinks. |
198 "$SCRIPTS_DIR/mount_gpt_image.sh" -i "$IMAGE_NAME" -f "$IMAGE_DIR" \ | 197 "$SCRIPTS_DIR/mount_gpt_image.sh" -i "$IMAGE_NAME" -f "$IMAGE_DIR" \ |
199 -r "$ROOT_FS_DIR" -s "$STATEFUL_DIR" | 198 -r "$ROOT_FS_DIR" -s "$STATEFUL_DIR" |
200 | 199 |
201 if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then | 200 if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then |
202 # We don't want to emerge test packages on factory install, otherwise we run | 201 # We don't want to emerge test packages on factory install, otherwise we run |
203 # out of space. | 202 # out of space. |
204 | 203 |
205 # Run factory setup script to modify the image. | 204 # Run factory setup script to modify the image. |
206 sudo $EMERGE_BOARD_CMD --root=$ROOT_FS_DIR --usepkgonly \ | 205 sudo $EMERGE_BOARD_CMD --root=$ROOT_FS_DIR --usepkgonly \ |
207 --root-deps=rdeps --nodeps chromeos-factoryinstall | 206 --root-deps=rdeps --nodeps chromeos-factoryinstall |
208 | 207 |
209 # Set factory server if necessary. | 208 # Set factory server if necessary. |
210 if [ "${FACTORY_SERVER}" != "" ]; then | 209 if [ "${FACTORY_SERVER}" != "" ]; then |
211 sudo sed -i \ | 210 sudo sed -i \ |
212 "s/CHROMEOS_AUSERVER=.*$/CHROMEOS_AUSERVER=\ | 211 "s/CHROMEOS_AUSERVER=.*$/CHROMEOS_AUSERVER=\ |
213 http:\/\/${FACTORY_SERVER}:8080\/update/" \ | 212 http:\/\/${FACTORY_SERVER}:8080\/update/" \ |
214 ${ROOT_FS_DIR}/etc/lsb-release | 213 ${ROOT_FS_DIR}/etc/lsb-release |
215 fi | 214 fi |
216 else | 215 else |
217 emerge_chromeos_test | 216 emerge_chromeos_test |
218 | 217 |
219 # Mark "OOBE completed" flag so that OEM partition is not mounted on startup. | |
220 sudo touch "${ROOT_FS_DIR}/home/${DEV_USER}/.oobe_completed" | |
221 | |
222 MOD_TEST_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_test_scripts" | 218 MOD_TEST_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_test_scripts" |
223 # Run test setup script to modify the image | 219 # Run test setup script to modify the image |
224 sudo GCLIENT_ROOT="${GCLIENT_ROOT}" ROOT_FS_DIR="${ROOT_FS_DIR}" \ | 220 sudo GCLIENT_ROOT="${GCLIENT_ROOT}" ROOT_FS_DIR="${ROOT_FS_DIR}" \ |
225 STATEFUL_DIR="${STATEFUL_DIR}" ARCH="${ARCH}" "${MOD_TEST_ROOT}/test_setup
.sh" | 221 STATEFUL_DIR="${STATEFUL_DIR}" ARCH="${ARCH}" "${MOD_TEST_ROOT}/test_setup
.sh" |
226 | 222 |
227 if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then | 223 if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then |
228 install_autotest | 224 install_autotest |
229 | 225 |
230 MOD_FACTORY_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_factory_scripts" | 226 MOD_FACTORY_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_factory_scripts" |
231 # Run factory setup script to modify the image | 227 # Run factory setup script to modify the image |
(...skipping 16 matching lines...) Expand all Loading... |
248 cleanup | 244 cleanup |
249 | 245 |
250 # Now make it bootable with the flags from build_image | 246 # Now make it bootable with the flags from build_image |
251 "${SCRIPTS_DIR}/bin/cros_make_image_bootable" "$(dirname "${FLAGS_image}")" \ | 247 "${SCRIPTS_DIR}/bin/cros_make_image_bootable" "$(dirname "${FLAGS_image}")" \ |
252 $(basename "${FLAGS_image}") | 248 $(basename "${FLAGS_image}") |
253 | 249 |
254 print_time_elapsed | 250 print_time_elapsed |
255 | 251 |
256 trap - EXIT | 252 trap - EXIT |
257 | 253 |
OLD | NEW |