| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 if [ -e /etc/debian_chroot ] | 109 if [ -e /etc/debian_chroot ] |
| 110 then | 110 then |
| 111 INSIDE_CHROOT=1 | 111 INSIDE_CHROOT=1 |
| 112 else | 112 else |
| 113 INSIDE_CHROOT=0 | 113 INSIDE_CHROOT=0 |
| 114 fi | 114 fi |
| 115 | 115 |
| 116 # Directory locations inside the dev chroot | 116 # Directory locations inside the dev chroot |
| 117 CHROOT_TRUNK_DIR="/home/$USER/trunk" | 117 CHROOT_TRUNK_DIR="/home/$USER/trunk" |
| 118 | 118 |
| 119 # Install make for portage ebuilds. Used by build_image and gmergefs. |
| 120 DEFAULT_INSTALL_MASK="/usr/include/ /usr/man /usr/share/man /usr/share/doc \ |
| 121 /usr/share/gtk-doc /usr/share/gtk-2.0 /usr/lib/gtk-2.0/include \ |
| 122 /usr/share/info /usr/share/aclocal /usr/lib/gcc /usr/lib/pkgconfig \ |
| 123 /usr/share/pkgconfig /usr/share/gettext /usr/share/readline /etc/runlevels \ |
| 124 /usr/share/openrc /lib/rc *.a *.la" |
| 125 |
| 119 # Check to ensure not running old scripts | 126 # Check to ensure not running old scripts |
| 120 V_REVERSE='[7m' | 127 V_REVERSE='[7m' |
| 121 V_VIDOFF='[m' | 128 V_VIDOFF='[m' |
| 122 case "$(basename $0)" in | 129 case "$(basename $0)" in |
| 123 build_image.sh|build_platform_packages.sh|customize_rootfs.sh|make_chroot.sh) | 130 build_image.sh|build_platform_packages.sh|customize_rootfs.sh|make_chroot.sh) |
| 124 echo | 131 echo |
| 125 echo "$V_REVERSE============================================================" | 132 echo "$V_REVERSE============================================================" |
| 126 echo "=========================== WARNING ======================" | 133 echo "=========================== WARNING ======================" |
| 127 echo "============================================================$V_VIDOFF" | 134 echo "============================================================$V_VIDOFF" |
| 128 echo | 135 echo |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 } | 295 } |
| 289 | 296 |
| 290 function error { | 297 function error { |
| 291 echo -e "${V_BOLD_RED}ERROR : $1${V_VIDOFF}" | 298 echo -e "${V_BOLD_RED}ERROR : $1${V_VIDOFF}" |
| 292 } | 299 } |
| 293 | 300 |
| 294 function die { | 301 function die { |
| 295 error "$1" | 302 error "$1" |
| 296 exit 1 | 303 exit 1 |
| 297 } | 304 } |
| 305 |
| 306 # Retry an emerge command according to $FLAGS_retries |
| 307 # The $EMERGE_JOBS flags will only be added the first time the command is run |
| 308 function eretry () { |
| 309 $* $EMERGE_JOBS && return 0 |
| 310 local i= |
| 311 for i in $(seq $FLAGS_retries); do |
| 312 echo Retrying $* |
| 313 $* && return 0 |
| 314 done |
| 315 return 1 |
| 316 } |
| 317 |
| 318 # Removes single quotes around parameter |
| 319 # Arguments: |
| 320 # $1 - string which optionally has surrounding quotes |
| 321 # Returns: |
| 322 # None, but prints the string without quotes. |
| 323 function remove_quotes() { |
| 324 echo "$1" | sed -e "s/^'//; s/'$//" |
| 325 } |
| OLD | NEW |