blob: a923430b411a57468bbe5a3c4127add1aff2d5af [file] [log] [blame]
Ryan Cairnsdd1ceb82010-03-02 21:35:01 -08001#!/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
jglasgowcc71f3a2010-03-12 14:30:21 -05007set -e
Ryan Cairnsdd1ceb82010-03-02 21:35:01 -08008
jglasgowcc71f3a2010-03-12 14:30:21 -05009build=1
10
11if [ x$1 == x-n ] ; then
12 shift
13 build=0
14fi
15
16DEVKIT_URL=$(grep ^CHROMEOS_DEVSERVER /etc/lsb-release | cut -d = -f 2-)
Ryan Cairnsdd1ceb82010-03-02 21:35:01 -080017BOARD_NAME=$(grep ^CHROMEOS_RELEASE_BOARD $dir/etc/lsb-release | cut -d = -f 2-)
18
19if [ -z $DEVKIT_URL ]
20then
21 echo "No devkit server specified in /etc/lsb-release"
22 exit 1
23fi
24
25if [ -z $BOARD_NAME ]
26then
27 echo "No board specified in /etc/lsb-release"
28 exit 1
29fi
30
31mount -o remount,rw /
jglasgowcc71f3a2010-03-12 14:30:21 -050032mkdir -p /etc/make.profile
Ryan Cairnsdd1ceb82010-03-02 21:35:01 -080033
Chris Sosa7fafe492010-04-21 15:22:37 -070034# Installing emerge into /usr/local installs make.globals needed in
35# /usr/local/etc rather than /etc.
36if [ ! -f /etc/make.globals ]
37then
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
46fi
47
jglasgowcc71f3a2010-03-12 14:30:21 -050048if [ $build == 1 ] ; then
49 echo "Building $1"
50 ESCAPED_PACKAGE=$(python -c "import urllib; print urllib.quote('''$1''')")
51 ESCAPED_BOARD=$(python -c \
Ryan Cairnsdd1ceb82010-03-02 21:35:01 -080052 "import urllib; print urllib.quote('''${BOARD_NAME}''')")
53
jglasgowcc71f3a2010-03-12 14:30:21 -050054 wget $DEVKIT_URL/build --post-data="pkg=${ESCAPED_PACKAGE}&board=${ESCAPED_BOARD}"
55fi
Ryan Cairnsdd1ceb82010-03-02 21:35:01 -080056
57echo "Emerging $1"
58
59export PORTAGE_BINHOST="${DEVKIT_URL}/static/pkgroot/${BOARD_NAME}/packages"
60export PORTAGE_TMPDIR=/tmp
jglasgowcc71f3a2010-03-12 14:30:21 -050061# 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.
64export ACCEPT_KEYWORDS='~x86 x86'
Ryan Cairnsdd1ceb82010-03-02 21:35:01 -080065
Chris Sosa7fafe492010-04-21 15:22:37 -070066FEATURES="-sandbox" emerge --getbinpkg --usepkgonly $1