Zdenek Behan | d7bfd86 | 2011-05-11 23:56:46 +0200 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 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 |
| 5 | # found in the LICENSE file. |
| 6 | |
| 7 | # Performs an update of the chroot. |
| 8 | |
| 9 | # Load common CrOS utilities. Inside the chroot this file is installed in |
| 10 | # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
| 11 | # location. |
| 12 | . "$(dirname $0)/common.sh" || ! echo "Unable to load common.sh" || exit 1 |
| 13 | |
| 14 | # Script must run inside the chroot |
| 15 | assert_inside_chroot "$@" |
| 16 | |
| 17 | # Flags |
| 18 | DEFINE_boolean usepkg $FLAGS_TRUE \ |
| 19 | "Use binary packages to bootstrap." |
| 20 | DEFINE_boolean fast ${DEFAULT_FAST} "Call many emerges in parallel" |
| 21 | DEFINE_integer retries -1 \ |
| 22 | "On build failure, the number of times to retry." |
| 23 | |
| 24 | # Parse command line flags |
| 25 | FLAGS "$@" || exit 1 |
| 26 | eval set -- "${FLAGS_ARGV}" |
| 27 | |
| 28 | # Only now can we die on error. shflags functions leak non-zero error codes, |
| 29 | # so will die prematurely if 'set -e' is specified before now. |
| 30 | set -e |
| 31 | |
| 32 | info "Updating chroot" |
| 33 | |
| 34 | # Perform an update of hard-host-depends and world in the chroot. |
| 35 | EMERGE_CMD="emerge" |
| 36 | if [ "${FLAGS_fast}" -eq "${FLAGS_TRUE}" ]; then |
| 37 | EMERGE_CMD="${GCLIENT_ROOT}/chromite/bin/parallel_emerge" |
| 38 | fi |
| 39 | if [ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" ]; then |
| 40 | EMERGE_CMD="${EMERGE_CMD} -g" |
| 41 | fi |
| 42 | eretry sudo -E ${EMERGE_CMD} -uDNv chromeos-base/hard-host-depends world |
| 43 | |