Chromium Code Reviews| 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" |
|
cmp
2012/04/21 19:39:24
you should add the new flag to the usage here
Peter Mayo
2012/04/21 21:12:32
Done.
| |
| 16 echo "Script will prompt interactively if options not given." | 16 echo "Script will prompt interactively if options not given." |
| 17 exit 1 | 17 exit 1 |
| 18 } | 18 } |
| 19 | 19 |
| 20 while test "$1" != "" | 20 while test "$1" != "" |
| 21 do | 21 do |
| 22 case "$1" in | 22 case "$1" in |
| 23 --syms) do_inst_syms=1;; | 23 --syms) do_inst_syms=1;; |
| 24 --no-syms) do_inst_syms=0;; | 24 --no-syms) do_inst_syms=0;; |
| 25 --lib32) do_inst_lib32=1;; | 25 --lib32) do_inst_lib32=1;; |
| 26 --no-lib32) do_inst_lib32=0;; | 26 --no-lib32) do_inst_lib32=0;; |
| 27 --bot) do_default=1 | |
| 28 do_inst_syms=0 | |
| 29 do_inst_lib32=0 | |
|
cmp
2012/04/21 19:39:24
can you remove these previous two lines? if you l
Peter Mayo
2012/04/21 21:02:55
I had not considered passing both "use the right d
cmp
2012/04/21 21:17:46
Is there a "right defaults" wrt the lib32+syms fla
| |
| 30 do_quiet=--quiet | |
| 31 ;; | |
| 27 *) usage;; | 32 *) usage;; |
| 28 esac | 33 esac |
| 29 shift | 34 shift |
| 30 done | 35 done |
| 31 | 36 |
| 32 if ! egrep -q \ | 37 if ! egrep -q \ |
| 33 'Ubuntu (10\.04|10\.10|11\.04|11\.10|12\.04|lucid|maverick|natty|oneiric|pre cise)' \ | 38 'Ubuntu (10\.04|10\.10|11\.04|11\.10|12\.04|lucid|maverick|natty|oneiric|pre cise)' \ |
| 34 /etc/issue; then | 39 /etc/issue; then |
| 35 echo "Only Ubuntu 10.04 (lucid) through 12.04 (precise) are currently" \ | 40 echo "Only Ubuntu 10.04 (lucid) through 12.04 (precise) are currently" \ |
| 36 "supported" >&2 | 41 "supported" >&2 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 lib_list="$lib_list appmenu-gtk" | 120 lib_list="$lib_list appmenu-gtk" |
| 116 fi | 121 fi |
| 117 | 122 |
| 118 # Waits for the user to press 'Y' or 'N'. Either uppercase of lowercase is | 123 # 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 | 124 # 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. | 125 # 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. | 126 # 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. | 127 # 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". | 128 # Users can abort the function by pressing CTRL-C. This will call "exit 1". |
| 124 yes_no() { | 129 yes_no() { |
| 130 if [ 0 -ne "${do_default-0}" ] ; then | |
| 131 return $1 | |
| 132 fi | |
| 125 local c | 133 local c |
| 126 while :; do | 134 while :; do |
| 127 c="$(trap 'stty echo -iuclc icanon 2>/dev/null' EXIT INT TERM QUIT | 135 c="$(trap 'stty echo -iuclc icanon 2>/dev/null' EXIT INT TERM QUIT |
| 128 stty -echo iuclc -icanon 2>/dev/null | 136 stty -echo iuclc -icanon 2>/dev/null |
| 129 dd count=1 bs=1 2>/dev/null | od -An -tx1)" | 137 dd count=1 bs=1 2>/dev/null | od -An -tx1)" |
| 130 case "$c" in | 138 case "$c" in |
| 131 " 0a") if [ -n "$1" ]; then | 139 " 0a") if [ -n "$1" ]; then |
| 132 [ $1 -eq 0 ] && echo "Y" || echo "N" | 140 [ $1 -eq 0 ] && echo "Y" || echo "N" |
| 133 return $1 | 141 return $1 |
| 134 fi | 142 fi |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 | 181 |
| 174 # We initially run "apt-get" with the --reinstall option and parse its output. | 182 # We initially run "apt-get" with the --reinstall option and parse its output. |
| 175 # This way, we can find all the packages that need to be newly installed | 183 # This way, we can find all the packages that need to be newly installed |
| 176 # without accidentally promoting any packages from "auto" to "manual". | 184 # without accidentally promoting any packages from "auto" to "manual". |
| 177 # We then re-run "apt-get" with just the list of missing packages. | 185 # We then re-run "apt-get" with just the list of missing packages. |
| 178 echo "Finding missing packages..." | 186 echo "Finding missing packages..." |
| 179 packages="${dev_list} ${lib_list} ${dbg_list} ${plugin_list}" | 187 packages="${dev_list} ${lib_list} ${dbg_list} ${plugin_list}" |
| 180 # Intentionally leaving $packages unquoted so it's more readable. | 188 # Intentionally leaving $packages unquoted so it's more readable. |
| 181 echo "Packages required: " $packages | 189 echo "Packages required: " $packages |
| 182 echo | 190 echo |
| 183 new_list_cmd="sudo apt-get install --reinstall $(echo $packages)" | 191 new_list_cmd="sudo apt-get install --reinstall ${do_quiet-} $(echo $packages)" |
|
cmp
2012/04/21 19:39:24
does --quiet imply -y? assuming no, i think you a
Peter Mayo
2012/04/21 21:02:55
--quiet does not, but $do_quiet was supposed to -
| |
| 184 if new_list="$(yes n | LANG=C $new_list_cmd)"; then | 192 if new_list="$(yes n | LANG=C $new_list_cmd)"; then |
| 185 # We probably never hit this following line. | 193 # We probably never hit this following line. |
| 186 echo "No missing packages, and the packages are up-to-date." | 194 echo "No missing packages, and the packages are up-to-date." |
| 187 elif [ $? -eq 1 ]; then | 195 elif [ $? -eq 1 ]; then |
| 188 # We expect apt-get to have exit status of 1. | 196 # We expect apt-get to have exit status of 1. |
| 189 # This indicates that we cancelled the install with "yes n|". | 197 # This indicates that we cancelled the install with "yes n|". |
| 190 new_list=$(echo "$new_list" | | 198 new_list=$(echo "$new_list" | |
| 191 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d') | 199 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d') |
| 192 new_list=$(echo "$new_list" | sed 's/ *$//') | 200 new_list=$(echo "$new_list" | sed 's/ *$//') |
| 193 if [ -z "$new_list" ] ; then | 201 if [ -z "$new_list" ] ; then |
| 194 echo "No missing packages, and the packages are up-to-date." | 202 echo "No missing packages, and the packages are up-to-date." |
| 195 else | 203 else |
| 196 echo "Installing missing packages: $new_list." | 204 echo "Installing missing packages: $new_list." |
| 197 sudo apt-get install ${new_list} | 205 sudo apt-get install ${do_quiet-} ${new_list} |
|
cmp
2012/04/21 19:39:24
does --quiet imply -y? assuming no, i think you a
Peter Mayo
2012/04/21 21:02:55
as above.
| |
| 198 fi | 206 fi |
| 199 echo | 207 echo |
| 200 else | 208 else |
| 201 # An apt-get exit status of 100 indicates that a real error has occurred. | 209 # An apt-get exit status of 100 indicates that a real error has occurred. |
| 202 | 210 |
| 203 # I am intentionally leaving out the '"'s around new_list_cmd, | 211 # I am intentionally leaving out the '"'s around new_list_cmd, |
| 204 # as this makes it easier to cut and paste the output | 212 # as this makes it easier to cut and paste the output |
| 205 echo "The following command failed: " ${new_list_cmd} | 213 echo "The following command failed: " ${new_list_cmd} |
| 206 echo | 214 echo |
| 207 echo "It produces the following output:" | 215 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/' | | 399 sed -e 's/[.]so[.][0-9].*/.so/' | |
| 392 sort -u); do | 400 sort -u); do |
| 393 [ "x${i##*/}" = "xld-linux.so" ] && continue | 401 [ "x${i##*/}" = "xld-linux.so" ] && continue |
| 394 [ -r "$i" ] && continue | 402 [ -r "$i" ] && continue |
| 395 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | | 403 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | |
| 396 sort -n | tail -n 1)" | 404 sort -n | tail -n 1)" |
| 397 [ -r "$i.$j" ] || continue | 405 [ -r "$i.$j" ] || continue |
| 398 sudo ln -s "${i##*/}.$j" "$i" | 406 sudo ln -s "${i##*/}.$j" "$i" |
| 399 done | 407 done |
| 400 fi | 408 fi |
| OLD | NEW |