setup.sh revision c4671bdd601ff945b2cccbfe1aee9f931dc908c7
1#!/bin/bash -u
2#
3# Copyright 2016 Google Inc. All Rights Reserved.
4#
5# This script is part of the ChromeOS object binary search triage process.
6# It should be the first script called by the user, after the user has set up
7# the two necessary build tree directories (see sysroot_wrapper/README).
8#
9# This script requires three arguments.  The first argument must be the name of
10# the board for which this work is being done (e.g. 'daisy', 'lumpy','parrot',
11# etc.).  The second argument must be the name or IP address of the chromebook
12# on which the ChromeOS images will be pushed and tested. The third argument
13# must be the name of the package being bisected (e.g. 'chromeos-chrome',
14# 'cryptohome', etc.).
15#
16# This script generates common/common.sh, which generates enviroment variables
17# used by the other scripts in the object file binary search triage process.
18#
19
20# Set up basic variables.
21bisect_dir=${BISECT_DIR:-/tmp/sysroot_bisect}
22
23BOARD=$1
24REMOTE=$2
25PACKAGE=$3
26
27GOOD_BUILD=${bisect_dir}/good
28BAD_BUILD=${bisect_dir}/bad
29GOOD_LIST=${GOOD_BUILD}/_LIST
30BAD_LIST=${BAD_BUILD}/_LIST
31
32#
33# Verify that the necessary directories exist.
34#
35
36if [[ ! -d ${GOOD_BUILD} ]] ; then
37    echo "Error:  ${GOOD_BUILD} does not exist."
38    exit 1
39fi
40
41if [[ ! -d ${BAD_BUILD} ]] ; then
42    echo "Error:  ${BAD_BUILD} does not exist."
43    exit 1
44fi
45
46if [[ ! -e ${GOOD_LIST} ]] ; then
47    echo "Error:  ${GOOD_LIST} does not exist."
48    exit 1
49fi
50
51if [[ ! -e ${BAD_LIST} ]] ; then
52    echo "Error: ${BAD_LIST} does not exist."
53    exit 1
54fi
55
56COMMON_FILE="common/common.sh"
57
58cat <<-EOF > ${COMMON_FILE}
59
60BISECT_BOARD=${BOARD}
61BISECT_REMOTE=${REMOTE}
62BISECT_PACKAGE=${PACKAGE}
63BISECT_MODE="OBJECT_MODE"
64
65bisect_dir=${bisect_dir}
66
67EOF
68
69chmod 755 ${COMMON_FILE}
70
71exit 0
72