aboutsummaryrefslogtreecommitdiff
path: root/binary_search_tool/cros_pkg/test_setup_usb.sh
blob: fec66f8efe0f523a0bf4ae5cffb2c15e128af515 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# This is a generic ChromeOS package/image test setup script. It is meant to
# be used for the package bisection tool, in particular when there is a booting
# issue with the image, so the image MUST be 'flashed' via USB.
#
# This script is intended to be used by binary_search_state.py, as
# part of the binary search triage on ChromeOS objects and packages. It should
# return '0' if the setup succeeds; and '1' if the setup fails (the image
# could not built or be flashed).
#

export PYTHONUNBUFFERED=1

source common/common.sh

echo "BUILDING IMAGE"
pushd ~/trunk/src/scripts
./build_image test --board=${BISECT_BOARD} --noenable_rootfs_verification --noeclean
build_status=$?
popd

if [[ ${build_status} -eq 0 ]] ; then
    echo
    echo "INSTALLING IMAGE VIA USB (requires some manual intervention)"
    echo
    echo "Insert a usb stick into the current machine"
    echo "Note: The cros flash will take time and doesn't give much output."
    echo "      Be patient. If your usb access light is flashing it's working."
    sleep 1
    read -p "Press enter to continue" notused

    cros flash --board=${BISECT_BOARD} --clobber-stateful usb:// ~/trunk/src/build/images/${BISECT_BOARD}/latest/chromiumos_test_image.bin

    echo
    echo "Flash to usb complete!"
    echo "Plug the usb into your chromebook and install the image."
    echo "Refer to the ChromiumOS Developer's Handbook for more details."
    echo "http://www.chromium.org/chromium-os/developer-guide#TOC-Boot-from-your-USB-disk"
    while true; do
      sleep 1
      read -p "Was the installation of the image successful? " choice
      case $choice in
        [Yy]*) exit 0;;
        [Nn]*) exit 1;;
        *) echo "Please answer y or n.";;
      esac
    done
else
    echo "build_image returned a non-zero status: ${build_status}"
    exit 1
fi

exit 0