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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 } | 171 } |
172 | 172 |
173 # main process begins here. | 173 # main process begins here. |
174 | 174 |
175 IMAGE_DIR="$(dirname "${FLAGS_image}")" | 175 IMAGE_DIR="$(dirname "${FLAGS_image}")" |
176 | 176 |
177 # Copy the image to a test location if required | 177 # Copy the image to a test location if required |
178 if [ ${FLAGS_inplace} -eq ${FLAGS_FALSE} ]; then | 178 if [ ${FLAGS_inplace} -eq ${FLAGS_FALSE} ]; then |
179 if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then | 179 if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then |
180 TEST_PATHNAME="${IMAGE_DIR}/${CHROMEOS_FACTORY_TEST_IMAGE_NAME}" | 180 TEST_PATHNAME="${IMAGE_DIR}/${CHROMEOS_FACTORY_TEST_IMAGE_NAME}" |
| 181 typename="factory" |
181 else | 182 else |
182 TEST_PATHNAME="${IMAGE_DIR}/${CHROMEOS_TEST_IMAGE_NAME}" | 183 TEST_PATHNAME="${IMAGE_DIR}/${CHROMEOS_TEST_IMAGE_NAME}" |
| 184 typename="test" |
183 fi | 185 fi |
184 if [ ! -f "${TEST_PATHNAME}" ] || \ | 186 if [ ! -f "${TEST_PATHNAME}" ] || \ |
185 [ ${FLAGS_force_copy} -eq ${FLAGS_TRUE} ] ; then | 187 [ ${FLAGS_force_copy} -eq ${FLAGS_TRUE} ] ; then |
186 echo "Creating test image from original..." | 188 echo "Creating test image from original..." |
187 ${COMMON_PV_CAT} "${FLAGS_image}" >"${TEST_PATHNAME}" \ | 189 ${COMMON_PV_CAT} "${FLAGS_image}" >"${TEST_PATHNAME}" \ |
188 || die "Cannot copy ${FLAGS_image} to test image" | 190 || die "Cannot copy ${FLAGS_image} to test image" |
189 FLAGS_image="${TEST_PATHNAME}" | 191 FLAGS_image="${TEST_PATHNAME}" |
190 else | 192 else |
191 echo "Using cached test image" | 193 echo "Using cached ${typename} image" |
192 exit | 194 exit |
193 fi | 195 fi |
194 | 196 |
195 # No need to confirm now, since we are not overwriting the main image | 197 # No need to confirm now, since we are not overwriting the main image |
196 FLAGS_yes="$FLAGS_TRUE" | 198 FLAGS_yes="$FLAGS_TRUE" |
197 fi | 199 fi |
198 | 200 |
199 # Make sure this is really what the user wants, before nuking the device | 201 # Make sure this is really what the user wants, before nuking the device |
200 if [ $FLAGS_yes -ne $FLAGS_TRUE ]; then | 202 if [ $FLAGS_yes -ne $FLAGS_TRUE ]; then |
201 read -p "Modifying image ${FLAGS_image} for test; are you sure (y/N)? " SURE | 203 read -p "Modifying image ${FLAGS_image} for test; are you sure (y/N)? " SURE |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 cleanup | 275 cleanup |
274 | 276 |
275 # Now make it bootable with the flags from build_image | 277 # Now make it bootable with the flags from build_image |
276 "${SCRIPTS_DIR}/bin/cros_make_image_bootable" "$(dirname "${FLAGS_image}")" \ | 278 "${SCRIPTS_DIR}/bin/cros_make_image_bootable" "$(dirname "${FLAGS_image}")" \ |
277 $(basename "${FLAGS_image}") | 279 $(basename "${FLAGS_image}") |
278 | 280 |
279 print_time_elapsed | 281 print_time_elapsed |
280 | 282 |
281 trap - EXIT | 283 trap - EXIT |
282 | 284 |
OLD | NEW |