[email protected] | e041ed1 | 2009-03-10 16:43:01 | [diff] [blame] | 1 | #!/bin/bash -e |
| 2 | |
[email protected] | aac39c9 | 2012-02-08 18:39:53 | [diff] [blame] | 3 | # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | e46cdae | 2009-08-25 20:59:27 | [diff] [blame] | 4 | # Use of this source code is governed by a BSD-style license that can be |
| 5 | # found in the LICENSE file. |
| 6 | |
[email protected] | cf1df40 | 2008-10-31 21:45:30 | [diff] [blame] | 7 | # Script to install everything needed to build chromium (well, ideally, anyway) |
mostynb | df175a8 | 2016-02-08 23:27:20 | [diff] [blame] | 8 | # See https://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_instructions.md |
[email protected] | cf1df40 | 2008-10-31 21:45:30 | [diff] [blame] | 9 | |
[email protected] | 1eae2bfb | 2010-01-26 18:17:53 | [diff] [blame] | 10 | usage() { |
| 11 | echo "Usage: $0 [--options]" |
| 12 | echo "Options:" |
| 13 | echo "--[no-]syms: enable or disable installation of debugging symbols" |
johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 14 | echo "--lib32: enable installation of 32-bit libraries, e.g. for V8 snapshot" |
[email protected] | f2826b6a | 2012-11-15 01:06:26 | [diff] [blame] | 15 | echo "--[no-]arm: enable or disable installation of arm cross toolchain" |
[email protected] | bd29cdd | 2013-02-22 03:49:20 | [diff] [blame] | 16 | echo "--[no-]chromeos-fonts: enable or disable installation of Chrome OS"\ |
| 17 | "fonts" |
[email protected] | 56541636 | 2014-01-16 21:26:47 | [diff] [blame] | 18 | echo "--[no-]nacl: enable or disable installation of prerequisites for"\ |
| 19 | "building standalone NaCl and all its toolchains" |
[email protected] | e2544ed4 | 2012-04-23 04:48:31 | [diff] [blame] | 20 | echo "--no-prompt: silently select standard options/defaults" |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 21 | echo "--quick-check: quickly try to determine if dependencies are installed" |
| 22 | echo " (this avoids interactive prompts and sudo commands," |
| 23 | echo " so might not be 100% accurate)" |
| 24 | echo "--unsupported: attempt installation even on unsupported systems" |
[email protected] | 1eae2bfb | 2010-01-26 18:17:53 | [diff] [blame] | 25 | echo "Script will prompt interactively if options not given." |
| 26 | exit 1 |
| 27 | } |
| 28 | |
thomasanderson | 4e3d30fe | 2016-12-07 18:58:34 | [diff] [blame] | 29 | # Waits for the user to press 'Y' or 'N'. Either uppercase of lowercase is |
| 30 | # accepted. Returns 0 for 'Y' and 1 for 'N'. If an optional parameter has |
| 31 | # been provided to yes_no(), the function also accepts RETURN as a user input. |
| 32 | # The parameter specifies the exit code that should be returned in that case. |
| 33 | # The function will echo the user's selection followed by a newline character. |
| 34 | # Users can abort the function by pressing CTRL-C. This will call "exit 1". |
| 35 | yes_no() { |
| 36 | if [ 0 -ne "${do_default-0}" ] ; then |
| 37 | [ $1 -eq 0 ] && echo "Y" || echo "N" |
| 38 | return $1 |
| 39 | fi |
| 40 | local c |
| 41 | while :; do |
| 42 | c="$(trap 'stty echo -iuclc icanon 2>/dev/null' EXIT INT TERM QUIT |
| 43 | stty -echo iuclc -icanon 2>/dev/null |
| 44 | dd count=1 bs=1 2>/dev/null | od -An -tx1)" |
| 45 | case "$c" in |
| 46 | " 0a") if [ -n "$1" ]; then |
| 47 | [ $1 -eq 0 ] && echo "Y" || echo "N" |
| 48 | return $1 |
| 49 | fi |
| 50 | ;; |
| 51 | " 79") echo "Y" |
| 52 | return 0 |
| 53 | ;; |
| 54 | " 6e") echo "N" |
| 55 | return 1 |
| 56 | ;; |
| 57 | "") echo "Aborted" >&2 |
| 58 | exit 1 |
| 59 | ;; |
| 60 | *) # The user pressed an unrecognized key. As we are not echoing |
| 61 | # any incorrect user input, alert the user by ringing the bell. |
| 62 | (tput bel) 2>/dev/null |
| 63 | ;; |
| 64 | esac |
| 65 | done |
| 66 | } |
| 67 | |
[email protected] | 4fc0071 | 2013-05-29 23:11:20 | [diff] [blame] | 68 | # Checks whether a particular package is available in the repos. |
| 69 | # USAGE: $ package_exists <package name> |
| 70 | package_exists() { |
Tom Anderson | 17d6cdd | 2017-11-28 04:13:25 | [diff] [blame^] | 71 | # 'apt-cache search' takes a regex string, so eg. the +'s in packages like |
| 72 | # "libstdc++" need to be escaped. |
| 73 | local escaped="$(echo $1 | sed 's/[\~\+\.\:-]/\\&/g')" |
| 74 | [ ! -z "$(apt-cache search --names-only "${escaped}" | \ |
Tom Anderson | 9c70eb7 | 2017-11-27 21:47:38 | [diff] [blame] | 75 | awk '$1 == "'$1'" { print $1; }')" ] |
[email protected] | 4fc0071 | 2013-05-29 23:11:20 | [diff] [blame] | 76 | } |
| 77 | |
[email protected] | fbeddf2 | 2014-01-17 23:59:01 | [diff] [blame] | 78 | # These default to on because (some) bots need them and it keeps things |
| 79 | # simple for the bot setup if all bots just run the script in its default |
| 80 | # mode. Developers who don't want stuff they don't need installed on their |
| 81 | # own workstations can pass --no-arm --no-nacl when running the script. |
| 82 | do_inst_arm=1 |
| 83 | do_inst_nacl=1 |
| 84 | |
[email protected] | 1eae2bfb | 2010-01-26 18:17:53 | [diff] [blame] | 85 | while test "$1" != "" |
| 86 | do |
| 87 | case "$1" in |
[email protected] | ce77464 | 2011-09-12 23:21:39 | [diff] [blame] | 88 | --syms) do_inst_syms=1;; |
| 89 | --no-syms) do_inst_syms=0;; |
[email protected] | ce77464 | 2011-09-12 23:21:39 | [diff] [blame] | 90 | --lib32) do_inst_lib32=1;; |
[email protected] | f2826b6a | 2012-11-15 01:06:26 | [diff] [blame] | 91 | --arm) do_inst_arm=1;; |
| 92 | --no-arm) do_inst_arm=0;; |
[email protected] | bd29cdd | 2013-02-22 03:49:20 | [diff] [blame] | 93 | --chromeos-fonts) do_inst_chromeos_fonts=1;; |
| 94 | --no-chromeos-fonts) do_inst_chromeos_fonts=0;; |
[email protected] | 56541636 | 2014-01-16 21:26:47 | [diff] [blame] | 95 | --nacl) do_inst_nacl=1;; |
| 96 | --no-nacl) do_inst_nacl=0;; |
[email protected] | e2544ed4 | 2012-04-23 04:48:31 | [diff] [blame] | 97 | --no-prompt) do_default=1 |
| 98 | do_quietly="-qq --assume-yes" |
| 99 | ;; |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 100 | --quick-check) do_quick_check=1;; |
[email protected] | fe63a02 | 2013-01-15 22:11:47 | [diff] [blame] | 101 | --unsupported) do_unsupported=1;; |
[email protected] | 1eae2bfb | 2010-01-26 18:17:53 | [diff] [blame] | 102 | *) usage;; |
| 103 | esac |
| 104 | shift |
| 105 | done |
| 106 | |
johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 107 | if test "$do_inst_arm" = "1"; then |
| 108 | do_inst_lib32=1 |
| 109 | fi |
| 110 | |
[email protected] | 0febc9b | 2014-05-22 20:07:19 | [diff] [blame] | 111 | # Check for lsb_release command in $PATH |
| 112 | if ! which lsb_release > /dev/null; then |
| 113 | echo "ERROR: lsb_release not found in \$PATH" >&2 |
| 114 | exit 1; |
| 115 | fi |
[email protected] | f2826b6a | 2012-11-15 01:06:26 | [diff] [blame] | 116 | |
thomasanderson | dfefc6c0 | 2017-05-04 01:29:11 | [diff] [blame] | 117 | distro_codename=$(lsb_release --codename --short) |
| 118 | distro_id=$(lsb_release --id --short) |
marcin | 38933dd | 2017-10-30 00:05:52 | [diff] [blame] | 119 | supported_codenames="(trusty|xenial|zesty|artful)" |
thomasanderson | dfefc6c0 | 2017-05-04 01:29:11 | [diff] [blame] | 120 | supported_ids="(Debian)" |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 121 | if [ 0 -eq "${do_unsupported-0}" ] && [ 0 -eq "${do_quick_check-0}" ] ; then |
thomasanderson | dfefc6c0 | 2017-05-04 01:29:11 | [diff] [blame] | 122 | if [[ ! $distro_codename =~ $supported_codenames && |
| 123 | ! $distro_id =~ $supported_ids ]]; then |
thomasanderson | 05c4029 | 2017-03-28 19:28:45 | [diff] [blame] | 124 | echo -e "ERROR: The only supported distros are\n" \ |
| 125 | "\tUbuntu 14.04 (trusty)\n" \ |
| 126 | "\tUbuntu 16.04 (xenial)\n" \ |
marcin | 3a0793a | 2017-06-30 03:51:28 | [diff] [blame] | 127 | "\tUbuntu 17.04 (zesty)\n" \ |
marcin | 38933dd | 2017-10-30 00:05:52 | [diff] [blame] | 128 | "\tUbuntu 17.10 (artful)\n" \ |
thomasanderson | dfefc6c0 | 2017-05-04 01:29:11 | [diff] [blame] | 129 | "\tDebian 8 (jessie) or later" >&2 |
anthonyvd | 2ae919e5 | 2016-11-21 19:47:12 | [diff] [blame] | 130 | exit 1 |
[email protected] | fe63a02 | 2013-01-15 22:11:47 | [diff] [blame] | 131 | fi |
[email protected] | cf1df40 | 2008-10-31 21:45:30 | [diff] [blame] | 132 | |
[email protected] | fe63a02 | 2013-01-15 22:11:47 | [diff] [blame] | 133 | if ! uname -m | egrep -q "i686|x86_64"; then |
anthonyvd | 2ae919e5 | 2016-11-21 19:47:12 | [diff] [blame] | 134 | echo "Only x86 architectures are currently supported" >&2 |
[email protected] | fe63a02 | 2013-01-15 22:11:47 | [diff] [blame] | 135 | exit |
| 136 | fi |
[email protected] | e041ed1 | 2009-03-10 16:43:01 | [diff] [blame] | 137 | fi |
| 138 | |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 139 | if [ "x$(id -u)" != x0 ] && [ 0 -eq "${do_quick_check-0}" ]; then |
[email protected] | e041ed1 | 2009-03-10 16:43:01 | [diff] [blame] | 140 | echo "Running as non-root user." |
| 141 | echo "You might have to enter your password one or more times for 'sudo'." |
[email protected] | 8ada8c5 | 2009-03-10 21:53:08 | [diff] [blame] | 142 | echo |
[email protected] | e041ed1 | 2009-03-10 16:43:01 | [diff] [blame] | 143 | fi |
| 144 | |
[email protected] | fdc6bf5 | 2010-06-07 22:01:57 | [diff] [blame] | 145 | # Packages needed for chromeos only |
dnj | 6a8491d1 | 2015-05-26 21:08:12 | [diff] [blame] | 146 | chromeos_dev_list="libbluetooth-dev libxkbcommon-dev realpath" |
[email protected] | fdc6bf5 | 2010-06-07 22:01:57 | [diff] [blame] | 147 | |
[email protected] | b61f688 | 2013-11-14 20:41:41 | [diff] [blame] | 148 | # Packages needed for development |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 149 | dev_list="\ |
| 150 | bison |
| 151 | cdbs |
| 152 | curl |
| 153 | dpkg-dev |
| 154 | elfutils |
| 155 | devscripts |
| 156 | fakeroot |
| 157 | flex |
| 158 | fonts-ipafont |
| 159 | fonts-thai-tlwg |
| 160 | g++ |
| 161 | git-core |
| 162 | git-svn |
| 163 | gperf |
| 164 | libasound2-dev |
| 165 | libbrlapi-dev |
| 166 | libav-tools |
| 167 | libbz2-dev |
| 168 | libcairo2-dev |
| 169 | libcap-dev |
| 170 | libcups2-dev |
| 171 | libcurl4-gnutls-dev |
Tim Brown | 357bdbf | 2017-09-29 19:11:29 | [diff] [blame] | 172 | libdconf-dev |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 173 | libdrm-dev |
| 174 | libelf-dev |
| 175 | libffi-dev |
| 176 | libgconf2-dev |
| 177 | libglib2.0-dev |
| 178 | libglu1-mesa-dev |
| 179 | libgnome-keyring-dev |
| 180 | libgtk2.0-dev |
| 181 | libgtk-3-dev |
| 182 | libkrb5-dev |
| 183 | libnspr4-dev |
| 184 | libnss3-dev |
| 185 | libpam0g-dev |
| 186 | libpci-dev |
| 187 | libpulse-dev |
| 188 | libsctp-dev |
| 189 | libspeechd-dev |
| 190 | libsqlite3-dev |
| 191 | libssl-dev |
| 192 | libudev-dev |
| 193 | libwww-perl |
| 194 | libxslt1-dev |
| 195 | libxss-dev |
| 196 | libxt-dev |
| 197 | libxtst-dev |
Andrew Grieve | e41aeae | 2017-08-21 20:53:21 | [diff] [blame] | 198 | locales |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 199 | openbox |
| 200 | patch |
| 201 | perl |
| 202 | pkg-config |
| 203 | python |
| 204 | python-cherrypy3 |
| 205 | python-crypto |
| 206 | python-dev |
| 207 | python-numpy |
| 208 | python-opencv |
| 209 | python-openssl |
| 210 | python-psutil |
| 211 | python-yaml |
| 212 | rpm |
| 213 | ruby |
| 214 | subversion |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 215 | wdiff |
Tom Anderson | d79de41d | 2017-08-08 00:23:23 | [diff] [blame] | 216 | x11-utils |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 217 | xcompmgr |
| 218 | zip |
| 219 | $chromeos_dev_list |
| 220 | " |
[email protected] | fdc6bf5 | 2010-06-07 22:01:57 | [diff] [blame] | 221 | |
[email protected] | f16aabf | 2012-08-15 21:00:14 | [diff] [blame] | 222 | # 64-bit systems need a minimum set of 32-bit compat packages for the pre-built |
[email protected] | f8ceadb | 2014-08-18 12:30:23 | [diff] [blame] | 223 | # NaCl binaries. |
ki.stfu | 0a79d699 | 2015-09-17 07:27:12 | [diff] [blame] | 224 | if file -L /sbin/init | grep -q 'ELF 64-bit'; then |
[email protected] | d93d68b1 | 2012-10-15 06:39:53 | [diff] [blame] | 225 | dev_list="${dev_list} libc6-i386 lib32gcc1 lib32stdc++6" |
[email protected] | f16aabf | 2012-08-15 21:00:14 | [diff] [blame] | 226 | fi |
| 227 | |
[email protected] | fdc6bf5 | 2010-06-07 22:01:57 | [diff] [blame] | 228 | # Run-time libraries required by chromeos only |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 229 | chromeos_lib_list="libpulse0 libbz2-1.0" |
[email protected] | e041ed1 | 2009-03-10 16:43:01 | [diff] [blame] | 230 | |
| 231 | # Full list of required run-time libraries |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 232 | lib_list="\ |
| 233 | libatk1.0-0 |
| 234 | libc6 |
| 235 | libasound2 |
| 236 | libcairo2 |
| 237 | libcap2 |
| 238 | libcups2 |
Tim Brown | 357bdbf | 2017-09-29 19:11:29 | [diff] [blame] | 239 | libdconf1 |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 240 | libexpat1 |
| 241 | libffi6 |
| 242 | libfontconfig1 |
| 243 | libfreetype6 |
| 244 | libglib2.0-0 |
| 245 | libgnome-keyring0 |
| 246 | libgtk2.0-0 |
| 247 | libgtk-3-0 |
| 248 | libpam0g |
| 249 | libpango1.0-0 |
| 250 | libpci3 |
| 251 | libpcre3 |
| 252 | libpixman-1-0 |
| 253 | libspeechd2 |
| 254 | libstdc++6 |
| 255 | libsqlite3-0 |
| 256 | libx11-6 |
| 257 | libx11-xcb1 |
| 258 | libxau6 |
| 259 | libxcb1 |
| 260 | libxcomposite1 |
| 261 | libxcursor1 |
| 262 | libxdamage1 |
| 263 | libxdmcp6 |
| 264 | libxext6 |
| 265 | libxfixes3 |
| 266 | libxi6 |
| 267 | libxinerama1 |
| 268 | libxrandr2 |
| 269 | libxrender1 |
| 270 | libxtst6 |
| 271 | zlib1g |
| 272 | $chromeos_lib_list |
| 273 | " |
[email protected] | e041ed1 | 2009-03-10 16:43:01 | [diff] [blame] | 274 | |
| 275 | # Debugging symbols for all of the run-time libraries |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 276 | dbg_list="\ |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 277 | libc6-dbg |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 278 | libffi6-dbg |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 279 | libgtk2.0-0-dbg |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 280 | libpcre3-dbg |
| 281 | libpixman-1-0-dbg |
| 282 | libsqlite3-0-dbg |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 283 | libxau6-dbg |
| 284 | libxcb1-dbg |
| 285 | libxcomposite1-dbg |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 286 | libxdmcp6-dbg |
| 287 | libxext6-dbg |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 288 | libxinerama1-dbg |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 289 | zlib1g-dbg |
| 290 | " |
lfg | ad917d1 | 2015-03-17 23:28:00 | [diff] [blame] | 291 | |
Tom Anderson | 17d6cdd | 2017-11-28 04:13:25 | [diff] [blame^] | 292 | if package_exists libstdc++6-6-dbg; then |
| 293 | dbg_list="${dbg_list} libstdc++6-6-dbg" |
| 294 | elif package_exists libstdc++6-4.9-dbg; then |
lfg | ad917d1 | 2015-03-17 23:28:00 | [diff] [blame] | 295 | dbg_list="${dbg_list} libstdc++6-4.9-dbg" |
Tom Anderson | 17d6cdd | 2017-11-28 04:13:25 | [diff] [blame^] | 296 | else |
| 297 | dbg_list="${dbg_list} libstdc++6-4.8-dbg" |
| 298 | fi |
| 299 | if package_exists libgtk-3-0-dbgsym; then |
| 300 | lib_list="${lib_list} libgtk-3-0-dbgsym" |
| 301 | elif package_exists libgtk-3-0-dbg; then |
| 302 | lib_list="${lib_list} libgtk-3-0-dbg" |
| 303 | fi |
| 304 | if package_exists libatk1.0-0-dbgsym; then |
| 305 | lib_list="${lib_list} libatk1.0-0-dbgsym" |
| 306 | elif package_exists libatk1.0-dbg; then |
| 307 | lib_list="${lib_list} libatk1.0-dbg" |
| 308 | fi |
| 309 | if package_exists libcairo2-dbgsym; then |
| 310 | lib_list="${lib_list} libcairo2-dbgsym" |
| 311 | elif package_exists libcairo2-dbg; then |
| 312 | lib_list="${lib_list} libcairo2-dbg" |
| 313 | fi |
| 314 | if package_exists libfontconfig1-dbgsym; then |
| 315 | lib_list="${lib_list} libfontconfig1-dbgsym" |
| 316 | else |
| 317 | lib_list="${lib_list} libfontconfig1-dbg" |
| 318 | fi |
| 319 | if package_exists libxdamage1-dbgsym; then |
| 320 | lib_list="${lib_list} libxdamage1-dbgsym" |
| 321 | elif package_exists libxdamage1-dbg; then |
| 322 | lib_list="${lib_list} libxdamage1-dbg" |
| 323 | fi |
| 324 | if package_exists libpango1.0-dev-dbgsym; then |
| 325 | lib_list="${lib_list} libpango1.0-dev-dbgsym" |
| 326 | elif package_exists libpango1.0-0-dbg; then |
| 327 | lib_list="${lib_list} libpango1.0-0-dbg" |
| 328 | fi |
| 329 | if package_exists libx11-6-dbg; then |
| 330 | lib_list="${lib_list} libx11-6-dbg" |
| 331 | fi |
| 332 | if package_exists libx11-xcb1-dbg; then |
| 333 | lib_list="${lib_list} libx11-xcb1-dbg" |
| 334 | fi |
| 335 | if package_exists libxfixes3-dbg; then |
| 336 | lib_list="${lib_list} libxfixes3-dbg" |
| 337 | fi |
| 338 | if package_exists libxi6-dbg; then |
| 339 | lib_list="${lib_list} libxi6-dbg" |
| 340 | fi |
| 341 | if package_exists libxrandr2-dbg; then |
| 342 | lib_list="${lib_list} libxrandr2-dbg" |
| 343 | fi |
| 344 | if package_exists libxrender1-dbg; then |
| 345 | lib_list="${lib_list} libxrender1-dbg" |
| 346 | fi |
| 347 | if package_exists libxtst6-dbg; then |
| 348 | lib_list="${lib_list} libxtst6-dbg" |
| 349 | fi |
| 350 | if package_exists libglib2.0-0-dbg; then |
| 351 | lib_list="${lib_list} libglib2.0-0-dbg" |
| 352 | fi |
| 353 | if package_exists libxcursor1-dbg; then |
| 354 | lib_list="${lib_list} libxcursor1-dbg" |
lfg | ad917d1 | 2015-03-17 23:28:00 | [diff] [blame] | 355 | fi |
[email protected] | e041ed1 | 2009-03-10 16:43:01 | [diff] [blame] | 356 | |
johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 357 | # 32-bit libraries needed e.g. to compile V8 snapshot for Android or armhf |
Tanin Na Nakorn | 6cbe32e5 | 2017-05-30 19:37:04 | [diff] [blame] | 358 | lib32_list="linux-libc-dev:i386 libpci3:i386" |
johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 359 | |
[email protected] | 3f85dac3 | 2013-10-29 02:38:46 | [diff] [blame] | 360 | # arm cross toolchain packages needed to build chrome on armhf |
thomasanderson | 4e3d30fe | 2016-12-07 18:58:34 | [diff] [blame] | 361 | EM_REPO="deb http://emdebian.org/tools/debian/ jessie main" |
| 362 | EM_SOURCE=$(cat <<EOF |
| 363 | # Repo added by Chromium $0 |
| 364 | ${EM_REPO} |
| 365 | # deb-src http://emdebian.org/tools/debian/ jessie main |
| 366 | EOF |
| 367 | ) |
| 368 | EM_ARCHIVE_KEY_FINGER="084C6C6F39159EDB67969AA87DE089671804772E" |
| 369 | GPP_ARM_PACKAGE="g++-arm-linux-gnueabihf" |
thomasanderson | dfefc6c0 | 2017-05-04 01:29:11 | [diff] [blame] | 370 | case $distro_codename in |
kjellander | 95504ae | 2017-03-30 12:30:31 | [diff] [blame] | 371 | jessie) |
thomasanderson | 4e3d30fe | 2016-12-07 18:58:34 | [diff] [blame] | 372 | eval $(apt-config shell APT_SOURCESDIR 'Dir::Etc::sourceparts/d') |
| 373 | CROSSTOOLS_LIST="${APT_SOURCESDIR}/crosstools.list" |
| 374 | arm_list="libc6-dev:armhf |
| 375 | linux-libc-dev:armhf" |
| 376 | if test "$do_inst_arm" = "1"; then |
| 377 | if $(dpkg-query -W ${GPP_ARM_PACKAGE} &>/dev/null); then |
| 378 | arm_list+=" ${GPP_ARM_PACKAGE}" |
| 379 | else |
| 380 | echo "The Debian Cross-toolchains repository is necessary to" |
| 381 | echo "cross-compile Chromium for arm." |
| 382 | echo -n "Do you want me to add it for you (y/N) " |
| 383 | if yes_no 1; then |
| 384 | gpg --keyserver pgp.mit.edu --recv-keys ${EM_ARCHIVE_KEY_FINGER} |
| 385 | gpg -a --export ${EM_ARCHIVE_KEY_FINGER} | sudo apt-key add - |
| 386 | if ! grep "^${EM_REPO}" "${CROSSTOOLS_LIST}" &>/dev/null; then |
| 387 | echo "${EM_SOURCE}" | sudo tee -a "${CROSSTOOLS_LIST}" >/dev/null |
| 388 | fi |
| 389 | arm_list+=" ${GPP_ARM_PACKAGE}" |
| 390 | fi |
| 391 | fi |
| 392 | fi |
| 393 | ;; |
thomasanderson | dfefc6c0 | 2017-05-04 01:29:11 | [diff] [blame] | 394 | # All necessary ARM packages are available on the default repos on |
| 395 | # Debian 9 and later. |
kjellander | 95504ae | 2017-03-30 12:30:31 | [diff] [blame] | 396 | *) |
Tom Anderson | 81e7f179 | 2017-11-11 03:56:33 | [diff] [blame] | 397 | arm_list="libc6-dev-armhf-cross |
thomasanderson | 4e3d30fe | 2016-12-07 18:58:34 | [diff] [blame] | 398 | linux-libc-dev-armhf-cross |
| 399 | ${GPP_ARM_PACKAGE}" |
| 400 | ;; |
| 401 | esac |
[email protected] | 31a60553 | 2011-08-23 22:27:35 | [diff] [blame] | 402 | |
sbc | b5d4ded | 2015-04-01 17:49:03 | [diff] [blame] | 403 | # Work around for dependency issue Ubuntu/Trusty: http://crbug.com/435056 |
thomasanderson | dfefc6c0 | 2017-05-04 01:29:11 | [diff] [blame] | 404 | case $distro_codename in |
friedman | bf8b90a | 2016-04-21 01:15:48 | [diff] [blame] | 405 | trusty) |
| 406 | arm_list+=" g++-4.8-multilib-arm-linux-gnueabihf |
| 407 | gcc-4.8-multilib-arm-linux-gnueabihf" |
| 408 | ;; |
marcin | 38933dd | 2017-10-30 00:05:52 | [diff] [blame] | 409 | xenial|zesty|artful) |
krasin | eef3d4b | 2016-04-22 00:52:18 | [diff] [blame] | 410 | arm_list+=" g++-5-multilib-arm-linux-gnueabihf |
| 411 | gcc-5-multilib-arm-linux-gnueabihf |
| 412 | gcc-arm-linux-gnueabihf" |
| 413 | ;; |
friedman | bf8b90a | 2016-04-21 01:15:48 | [diff] [blame] | 414 | esac |
sbc | b5d4ded | 2015-04-01 17:49:03 | [diff] [blame] | 415 | |
[email protected] | 713eac6 | 2014-06-02 23:10:03 | [diff] [blame] | 416 | # Packages to build NaCl, its toolchains, and its ports. |
Brad Nelson | 5e59c2c | 2014-09-06 06:18:45 | [diff] [blame] | 417 | naclports_list="ant autoconf bison cmake gawk intltool xutils-dev xsltproc" |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 418 | nacl_list="\ |
| 419 | g++-mingw-w64-i686 |
| 420 | lib32z1-dev |
| 421 | libasound2:i386 |
| 422 | libcap2:i386 |
| 423 | libelf-dev:i386 |
Tim Brown | 357bdbf | 2017-09-29 19:11:29 | [diff] [blame] | 424 | libdconf1:i386 |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 425 | libfontconfig1:i386 |
| 426 | libgconf-2-4:i386 |
| 427 | libglib2.0-0:i386 |
| 428 | libgpm2:i386 |
| 429 | libgtk2.0-0:i386 |
| 430 | libgtk-3-0:i386 |
| 431 | libncurses5:i386 |
| 432 | lib32ncurses5-dev |
| 433 | libnss3:i386 |
| 434 | libpango1.0-0:i386 |
thomasanderson | dfefc6c0 | 2017-05-04 01:29:11 | [diff] [blame] | 435 | libssl-dev:i386 |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 436 | libtinfo-dev |
| 437 | libtinfo-dev:i386 |
| 438 | libtool |
| 439 | libxcomposite1:i386 |
| 440 | libxcursor1:i386 |
| 441 | libxdamage1:i386 |
| 442 | libxi6:i386 |
| 443 | libxrandr2:i386 |
| 444 | libxss1:i386 |
| 445 | libxtst6:i386 |
| 446 | texinfo |
| 447 | xvfb |
| 448 | ${naclports_list} |
| 449 | " |
[email protected] | 419a9a6 | 2014-06-19 18:26:18 | [diff] [blame] | 450 | |
thomasanderson | dfefc6c0 | 2017-05-04 01:29:11 | [diff] [blame] | 451 | if package_exists libssl1.0.0; then |
| 452 | nacl_list="${nacl_list} libssl1.0.0:i386" |
| 453 | else |
| 454 | nacl_list="${nacl_list} libssl1.0.2:i386" |
| 455 | fi |
| 456 | |
torne | 8a6eb69 | 2015-11-05 12:43:08 | [diff] [blame] | 457 | # Find the proper version of packages that depend on mesa. Only one -lts variant |
| 458 | # of mesa can be installed and everything that depends on it must match. |
| 459 | |
| 460 | # Query for the name and status of all mesa LTS variants, filter for only |
| 461 | # installed packages, extract just the name, and eliminate duplicates (there can |
| 462 | # be more than one with the same name in the case of multiarch). Expand into an |
| 463 | # array. |
| 464 | mesa_packages=($(dpkg-query -Wf'${package} ${status}\n' \ |
torne | 12cd9f6c | 2016-02-24 18:52:23 | [diff] [blame] | 465 | libgl1-mesa-glx-lts-\* 2>/dev/null | \ |
torne | 8a6eb69 | 2015-11-05 12:43:08 | [diff] [blame] | 466 | grep " ok installed" | cut -d " " -f 1 | sort -u)) |
| 467 | if [ "${#mesa_packages[@]}" -eq 0 ]; then |
| 468 | mesa_variant="" |
| 469 | elif [ "${#mesa_packages[@]}" -eq 1 ]; then |
| 470 | # Strip the base package name and leave just "-lts-whatever" |
| 471 | mesa_variant="${mesa_packages[0]#libgl1-mesa-glx}" |
| 472 | else |
| 473 | echo "ERROR: unable to determine which libgl1-mesa-glx variant is installed." |
| 474 | exit 1 |
| 475 | fi |
[email protected] | 3a4bd5d | 2014-06-25 23:55:04 | [diff] [blame] | 476 | dev_list="${dev_list} libgbm-dev${mesa_variant} |
vabr | f1e8b17f | 2015-03-17 10:56:37 | [diff] [blame] | 477 | libgles2-mesa-dev${mesa_variant} libgl1-mesa-dev${mesa_variant} |
| 478 | mesa-common-dev${mesa_variant}" |
[email protected] | 419a9a6 | 2014-06-19 18:26:18 | [diff] [blame] | 479 | nacl_list="${nacl_list} libgl1-mesa-glx${mesa_variant}:i386" |
[email protected] | 56541636 | 2014-01-16 21:26:47 | [diff] [blame] | 480 | |
[email protected] | 757c296 | 2012-03-15 19:05:18 | [diff] [blame] | 481 | # Some package names have changed over time |
marcin | 73929a7 | 2017-01-04 22:04:58 | [diff] [blame] | 482 | if package_exists libpng12-0; then |
| 483 | lib_list="${lib_list} libpng12-0" |
| 484 | else |
| 485 | lib_list="${lib_list} libpng16-16" |
| 486 | fi |
[email protected] | 4fc0071 | 2013-05-29 23:11:20 | [diff] [blame] | 487 | if package_exists libnspr4-dbg; then |
[email protected] | 1a0f64a | 2011-05-20 17:53:55 | [diff] [blame] | 488 | dbg_list="${dbg_list} libnspr4-dbg libnss3-dbg" |
| 489 | lib_list="${lib_list} libnspr4 libnss3" |
[email protected] | 757c296 | 2012-03-15 19:05:18 | [diff] [blame] | 490 | else |
| 491 | dbg_list="${dbg_list} libnspr4-0d-dbg libnss3-1d-dbg" |
| 492 | lib_list="${lib_list} libnspr4-0d libnss3-1d" |
| 493 | fi |
[email protected] | 4fc0071 | 2013-05-29 23:11:20 | [diff] [blame] | 494 | if package_exists libjpeg-dev; then |
[email protected] | 9e89596 | 2013-05-21 08:26:42 | [diff] [blame] | 495 | dev_list="${dev_list} libjpeg-dev" |
[email protected] | b11411c | 2012-03-21 22:09:41 | [diff] [blame] | 496 | else |
[email protected] | 9e89596 | 2013-05-21 08:26:42 | [diff] [blame] | 497 | dev_list="${dev_list} libjpeg62-dev" |
[email protected] | b11411c | 2012-03-21 22:09:41 | [diff] [blame] | 498 | fi |
[email protected] | 4fc0071 | 2013-05-29 23:11:20 | [diff] [blame] | 499 | if package_exists libudev1; then |
[email protected] | 9e89596 | 2013-05-21 08:26:42 | [diff] [blame] | 500 | dev_list="${dev_list} libudev1" |
[email protected] | ab9e6908 | 2014-06-05 15:28:52 | [diff] [blame] | 501 | nacl_list="${nacl_list} libudev1:i386" |
[email protected] | 9e89596 | 2013-05-21 08:26:42 | [diff] [blame] | 502 | else |
| 503 | dev_list="${dev_list} libudev0" |
[email protected] | ab9e6908 | 2014-06-05 15:28:52 | [diff] [blame] | 504 | nacl_list="${nacl_list} libudev0:i386" |
[email protected] | 9e89596 | 2013-05-21 08:26:42 | [diff] [blame] | 505 | fi |
[email protected] | 3ea4291 | 2013-09-06 06:23:57 | [diff] [blame] | 506 | if package_exists libbrlapi0.6; then |
| 507 | dev_list="${dev_list} libbrlapi0.6" |
| 508 | else |
| 509 | dev_list="${dev_list} libbrlapi0.5" |
| 510 | fi |
halton.huo | 3e728c4 | 2016-01-20 05:12:23 | [diff] [blame] | 511 | if package_exists apache2-bin; then |
| 512 | dev_list="${dev_list} apache2-bin" |
| 513 | else |
| 514 | dev_list="${dev_list} apache2.2-bin" |
| 515 | fi |
vadimsh | 278ff066 | 2016-05-19 00:06:28 | [diff] [blame] | 516 | if package_exists xfonts-mathml; then |
halton.huo | 3e728c4 | 2016-01-20 05:12:23 | [diff] [blame] | 517 | dev_list="${dev_list} xfonts-mathml" |
| 518 | fi |
marcin | 38933dd | 2017-10-30 00:05:52 | [diff] [blame] | 519 | if package_exists php7.1-cgi; then |
| 520 | dev_list="${dev_list} php7.1-cgi libapache2-mod-php7.1" |
| 521 | elif package_exists php7.0-cgi; then |
vadimsh | 278ff066 | 2016-05-19 00:06:28 | [diff] [blame] | 522 | dev_list="${dev_list} php7.0-cgi libapache2-mod-php7.0" |
krasin | eef3d4b | 2016-04-22 00:52:18 | [diff] [blame] | 523 | else |
vadimsh | 278ff066 | 2016-05-19 00:06:28 | [diff] [blame] | 524 | dev_list="${dev_list} php5-cgi libapache2-mod-php5" |
krasin | eef3d4b | 2016-04-22 00:52:18 | [diff] [blame] | 525 | fi |
thomasanderson | b4a2bca | 2016-12-08 06:46:05 | [diff] [blame] | 526 | # ttf-mscorefonts-installer is in the Debian contrib repo, which has |
| 527 | # dependencies on non-free software. Install it only if the user has already |
| 528 | # enabled contrib. |
| 529 | if package_exists ttf-mscorefonts-installer; then |
| 530 | dev_list="${dev_list} ttf-mscorefonts-installer" |
| 531 | elif package_exists msttcorefonts; then |
| 532 | dev_list="${dev_list} msttcorefonts" |
| 533 | fi |
[email protected] | 757c296 | 2012-03-15 19:05:18 | [diff] [blame] | 534 | |
[email protected] | dc09977 | 2013-09-30 22:06:58 | [diff] [blame] | 535 | # Some packages are only needed if the distribution actually supports |
[email protected] | 757c296 | 2012-03-15 19:05:18 | [diff] [blame] | 536 | # installing them. |
[email protected] | 4fc0071 | 2013-05-29 23:11:20 | [diff] [blame] | 537 | if package_exists appmenu-gtk; then |
[email protected] | 757c296 | 2012-03-15 19:05:18 | [diff] [blame] | 538 | lib_list="$lib_list appmenu-gtk" |
[email protected] | 4da8fad | 2011-04-11 18:42:42 | [diff] [blame] | 539 | fi |
| 540 | |
Tom Anderson | 81e7f179 | 2017-11-11 03:56:33 | [diff] [blame] | 541 | # Cross-toolchain strip is needed for building the sysroots. |
| 542 | if package_exists binutils-arm-linux-gnueabihf; then |
| 543 | dev_list="${dev_list} binutils-arm-linux-gnueabihf" |
| 544 | fi |
| 545 | if package_exists binutils-aarch64-linux-gnu; then |
| 546 | dev_list="${dev_list} binutils-aarch64-linux-gnu" |
| 547 | fi |
| 548 | if package_exists binutils-mipsel-linux-gnu; then |
| 549 | dev_list="${dev_list} binutils-mipsel-linux-gnu" |
| 550 | fi |
| 551 | if package_exists binutils-mips64el-linux-gnuabi64; then |
| 552 | dev_list="${dev_list} binutils-mips64el-linux-gnuabi64" |
| 553 | fi |
| 554 | |
johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 555 | # When cross building for arm/Android on 64-bit systems the host binaries |
| 556 | # that are part of v8 need to be compiled with -m32 which means |
| 557 | # that basic multilib support is needed. |
ki.stfu | 0a79d699 | 2015-09-17 07:27:12 | [diff] [blame] | 558 | if file -L /sbin/init | grep -q 'ELF 64-bit'; then |
johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 559 | # gcc-multilib conflicts with the arm cross compiler (at least in trusty) but |
| 560 | # g++-X.Y-multilib gives us the 32-bit support that we need. Find out the |
| 561 | # appropriate value of X and Y by seeing what version the current |
| 562 | # distribution's g++-multilib package depends on. |
| 563 | multilib_package=$(apt-cache depends g++-multilib --important | \ |
| 564 | grep -E --color=never --only-matching '\bg\+\+-[0-9.]+-multilib\b') |
| 565 | lib32_list="$lib32_list $multilib_package" |
| 566 | fi |
| 567 | |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 568 | if test "$do_inst_syms" = "" && test 0 -eq ${do_quick_check-0} |
[email protected] | 1eae2bfb | 2010-01-26 18:17:53 | [diff] [blame] | 569 | then |
| 570 | echo "This script installs all tools and libraries needed to build Chromium." |
| 571 | echo "" |
| 572 | echo "For most of the libraries, it can also install debugging symbols, which" |
| 573 | echo "will allow you to debug code in the system libraries. Most developers" |
| 574 | echo "won't need these symbols." |
| 575 | echo -n "Do you want me to install them for you (y/N) " |
| 576 | if yes_no 1; then |
| 577 | do_inst_syms=1 |
| 578 | fi |
| 579 | fi |
| 580 | if test "$do_inst_syms" = "1"; then |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 581 | echo "Including debugging symbols." |
[email protected] | 8ada8c5 | 2009-03-10 21:53:08 | [diff] [blame] | 582 | else |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 583 | echo "Skipping debugging symbols." |
[email protected] | 8ada8c5 | 2009-03-10 21:53:08 | [diff] [blame] | 584 | dbg_list= |
| 585 | fi |
| 586 | |
johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 587 | if test "$do_inst_lib32" = "1" ; then |
| 588 | echo "Including 32-bit libraries for ARM/Android." |
| 589 | else |
| 590 | echo "Skipping 32-bit libraries for ARM/Android." |
| 591 | lib32_list= |
[email protected] | 9f28a9cf | 2012-12-17 23:31:40 | [diff] [blame] | 592 | fi |
| 593 | |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 594 | if test "$do_inst_arm" = "1" ; then |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 595 | echo "Including ARM cross toolchain." |
[email protected] | f2826b6a | 2012-11-15 01:06:26 | [diff] [blame] | 596 | else |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 597 | echo "Skipping ARM cross toolchain." |
[email protected] | f2826b6a | 2012-11-15 01:06:26 | [diff] [blame] | 598 | arm_list= |
| 599 | fi |
| 600 | |
[email protected] | 56541636 | 2014-01-16 21:26:47 | [diff] [blame] | 601 | if test "$do_inst_nacl" = "1"; then |
[email protected] | 713eac6 | 2014-06-02 23:10:03 | [diff] [blame] | 602 | echo "Including NaCl, NaCl toolchain, NaCl ports dependencies." |
[email protected] | 56541636 | 2014-01-16 21:26:47 | [diff] [blame] | 603 | else |
[email protected] | 713eac6 | 2014-06-02 23:10:03 | [diff] [blame] | 604 | echo "Skipping NaCl, NaCl toolchain, NaCl ports dependencies." |
[email protected] | 56541636 | 2014-01-16 21:26:47 | [diff] [blame] | 605 | nacl_list= |
| 606 | fi |
| 607 | |
johnme | 4bd1030 | 2015-01-06 11:25:52 | [diff] [blame] | 608 | # The `sort -r -s -t: -k2` sorts all the :i386 packages to the front, to avoid |
| 609 | # confusing dpkg-query (crbug.com/446172). |
[email protected] | 56541636 | 2014-01-16 21:26:47 | [diff] [blame] | 610 | packages="$( |
johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 611 | echo "${dev_list} ${lib_list} ${dbg_list} ${lib32_list} ${arm_list}"\ |
johnme | 4bd1030 | 2015-01-06 11:25:52 | [diff] [blame] | 612 | "${nacl_list}" | tr " " "\n" | sort -u | sort -r -s -t: -k2 | tr "\n" " " |
[email protected] | 56541636 | 2014-01-16 21:26:47 | [diff] [blame] | 613 | )" |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 614 | |
| 615 | if [ 1 -eq "${do_quick_check-0}" ] ; then |
thomasanderson | 73b3a441 | 2016-11-18 23:16:07 | [diff] [blame] | 616 | if ! missing_packages="$(dpkg-query -W -f ' ' ${packages} 2>&1)"; then |
| 617 | # Distinguish between packages that actually aren't available to the |
| 618 | # system (i.e. not in any repo) and packages that just aren't known to |
| 619 | # dpkg (i.e. managed by apt). |
| 620 | missing_packages="$(echo "${missing_packages}" | awk '{print $NF}')" |
| 621 | not_installed="" |
| 622 | unknown="" |
| 623 | for p in ${missing_packages}; do |
| 624 | if apt-cache show ${p} > /dev/null 2>&1; then |
| 625 | not_installed="${p}\n${not_installed}" |
| 626 | else |
| 627 | unknown="${p}\n${unknown}" |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 628 | fi |
thomasanderson | 73b3a441 | 2016-11-18 23:16:07 | [diff] [blame] | 629 | done |
| 630 | if [ -n "${not_installed}" ]; then |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 631 | echo "WARNING: The following packages are not installed:" |
thomasanderson | 73b3a441 | 2016-11-18 23:16:07 | [diff] [blame] | 632 | echo -e "${not_installed}" | sed -e "s/^/ /" |
| 633 | fi |
| 634 | if [ -n "${unknown}" ]; then |
| 635 | echo "WARNING: The following packages are unknown to your system" |
| 636 | echo "(maybe missing a repo or need to 'sudo apt-get update'):" |
| 637 | echo -e "${unknown}" | sed -e "s/^/ /" |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 638 | fi |
| 639 | exit 1 |
| 640 | fi |
| 641 | exit 0 |
| 642 | fi |
| 643 | |
johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 644 | if test "$do_inst_lib32" = "1" || test "$do_inst_nacl" = "1"; then |
thomasanderson | 05c4029 | 2017-03-28 19:28:45 | [diff] [blame] | 645 | sudo dpkg --add-architecture i386 |
johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 646 | fi |
sbc | 4256409 | 2015-04-01 01:01:28 | [diff] [blame] | 647 | sudo apt-get update |
[email protected] | e041ed1 | 2009-03-10 16:43:01 | [diff] [blame] | 648 | |
| 649 | # We initially run "apt-get" with the --reinstall option and parse its output. |
| 650 | # This way, we can find all the packages that need to be newly installed |
| 651 | # without accidentally promoting any packages from "auto" to "manual". |
| 652 | # We then re-run "apt-get" with just the list of missing packages. |
| 653 | echo "Finding missing packages..." |
[email protected] | 757c296 | 2012-03-15 19:05:18 | [diff] [blame] | 654 | # Intentionally leaving $packages unquoted so it's more readable. |
[email protected] | b6e06452 | 2009-08-10 18:47:51 | [diff] [blame] | 655 | echo "Packages required: " $packages |
| 656 | echo |
[email protected] | 79a9d296 | 2009-08-06 21:10:58 | [diff] [blame] | 657 | new_list_cmd="sudo apt-get install --reinstall $(echo $packages)" |
[email protected] | c3d8b15 | 2013-05-10 10:10:03 | [diff] [blame] | 658 | if new_list="$(yes n | LANGUAGE=en LANG=C $new_list_cmd)"; then |
[email protected] | b6e06452 | 2009-08-10 18:47:51 | [diff] [blame] | 659 | # We probably never hit this following line. |
thakis | 3e861de | 2016-06-14 14:24:01 | [diff] [blame] | 660 | echo "No missing packages, and the packages are up to date." |
[email protected] | b62f11e7 | 2010-05-03 17:20:45 | [diff] [blame] | 661 | elif [ $? -eq 1 ]; then |
[email protected] | 79a9d296 | 2009-08-06 21:10:58 | [diff] [blame] | 662 | # We expect apt-get to have exit status of 1. |
[email protected] | 757c296 | 2012-03-15 19:05:18 | [diff] [blame] | 663 | # This indicates that we cancelled the install with "yes n|". |
[email protected] | b6e06452 | 2009-08-10 18:47:51 | [diff] [blame] | 664 | new_list=$(echo "$new_list" | |
[email protected] | 79a9d296 | 2009-08-06 21:10:58 | [diff] [blame] | 665 | sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d') |
[email protected] | b6e06452 | 2009-08-10 18:47:51 | [diff] [blame] | 666 | new_list=$(echo "$new_list" | sed 's/ *$//') |
| 667 | if [ -z "$new_list" ] ; then |
thakis | 3e861de | 2016-06-14 14:24:01 | [diff] [blame] | 668 | echo "No missing packages, and the packages are up to date." |
[email protected] | b6e06452 | 2009-08-10 18:47:51 | [diff] [blame] | 669 | else |
| 670 | echo "Installing missing packages: $new_list." |
[email protected] | e2544ed4 | 2012-04-23 04:48:31 | [diff] [blame] | 671 | sudo apt-get install ${do_quietly-} ${new_list} |
[email protected] | b6e06452 | 2009-08-10 18:47:51 | [diff] [blame] | 672 | fi |
| 673 | echo |
[email protected] | 79a9d296 | 2009-08-06 21:10:58 | [diff] [blame] | 674 | else |
| 675 | # An apt-get exit status of 100 indicates that a real error has occurred. |
[email protected] | e041ed1 | 2009-03-10 16:43:01 | [diff] [blame] | 676 | |
[email protected] | 79a9d296 | 2009-08-06 21:10:58 | [diff] [blame] | 677 | # I am intentionally leaving out the '"'s around new_list_cmd, |
| 678 | # as this makes it easier to cut and paste the output |
[email protected] | 79a9d296 | 2009-08-06 21:10:58 | [diff] [blame] | 679 | echo "The following command failed: " ${new_list_cmd} |
| 680 | echo |
| 681 | echo "It produces the following output:" |
| 682 | yes n | $new_list_cmd || true |
| 683 | echo |
| 684 | echo "You will have to install the above packages yourself." |
| 685 | echo |
| 686 | exit 100 |
| 687 | fi |
[email protected] | e041ed1 | 2009-03-10 16:43:01 | [diff] [blame] | 688 | |
[email protected] | d96cc347 | 2013-09-19 00:53:30 | [diff] [blame] | 689 | # Install the Chrome OS default fonts. This must go after running |
| 690 | # apt-get, since install-chromeos-fonts depends on curl. |
| 691 | if test "$do_inst_chromeos_fonts" != "0"; then |
| 692 | echo |
| 693 | echo "Installing Chrome OS fonts." |
| 694 | dir=`echo $0 | sed -r -e 's/\/[^/]+$//'` |
| 695 | if ! sudo $dir/linux/install-chromeos-fonts.py; then |
| 696 | echo "ERROR: The installation of the Chrome OS default fonts failed." |
| 697 | if [ `stat -f -c %T $dir` == "nfs" ]; then |
| 698 | echo "The reason is that your repo is installed on a remote file system." |
| 699 | else |
| 700 | echo "This is expected if your repo is installed on a remote file system." |
| 701 | fi |
| 702 | echo "It is recommended to install your repo on a local file system." |
| 703 | echo "You can skip the installation of the Chrome OS default founts with" |
| 704 | echo "the command line option: --no-chromeos-fonts." |
| 705 | exit 1 |
| 706 | fi |
| 707 | else |
| 708 | echo "Skipping installation of Chrome OS fonts." |
| 709 | fi |
| 710 | |
thomasanderson | 5ef5c3d | 2016-12-08 01:59:19 | [diff] [blame] | 711 | echo "Installing locales." |
| 712 | CHROMIUM_LOCALES="da_DK.UTF-8 fr_FR.UTF-8 he_IL.UTF-8 zh_TW.UTF-8" |
| 713 | LOCALE_GEN=/etc/locale.gen |
| 714 | if [ -e ${LOCALE_GEN} ]; then |
| 715 | OLD_LOCALE_GEN="$(cat /etc/locale.gen)" |
| 716 | for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do |
| 717 | sudo sed -i "s/^# ${CHROMIUM_LOCALE}/${CHROMIUM_LOCALE}/" ${LOCALE_GEN} |
| 718 | done |
| 719 | # Regenerating locales can take a while, so only do it if we need to. |
| 720 | if (echo "${OLD_LOCALE_GEN}" | cmp -s ${LOCALE_GEN}); then |
| 721 | echo "Locales already up-to-date." |
| 722 | else |
| 723 | sudo locale-gen |
| 724 | fi |
| 725 | else |
| 726 | for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do |
| 727 | sudo locale-gen ${CHROMIUM_LOCALE} |
| 728 | done |
| 729 | fi |