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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 [ -r /etc/locale.gen ] && | 580 [ -r /etc/locale.gen ] && |
581 sed -i "s/^# \($l\)/\1/" /etc/locale.gen | 581 sed -i "s/^# \($l\)/\1/" /etc/locale.gen |
582 locale-gen $LANG en_US en_US.UTF-8' || : | 582 locale-gen $LANG en_US en_US.UTF-8' || : |
583 | 583 |
584 # Enable multi-arch support, if available | 584 # Enable multi-arch support, if available |
585 sudo "/usr/local/bin/${target%bit}" dpkg --assert-multi-arch >&/dev/null && | 585 sudo "/usr/local/bin/${target%bit}" dpkg --assert-multi-arch >&/dev/null && |
586 [ -r "/var/lib/chroot/${target}/etc/apt/sources.list" ] && { | 586 [ -r "/var/lib/chroot/${target}/etc/apt/sources.list" ] && { |
587 sudo sed -i 's/ / [arch=amd64,i386] /' \ | 587 sudo sed -i 's/ / [arch=amd64,i386] /' \ |
588 "/var/lib/chroot/${target}/etc/apt/sources.list" | 588 "/var/lib/chroot/${target}/etc/apt/sources.list" |
589 [ -d /var/lib/chroot/${target}/etc/dpkg/dpkg.cfg.d/ ] && | 589 [ -d /var/lib/chroot/${target}/etc/dpkg/dpkg.cfg.d/ ] && |
590 echo foreign-architecture \ | 590 sudo "/usr/local/bin/${target%bit}" dpkg --add-architecture \ |
591 $([ "${arch}" = "32bit" ] && echo amd64 || echo i386) | | 591 $([ "${arch}" = "32bit" ] && echo amd64 || echo i386) >&/dev/null || |
592 sudo sh -c "cat >'/var/lib/chroot/${target}/etc/dpkg/dpkg.cfg.d/multiarch'" | 592 echo foreign-architecture \ |
| 593 $([ "${arch}" = "32bit" ] && echo amd64 || echo i386) | |
| 594 sudo sh -c \ |
| 595 "cat >'/var/lib/chroot/${target}/etc/dpkg/dpkg.cfg.d/multiarch'" |
593 } | 596 } |
594 | 597 |
595 # Configure "sudo" package | 598 # Configure "sudo" package |
596 sudo "/usr/local/bin/${target%bit}" /bin/sh -c ' | 599 sudo "/usr/local/bin/${target%bit}" /bin/sh -c ' |
597 egrep -qs '"'^$(id -nu) '"' /etc/sudoers || | 600 egrep -qs '"'^$(id -nu) '"' /etc/sudoers || |
598 echo '"'$(id -nu) ALL=(ALL) ALL'"' >>/etc/sudoers' | 601 echo '"'$(id -nu) ALL=(ALL) ALL'"' >>/etc/sudoers' |
599 | 602 |
600 # Install a few more commonly used packages | 603 # Install a few more commonly used packages |
601 sudo "/usr/local/bin/${target%bit}" apt-get -y install \ | 604 sudo "/usr/local/bin/${target%bit}" apt-get -y install \ |
602 autoconf automake1.9 dpkg-dev g++-multilib gcc-multilib gdb less libtool \ | 605 autoconf automake1.9 dpkg-dev g++-multilib gcc-multilib gdb less libtool \ |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 | 807 |
805 For Chrome, this probably means you want to make your "out" directory a | 808 For Chrome, this probably means you want to make your "out" directory a |
806 symbolic link that points somewhere inside of "${HOME}/chroot". | 809 symbolic link that points somewhere inside of "${HOME}/chroot". |
807 | 810 |
808 You still need to run "gclient runhooks" whenever you switch from building | 811 You still need to run "gclient runhooks" whenever you switch from building |
809 outside of the chroot to inside of the chroot. But you will find that you | 812 outside of the chroot to inside of the chroot. But you will find that you |
810 don't have to repeatedly erase and then completely rebuild all your object | 813 don't have to repeatedly erase and then completely rebuild all your object |
811 and binary files. | 814 and binary files. |
812 | 815 |
813 EOF | 816 EOF |
OLD | NEW |