mirror of
https://github.com/flatcar/scripts.git
synced 2025-11-28 22:12:10 +01:00
Select factory image when --factory is given
prepare_test_image would prepare the correct image (test or factory) but its return value would always specify the test image. This meant that image_to_usb.sh would pick up the wrong image. This commit fixes this. BUG=chromium-os:12377 TEST=./image_to_usb --from=... --to=/dev/sdb also with --factory also with --test Make sure it picks up the correct image in each case. Change-Id: I165b604b448a6c938a47e57a667bd5f001626efe Review URL: http://codereview.chromium.org/6609016
This commit is contained in:
parent
5566eb1f7b
commit
6e448ae31a
@ -645,7 +645,11 @@ prepare_test_image() {
|
||||
--image="$1/$2" --noinplace ${args}
|
||||
|
||||
# From now on we use the just-created test image
|
||||
CHROMEOS_RETURN_VAL="$1/${CHROMEOS_TEST_IMAGE_NAME}"
|
||||
if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then
|
||||
CHROMEOS_RETURN_VAL="$1/${CHROMEOS_FACTORY_TEST_IMAGE_NAME}"
|
||||
else
|
||||
CHROMEOS_RETURN_VAL="$1/${CHROMEOS_TEST_IMAGE_NAME}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Check that the specified file exists. If the file path is empty or the file
|
||||
|
||||
@ -178,8 +178,10 @@ IMAGE_DIR="$(dirname "${FLAGS_image}")"
|
||||
if [ ${FLAGS_inplace} -eq ${FLAGS_FALSE} ]; then
|
||||
if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then
|
||||
TEST_PATHNAME="${IMAGE_DIR}/${CHROMEOS_FACTORY_TEST_IMAGE_NAME}"
|
||||
typename="factory"
|
||||
else
|
||||
TEST_PATHNAME="${IMAGE_DIR}/${CHROMEOS_TEST_IMAGE_NAME}"
|
||||
typename="test"
|
||||
fi
|
||||
if [ ! -f "${TEST_PATHNAME}" ] || \
|
||||
[ ${FLAGS_force_copy} -eq ${FLAGS_TRUE} ] ; then
|
||||
@ -188,7 +190,7 @@ if [ ${FLAGS_inplace} -eq ${FLAGS_FALSE} ]; then
|
||||
|| die "Cannot copy ${FLAGS_image} to test image"
|
||||
FLAGS_image="${TEST_PATHNAME}"
|
||||
else
|
||||
echo "Using cached test image"
|
||||
echo "Using cached ${typename} image"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user