blob: f94838df05c25860671500dc9bce6bb42c576e31 [file] [log] [blame]
Zdenek Behand7bfd862011-05-11 23:56:46 +02001#!/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
15assert_inside_chroot "$@"
16
17# Flags
18DEFINE_boolean usepkg $FLAGS_TRUE \
19 "Use binary packages to bootstrap."
20DEFINE_boolean fast ${DEFAULT_FAST} "Call many emerges in parallel"
21DEFINE_integer retries -1 \
22 "On build failure, the number of times to retry."
23
24# Parse command line flags
25FLAGS "$@" || exit 1
26eval 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.
30set -e
31
32info "Updating chroot"
33
34# Perform an update of hard-host-depends and world in the chroot.
35EMERGE_CMD="emerge"
36if [ "${FLAGS_fast}" -eq "${FLAGS_TRUE}" ]; then
37 EMERGE_CMD="${GCLIENT_ROOT}/chromite/bin/parallel_emerge"
38fi
39if [ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" ]; then
40 EMERGE_CMD="${EMERGE_CMD} -g"
41fi
42eretry sudo -E ${EMERGE_CMD} -uDNv chromeos-base/hard-host-depends world
43