Ryan Cairns | dd1ceb8 | 2010-03-02 21:35:01 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Copyright (c) 2009 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 | |
jglasgow | cc71f3a | 2010-03-12 14:30:21 -0500 | [diff] [blame] | 7 | set -e |
Ryan Cairns | dd1ceb8 | 2010-03-02 21:35:01 -0800 | [diff] [blame] | 8 | |
jglasgow | cc71f3a | 2010-03-12 14:30:21 -0500 | [diff] [blame] | 9 | build=1 |
| 10 | |
| 11 | if [ x$1 == x-n ] ; then |
| 12 | shift |
| 13 | build=0 |
| 14 | fi |
| 15 | |
| 16 | DEVKIT_URL=$(grep ^CHROMEOS_DEVSERVER /etc/lsb-release | cut -d = -f 2-) |
Ryan Cairns | dd1ceb8 | 2010-03-02 21:35:01 -0800 | [diff] [blame] | 17 | BOARD_NAME=$(grep ^CHROMEOS_RELEASE_BOARD $dir/etc/lsb-release | cut -d = -f 2-) |
| 18 | |
| 19 | if [ -z $DEVKIT_URL ] |
| 20 | then |
| 21 | echo "No devkit server specified in /etc/lsb-release" |
| 22 | exit 1 |
| 23 | fi |
| 24 | |
| 25 | if [ -z $BOARD_NAME ] |
| 26 | then |
| 27 | echo "No board specified in /etc/lsb-release" |
| 28 | exit 1 |
| 29 | fi |
| 30 | |
| 31 | mount -o remount,rw / |
jglasgow | cc71f3a | 2010-03-12 14:30:21 -0500 | [diff] [blame] | 32 | mkdir -p /etc/make.profile |
Ryan Cairns | dd1ceb8 | 2010-03-02 21:35:01 -0800 | [diff] [blame] | 33 | |
Chris Sosa | 7fafe49 | 2010-04-21 15:22:37 -0700 | [diff] [blame^] | 34 | # Installing emerge into /usr/local installs make.globals needed in |
| 35 | # /usr/local/etc rather than /etc. |
| 36 | if [ ! -f /etc/make.globals ] |
| 37 | then |
| 38 | if [ -f /usr/local/etc/make.globals ] |
| 39 | then |
| 40 | echo "Missing /etc/make.globals, copying over from /usr/local/etc" |
| 41 | sudo cp /usr/local/etc/make.globals /etc |
| 42 | else |
| 43 | echo "Missing /etc/make.globals and none in /usr/local/etc. Aborting." |
| 44 | exit 1 |
| 45 | fi |
| 46 | fi |
| 47 | |
jglasgow | cc71f3a | 2010-03-12 14:30:21 -0500 | [diff] [blame] | 48 | if [ $build == 1 ] ; then |
| 49 | echo "Building $1" |
| 50 | ESCAPED_PACKAGE=$(python -c "import urllib; print urllib.quote('''$1''')") |
| 51 | ESCAPED_BOARD=$(python -c \ |
Ryan Cairns | dd1ceb8 | 2010-03-02 21:35:01 -0800 | [diff] [blame] | 52 | "import urllib; print urllib.quote('''${BOARD_NAME}''')") |
| 53 | |
jglasgow | cc71f3a | 2010-03-12 14:30:21 -0500 | [diff] [blame] | 54 | wget $DEVKIT_URL/build --post-data="pkg=${ESCAPED_PACKAGE}&board=${ESCAPED_BOARD}" |
| 55 | fi |
Ryan Cairns | dd1ceb8 | 2010-03-02 21:35:01 -0800 | [diff] [blame] | 56 | |
| 57 | echo "Emerging $1" |
| 58 | |
| 59 | export PORTAGE_BINHOST="${DEVKIT_URL}/static/pkgroot/${BOARD_NAME}/packages" |
| 60 | export PORTAGE_TMPDIR=/tmp |
jglasgow | cc71f3a | 2010-03-12 14:30:21 -0500 | [diff] [blame] | 61 | # TODO(rtc): Revisit setting ~x86. |
| 62 | # If we add support to build recursive deps this might pull in |
| 63 | # unstable changes from upstream for packages that you do not want. |
| 64 | export ACCEPT_KEYWORDS='~x86 x86' |
Ryan Cairns | dd1ceb8 | 2010-03-02 21:35:01 -0800 | [diff] [blame] | 65 | |
Chris Sosa | 7fafe49 | 2010-04-21 15:22:37 -0700 | [diff] [blame^] | 66 | FEATURES="-sandbox" emerge --getbinpkg --usepkgonly $1 |