| OLD | NEW |
| 1 #!/bin/bash -e | 1 #!/bin/bash -e |
| 2 | 2 |
| 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium 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 # Script to install everything needed to build chromium (well, ideally, anyway) | 7 # Script to install everything needed to build chromium (well, ideally, anyway) |
| 8 # See http://code.google.com/p/chromium/wiki/LinuxBuildInstructions | 8 # See http://code.google.com/p/chromium/wiki/LinuxBuildInstructions |
| 9 # and http://code.google.com/p/chromium/wiki/LinuxBuild64Bit | 9 # and http://code.google.com/p/chromium/wiki/LinuxBuild64Bit |
| 10 | 10 |
| 11 usage() { | 11 usage() { |
| 12 echo "Usage: $0 [--options]" | 12 echo "Usage: $0 [--options]" |
| 13 echo "Options:" | 13 echo "Options:" |
| 14 echo "--[no-]syms: enable or disable installation of debugging symbols" | 14 echo "--[no-]syms: enable or disable installation of debugging symbols" |
| 15 echo "--[no-]lib32: enable or disable installation of 32 bit libraries" | 15 echo "--[no-]lib32: enable or disable installation of 32 bit libraries" |
| 16 echo "--no-prompt: silently select standard options/defaults" |
| 16 echo "Script will prompt interactively if options not given." | 17 echo "Script will prompt interactively if options not given." |
| 17 exit 1 | 18 exit 1 |
| 18 } | 19 } |
| 19 | 20 |
| 20 while test "$1" != "" | 21 while test "$1" != "" |
| 21 do | 22 do |
| 22 case "$1" in | 23 case "$1" in |
| 23 --syms) do_inst_syms=1;; | 24 --syms) do_inst_syms=1;; |
| 24 --no-syms) do_inst_syms=0;; | 25 --no-syms) do_inst_syms=0;; |
| 25 --lib32) do_inst_lib32=1;; | 26 --lib32) do_inst_lib32=1;; |
| 26 --no-lib32) do_inst_lib32=0;; | 27 --no-lib32) do_inst_lib32=0;; |
| 28 --no-prompt) do_default=1 |
| 29 do_quietly="-qq --assume-yes" |
| 30 ;; |
| 27 *) usage;; | 31 *) usage;; |
| 28 esac | 32 esac |
| 29 shift | 33 shift |
| 30 done | 34 done |
| 31 | 35 |
| 32 if ! egrep -q \ | 36 if ! egrep -q \ |
| 33 'Ubuntu (10\.04|10\.10|11\.04|11\.10|12\.04|lucid|maverick|natty|oneiric|pre
cise)' \ | 37 'Ubuntu (10\.04|10\.10|11\.04|11\.10|12\.04|lucid|maverick|natty|oneiric|pre
cise)' \ |
| 34 /etc/issue; then | 38 /etc/issue; then |
| 35 echo "Only Ubuntu 10.04 (lucid) through 12.04 (precise) are currently" \ | 39 echo "Only Ubuntu 10.04 (lucid) through 12.04 (precise) are currently" \ |
| 36 "supported" >&2 | 40 "supported" >&2 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 lib_list="$lib_list appmenu-gtk" | 119 lib_list="$lib_list appmenu-gtk" |
| 116 fi | 120 fi |
| 117 | 121 |
| 118 # Waits for the user to press 'Y' or 'N'. Either uppercase of lowercase is | 122 # Waits for the user to press 'Y' or 'N'. Either uppercase of lowercase is |
| 119 # accepted. Returns 0 for 'Y' and 1 for 'N'. If an optional parameter has | 123 # accepted. Returns 0 for 'Y' and 1 for 'N'. If an optional parameter has |
| 120 # been provided to yes_no(), the function also accepts RETURN as a user input. | 124 # been provided to yes_no(), the function also accepts RETURN as a user input. |
| 121 # The parameter specifies the exit code that should be returned in that case. | 125 # The parameter specifies the exit code that should be returned in that case. |
| 122 # The function will echo the user's selection followed by a newline character. | 126 # The function will echo the user's selection followed by a newline character. |
| 123 # Users can abort the function by pressing CTRL-C. This will call "exit 1". | 127 # Users can abort the function by pressing CTRL-C. This will call "exit 1". |
| 124 yes_no() { | 128 yes_no() { |
| 129 if [ 0 -ne "${do_default-0}" ] ; then |
| 130 return $1 |
| 131 fi |
| 125 local c | 132 local c |
| 126 while :; do | 133 while :; do |
| 127 c="$(trap 'stty echo -iuclc icanon 2>/dev/null' EXIT INT TERM QUIT | 134 c="$(trap 'stty echo -iuclc icanon 2>/dev/null' EXIT INT TERM QUIT |
| 128 stty -echo iuclc -icanon 2>/dev/null | 135 stty -echo iuclc -icanon 2>/dev/null |
| 129 dd count=1 bs=1 2>/dev/null | od -An -tx1)" | 136 dd count=1 bs=1 2>/dev/null | od -An -tx1)" |
| 130 case "$c" in | 137 case "$c" in |
| 131 " 0a") if [ -n "$1" ]; then | 138 " 0a") if [ -n "$1" ]; then |
| 132 [ $1 -eq 0 ] && echo "Y" || echo "N" | 139 [ $1 -eq 0 ] && echo "Y" || echo "N" |
| 133 return $1 | 140 return $1 |
| 134 fi | 141 fi |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 elif [ $? -eq 1 ]; then | 194 elif [ $? -eq 1 ]; then |
| 188 # We expect apt-get to have exit status of 1. | 195 # We expect apt-get to have exit status of 1. |
| 189 # This indicates that we cancelled the install with "yes n|". | 196 # This indicates that we cancelled the install with "yes n|". |
| 190 new_list=$(echo "$new_list" | | 197 new_list=$(echo "$new_list" | |
| 191 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d') | 198 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d') |
| 192 new_list=$(echo "$new_list" | sed 's/ *$//') | 199 new_list=$(echo "$new_list" | sed 's/ *$//') |
| 193 if [ -z "$new_list" ] ; then | 200 if [ -z "$new_list" ] ; then |
| 194 echo "No missing packages, and the packages are up-to-date." | 201 echo "No missing packages, and the packages are up-to-date." |
| 195 else | 202 else |
| 196 echo "Installing missing packages: $new_list." | 203 echo "Installing missing packages: $new_list." |
| 197 sudo apt-get install ${new_list} | 204 sudo apt-get install ${do_quietly-} ${new_list} |
| 198 fi | 205 fi |
| 199 echo | 206 echo |
| 200 else | 207 else |
| 201 # An apt-get exit status of 100 indicates that a real error has occurred. | 208 # An apt-get exit status of 100 indicates that a real error has occurred. |
| 202 | 209 |
| 203 # I am intentionally leaving out the '"'s around new_list_cmd, | 210 # I am intentionally leaving out the '"'s around new_list_cmd, |
| 204 # as this makes it easier to cut and paste the output | 211 # as this makes it easier to cut and paste the output |
| 205 echo "The following command failed: " ${new_list_cmd} | 212 echo "The following command failed: " ${new_list_cmd} |
| 206 echo | 213 echo |
| 207 echo "It produces the following output:" | 214 echo "It produces the following output:" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 sed -e 's/[.]so[.][0-9].*/.so/' | | 398 sed -e 's/[.]so[.][0-9].*/.so/' | |
| 392 sort -u); do | 399 sort -u); do |
| 393 [ "x${i##*/}" = "xld-linux.so" ] && continue | 400 [ "x${i##*/}" = "xld-linux.so" ] && continue |
| 394 [ -r "$i" ] && continue | 401 [ -r "$i" ] && continue |
| 395 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | | 402 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | |
| 396 sort -n | tail -n 1)" | 403 sort -n | tail -n 1)" |
| 397 [ -r "$i.$j" ] || continue | 404 [ -r "$i.$j" ] || continue |
| 398 sudo ln -s "${i##*/}.$j" "$i" | 405 sudo ln -s "${i##*/}.$j" "$i" |
| 399 done | 406 done |
| 400 fi | 407 fi |
| OLD | NEW |