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