OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 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 # Downloads the latest buildbot image and prints the path to it. | 7 # Downloads the latest buildbot image and prints the path to it. |
8 # This script only works if you have access to buildbot images. | 8 # This script only works if you have access to buildbot images. |
9 | 9 |
10 # Load common constants. This should be the first executable line. | 10 # --- BEGIN COMMON.SH BOILERPLATE --- |
11 # The path to common.sh should be relative to your script's location. | 11 # Load common CrOS utilities. Inside the chroot this file is installed in |
12 . "$(dirname "$0")/common.sh" | 12 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
| 13 # location. |
| 14 find_common_sh() { |
| 15 local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")")) |
| 16 local path |
| 17 |
| 18 SCRIPT_ROOT= |
| 19 for path in "${common_paths[@]}"; do |
| 20 if [ -r "${path}/common.sh" ]; then |
| 21 SCRIPT_ROOT=${path} |
| 22 break |
| 23 fi |
| 24 done |
| 25 } |
| 26 |
| 27 find_common_sh |
| 28 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
| 29 # --- END COMMON.SH BOILERPLATE --- |
13 | 30 |
14 get_default_board | 31 get_default_board |
15 | 32 |
16 DEFINE_string board "$DEFAULT_BOARD" \ | 33 DEFINE_string board "$DEFAULT_BOARD" \ |
17 "The name of the board to check for images." | 34 "The name of the board to check for images." |
18 DEFINE_boolean incremental "${FLAGS_FALSE}" "Download incremental build" | 35 DEFINE_boolean incremental "${FLAGS_FALSE}" "Download incremental build" |
19 | 36 |
20 # Parse command line flags. | 37 # Parse command line flags. |
21 FLAGS "$@" || exit 1 | 38 FLAGS "$@" || exit 1 |
22 eval set -- "${FLAGS_ARGV}" | 39 eval set -- "${FLAGS_ARGV}" |
(...skipping 27 matching lines...) Expand all Loading... |
50 mkdir -p $LATEST_IMAGE_DIR | 67 mkdir -p $LATEST_IMAGE_DIR |
51 bin/cros_gsdcurl.py $URL_PREFIX/$LATEST_BUILD/image.zip -o \ | 68 bin/cros_gsdcurl.py $URL_PREFIX/$LATEST_BUILD/image.zip -o \ |
52 $LATEST_IMAGE_DIR/image.zip \ | 69 $LATEST_IMAGE_DIR/image.zip \ |
53 || die "Could not download image.zip" | 70 || die "Could not download image.zip" |
54 ( cd $LATEST_IMAGE_DIR && unzip -qo image.zip ) \ | 71 ( cd $LATEST_IMAGE_DIR && unzip -qo image.zip ) \ |
55 || die "Could not unzip image.zip" | 72 || die "Could not unzip image.zip" |
56 fi | 73 fi |
57 | 74 |
58 echo $LATEST_IMAGE_DIR | 75 echo $LATEST_IMAGE_DIR |
59 exit 0 | 76 exit 0 |
OLD | NEW |