| OLD | NEW |
| 1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 # Common constants for build scripts | 5 # Common constants for build scripts |
| 6 # This must evaluate properly for both /bin/bash and /bin/sh | 6 # This must evaluate properly for both /bin/bash and /bin/sh |
| 7 | 7 |
| 8 # All scripts should die on error unless commands are specifically excepted | 8 # All scripts should die on error unless commands are specifically excepted |
| 9 # by prefixing with '!' or surrounded by 'set +e' / 'set -e'. | 9 # by prefixing with '!' or surrounded by 'set +e' / 'set -e'. |
| 10 # TODO: Re-enable this once shflags is less prone to dying. | 10 # TODO: Re-enable this once shflags is less prone to dying. |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 if [ -e /etc/debian_chroot ] | 101 if [ -e /etc/debian_chroot ] |
| 102 then | 102 then |
| 103 INSIDE_CHROOT=1 | 103 INSIDE_CHROOT=1 |
| 104 else | 104 else |
| 105 INSIDE_CHROOT=0 | 105 INSIDE_CHROOT=0 |
| 106 fi | 106 fi |
| 107 | 107 |
| 108 # Directory locations inside the dev chroot | 108 # Directory locations inside the dev chroot |
| 109 CHROOT_TRUNK_DIR="/home/$USER/trunk" | 109 CHROOT_TRUNK_DIR="/home/$USER/trunk" |
| 110 | 110 |
| 111 # Check to ensure not running old scripts |
| 112 V_REVERSE='[7m' |
| 113 V_VIDOFF='[m' |
| 114 case "$(basename $0)" in |
| 115 build_image.sh|build_platform_packages.sh|customize_rootfs.sh|make_chroot.sh) |
| 116 echo |
| 117 echo "$V_REVERSE============================================================" |
| 118 echo "=========================== WARNING ======================" |
| 119 echo "============================================================$V_VIDOFF" |
| 120 echo |
| 121 echo "RUNNING OLD BUILD SYSTEM SCRIPTS. RUN THE PORTAGE-BASED BUILD HERE:" |
| 122 echo "http://www.chromium.org/chromium-os/building-chromium-os/portage-based-b
uild" |
| 123 echo |
| 124 if [ "$USER" != "chrome-bot" ] |
| 125 then |
| 126 read -n1 -p "Press any key to continue using the OLD build system..." |
| 127 echo |
| 128 echo |
| 129 fi |
| 130 ;; |
| 131 esac |
| 132 |
| 111 # ----------------------------------------------------------------------------- | 133 # ----------------------------------------------------------------------------- |
| 112 # Functions | 134 # Functions |
| 113 | 135 |
| 114 # Make a package | 136 # Make a package |
| 115 function make_pkg_common { | 137 function make_pkg_common { |
| 116 # Positional parameters from calling script. :? means "fail if unset". | 138 # Positional parameters from calling script. :? means "fail if unset". |
| 117 set -e | 139 set -e |
| 118 PKG_BASE=${1:?} | 140 PKG_BASE=${1:?} |
| 119 shift | 141 shift |
| 120 set +e | 142 set +e |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 then | 208 then |
| 187 echo "Can't find $PKG_NAME; attempting to install it." | 209 echo "Can't find $PKG_NAME; attempting to install it." |
| 188 sudo apt-get --yes --force-yes install $PKG_NAME | 210 sudo apt-get --yes --force-yes install $PKG_NAME |
| 189 fi | 211 fi |
| 190 } | 212 } |
| 191 | 213 |
| 192 # Returns true if the input file is whitelisted. | 214 # Returns true if the input file is whitelisted. |
| 193 # | 215 # |
| 194 # $1 - The file to check | 216 # $1 - The file to check |
| 195 is_whitelisted() { | 217 is_whitelisted() { |
| 196 local file=$1 | 218 local file=$1 |
| 197 local whitelist="$FLAGS_whitelist" | 219 local whitelist="$FLAGS_whitelist" |
| 198 test -f "$whitelist" || (echo "Whitelist file missing ($whitelist)" && exit 1) | 220 test -f "$whitelist" || (echo "Whitelist file missing ($whitelist)" && exit 1) |
| 199 | 221 |
| 200 local checksum=$(md5sum "$file" | awk '{ print $1 }') | 222 local checksum=$(md5sum "$file" | awk '{ print $1 }') |
| 201 local count=$(sed -e "s/#.*$//" "${whitelist}" | grep -c "$checksum" \ | 223 local count=$(sed -e "s/#.*$//" "${whitelist}" | grep -c "$checksum" \ |
| 202 || /bin/true) | 224 || /bin/true) |
| 203 test $count -ne 0 | 225 test $count -ne 0 |
| 204 } | 226 } |
| OLD | NEW |