Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2009 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 only works internally at Google. | 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 # Load common constants. This should be the first executable line. |
| 11 # The path to common.sh should be relative to your script's location. | 11 # The path to common.sh should be relative to your script's location. |
| 12 . "$(dirname "$0")/common.sh" | 12 . "$(dirname "$0")/common.sh" |
| 13 | 13 |
| 14 get_default_board | 14 get_default_board |
| 15 | 15 |
| 16 DEFINE_string board "$DEFAULT_BOARD" \ | 16 DEFINE_string board "$DEFAULT_BOARD" \ |
| 17 "The name of the board to check for images." | 17 "The name of the board to check for images." |
| 18 DEFINE_boolean incremental "${FLAGS_FALSE}" "Download incremental build" | 18 DEFINE_boolean incremental "${FLAGS_FALSE}" "Download incremental build" |
| 19 | 19 |
| 20 # Parse command line flags | 20 # Parse command line flags. |
| 21 FLAGS "$@" || exit 1 | 21 FLAGS "$@" || exit 1 |
| 22 eval set -- "${FLAGS_ARGV}" | 22 eval set -- "${FLAGS_ARGV}" |
| 23 | 23 |
| 24 # Check on the board that they are trying to set up. | 24 # Check on the board that they are trying to set up. |
| 25 if [ -z "$FLAGS_board" ] ; then | 25 if [ -z "$FLAGS_board" ] ; then |
| 26 echo "Error: --board required." | 26 die "Error: --board required." |
| 27 exit 1 | |
| 28 fi | 27 fi |
| 29 | 28 |
| 30 IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${FLAGS_board}" | 29 IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${FLAGS_board}" |
| 31 | 30 |
| 32 if [ $FLAGS_board = x86-generic ]; then | 31 if [ $FLAGS_board = x86-generic ]; then |
| 33 if [ "$FLAGS_incremental" -eq "$FLAGS_TRUE" ]; then | 32 if [ "$FLAGS_incremental" -eq "$FLAGS_TRUE" ]; then |
| 34 URL_PREFIX="http://codg174.jail.google.com/archive/x86-generic-inc" | 33 URL_PREFIX="http://codg174.jail.google.com/archive/x86-generic-inc" |
| 35 else | 34 else |
| 36 URL_PREFIX="http://codg163.jail.google.com/archive/x86-generic-rel" | 35 URL_PREFIX="http://codg163.jail.google.com/archive/x86-generic-rel" |
| 37 fi | 36 fi |
| 38 else | 37 else |
| 39 echo "Unrecognized board: $FLAGS_board" >&2 | 38 die "Unrecognized board: $FLAGS_board" >&2 |
|
davidjames
2010/06/22 21:20:54
No need for >&2 here anymore, since you're using "
| |
| 40 exit 1 | |
| 41 fi | 39 fi |
| 42 | 40 |
| 43 LATEST_BUILD=$(curl -s $URL_PREFIX/LATEST) | 41 LATEST_BUILD=$(curl -s $URL_PREFIX/LATEST) |
| 44 LATEST_IMAGE_DIR="$IMAGES_DIR/$LATEST_BUILD" | 42 LATEST_IMAGE_DIR="$IMAGES_DIR/$LATEST_BUILD" |
| 45 if [ ! -e $LATEST_IMAGE_DIR/chromiumos_base_image.bin ]; then | 43 if [ ! -e $LATEST_IMAGE_DIR/chromiumos_base_image.bin ]; then |
| 46 mkdir -p $LATEST_IMAGE_DIR | 44 mkdir -p $LATEST_IMAGE_DIR |
| 47 curl $URL_PREFIX/$LATEST_BUILD/image.zip -o $LATEST_IMAGE_DIR/image.zip \ | 45 curl $URL_PREFIX/$LATEST_BUILD/image.zip -o $LATEST_IMAGE_DIR/image.zip \ |
| 48 || die "Could not download image.zip" | 46 || die "Could not download image.zip" |
| 49 ( cd $LATEST_IMAGE_DIR && unzip -qo image.zip ) \ | 47 ( cd $LATEST_IMAGE_DIR && unzip -qo image.zip ) \ |
| 50 || die "Could not unzip image.zip" | 48 || die "Could not unzip image.zip" |
| 51 fi | 49 fi |
| 52 | 50 |
| 53 echo $LATEST_IMAGE_DIR | 51 echo $LATEST_IMAGE_DIR |
| 54 exit 0 | 52 exit 0 |
| OLD | NEW |