| 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 # This script installs Debian-derived distributions in a chroot environment. | 7 # This script installs Debian-derived distributions in a chroot environment. |
| 8 # It can for example be used to have an accurate 32bit build and test | 8 # It can for example be used to have an accurate 32bit build and test |
| 9 # environment when otherwise working on a 64bit machine. | 9 # environment when otherwise working on a 64bit machine. |
| 10 # N. B. it is unlikely that this script will ever work on anything other than a | 10 # N. B. it is unlikely that this script will ever work on anything other than a |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 # whether it is the beginning of a new entry. | 332 # whether it is the beginning of a new entry. |
| 333 sudo sed -ni '/^[[]'"${target%bit}"']$/,${:1;n;/^[[]/b2;b1;:2;p;n;b2};p' \ | 333 sudo sed -ni '/^[[]'"${target%bit}"']$/,${:1;n;/^[[]/b2;b1;:2;p;n;b2};p' \ |
| 334 /etc/schroot/schroot.conf | 334 /etc/schroot/schroot.conf |
| 335 | 335 |
| 336 # Download base system. This takes some time | 336 # Download base system. This takes some time |
| 337 if [ -z "${mirror}" ]; then | 337 if [ -z "${mirror}" ]; then |
| 338 grep -qs ubuntu.com /usr/share/debootstrap/scripts/"${distname}" && | 338 grep -qs ubuntu.com /usr/share/debootstrap/scripts/"${distname}" && |
| 339 mirror="http://archive.ubuntu.com/ubuntu" || | 339 mirror="http://archive.ubuntu.com/ubuntu" || |
| 340 mirror="http://ftp.us.debian.org/debian" | 340 mirror="http://ftp.us.debian.org/debian" |
| 341 fi | 341 fi |
| 342 sudo debootstrap ${archflag} "${distname}" /var/lib/chroot/"${target}" \ | 342 |
| 343 "$mirror" | 343 sudo ${http_proxy:+http_proxy="${http_proxy}"} debootstrap ${archflag} \ |
| 344 "${distname}" "/var/lib/chroot/${target}" "$mirror" |
| 344 | 345 |
| 345 # Add new entry to /etc/schroot/schroot.conf | 346 # Add new entry to /etc/schroot/schroot.conf |
| 346 grep -qs ubuntu.com /usr/share/debootstrap/scripts/"${distname}" && | 347 grep -qs ubuntu.com /usr/share/debootstrap/scripts/"${distname}" && |
| 347 brand="Ubuntu" || brand="Debian" | 348 brand="Ubuntu" || brand="Debian" |
| 348 if [ -z "${chroot_groups}" ]; then | 349 if [ -z "${chroot_groups}" ]; then |
| 349 chroot_groups="${admin},$(id -gn)" | 350 chroot_groups="${admin},$(id -gn)" |
| 350 fi | 351 fi |
| 351 # Older versions of schroot wanted a "priority=" line, whereas recent | 352 # Older versions of schroot wanted a "priority=" line, whereas recent |
| 352 # versions deprecate "priority=" and warn if they see it. We don't have | 353 # versions deprecate "priority=" and warn if they see it. We don't have |
| 353 # a good feature test, but scanning for the string "priority=" in the | 354 # a good feature test, but scanning for the string "priority=" in the |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 >>"/var/lib/chroot/'"${target}"'/etc/apt/sources.list"' | 546 >>"/var/lib/chroot/'"${target}"'/etc/apt/sources.list"' |
| 546 fi | 547 fi |
| 547 | 548 |
| 548 # Add source repositories, if the user requested we do so | 549 # Add source repositories, if the user requested we do so |
| 549 [ "${add_srcs}" = "y" -a \ | 550 [ "${add_srcs}" = "y" -a \ |
| 550 -r "/var/lib/chroot/${target}/etc/apt/sources.list" ] && | 551 -r "/var/lib/chroot/${target}/etc/apt/sources.list" ] && |
| 551 sudo sed -i '/^deb[^-]/p | 552 sudo sed -i '/^deb[^-]/p |
| 552 s/^deb\([^-]\)/deb-src\1/' \ | 553 s/^deb\([^-]\)/deb-src\1/' \ |
| 553 "/var/lib/chroot/${target}/etc/apt/sources.list" | 554 "/var/lib/chroot/${target}/etc/apt/sources.list" |
| 554 | 555 |
| 556 # Set apt proxy if host has set http_proxy |
| 557 if [ -n "${http_proxy}" ]; then |
| 558 sudo sh -c ' |
| 559 echo "Acquire::http::proxy \"'"${http_proxy}"'\";" \ |
| 560 >>"/var/lib/chroot/'"${target}"'/etc/apt/apt.conf"' |
| 561 fi |
| 562 |
| 555 # Update packages | 563 # Update packages |
| 556 sudo "/usr/local/bin/${target%bit}" /bin/sh -c ' | 564 sudo "/usr/local/bin/${target%bit}" /bin/sh -c ' |
| 557 apt-get update; apt-get -y dist-upgrade' || : | 565 apt-get update; apt-get -y dist-upgrade' || : |
| 558 | 566 |
| 559 # Install a couple of missing packages | 567 # Install a couple of missing packages |
| 560 for i in debian-keyring ubuntu-keyring locales sudo; do | 568 for i in debian-keyring ubuntu-keyring locales sudo; do |
| 561 [ -d "/var/lib/chroot/${target}/usr/share/doc/$i" ] || | 569 [ -d "/var/lib/chroot/${target}/usr/share/doc/$i" ] || |
| 562 sudo "/usr/local/bin/${target%bit}" apt-get -y install "$i" || : | 570 sudo "/usr/local/bin/${target%bit}" apt-get -y install "$i" || : |
| 563 done | 571 done |
| 564 | 572 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 | 798 |
| 791 For Chrome, this probably means you want to make your "out" directory a | 799 For Chrome, this probably means you want to make your "out" directory a |
| 792 symbolic link that points somewhere inside of "${HOME}/chroot". | 800 symbolic link that points somewhere inside of "${HOME}/chroot". |
| 793 | 801 |
| 794 You still need to run "gclient runhooks" whenever you switch from building | 802 You still need to run "gclient runhooks" whenever you switch from building |
| 795 outside of the chroot to inside of the chroot. But you will find that you | 803 outside of the chroot to inside of the chroot. But you will find that you |
| 796 don't have to repeatedly erase and then completely rebuild all your object | 804 don't have to repeatedly erase and then completely rebuild all your object |
| 797 and binary files. | 805 and binary files. |
| 798 | 806 |
| 799 EOF | 807 EOF |
| OLD | NEW |