OLD | NEW |
1 #!/bin/bash -e | 1 #!/bin/bash -e |
2 | 2 |
3 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2010 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 echo '"'$(id -nu) ALL=(ALL) ALL'"' >>/etc/sudoers' | 249 echo '"'$(id -nu) ALL=(ALL) ALL'"' >>/etc/sudoers' |
250 | 250 |
251 # Install a few more commonly used packages | 251 # Install a few more commonly used packages |
252 sudo schroot -c "${target%bit}" -p -- apt-get -y install \ | 252 sudo schroot -c "${target%bit}" -p -- apt-get -y install \ |
253 autoconf automake1.9 dpkg-dev g++-multilib gcc-multilib gdb less libtool \ | 253 autoconf automake1.9 dpkg-dev g++-multilib gcc-multilib gdb less libtool \ |
254 strace | 254 strace |
255 | 255 |
256 # If running a 32bit environment on a 64bit machine, install a few binaries | 256 # If running a 32bit environment on a 64bit machine, install a few binaries |
257 # as 64bit. | 257 # as 64bit. |
258 if [ "${arch}" = 32bit ] && file /bin/bash 2>/dev/null | grep -q x86-64; then | 258 if [ "${arch}" = 32bit ] && file /bin/bash 2>/dev/null | grep -q x86-64; then |
| 259 readlinepkg=$(sudo schroot -c "${target%bit}" -p -- sh -c \ |
| 260 'apt-cache search "lib64readline.\$" | sort | tail -n 1 | cut -d " " -f 1') |
259 sudo schroot -c "${target%bit}" -p -- apt-get -y install \ | 261 sudo schroot -c "${target%bit}" -p -- apt-get -y install \ |
260 lib64expat1 lib64ncurses5 lib64readline6 lib64z1 | 262 lib64expat1 lib64ncurses5 ${readlinepkg} lib64z1 |
261 dep= | 263 dep= |
262 for i in binutils gdb strace; do | 264 for i in binutils gdb strace; do |
263 [ -d /usr/share/doc/"$i" ] || dep="$dep $i" | 265 [ -d /usr/share/doc/"$i" ] || dep="$dep $i" |
264 done | 266 done |
265 [ -n "$dep" ] && sudo apt-get -y install $dep | 267 [ -n "$dep" ] && sudo apt-get -y install $dep |
266 sudo cp /usr/bin/gdb "/var/lib/chroot/${target}/usr/local/bin/" | 268 sudo cp /usr/bin/gdb "/var/lib/chroot/${target}/usr/local/bin/" |
267 sudo cp /usr/bin/ld "/var/lib/chroot/${target}/usr/local/bin/" | 269 sudo cp /usr/bin/ld "/var/lib/chroot/${target}/usr/local/bin/" |
268 for i in libbfd libpython; do | 270 for i in libbfd libpython; do |
269 lib="$({ ldd /usr/bin/ld; ldd /usr/bin/gdb; } | | 271 lib="$({ ldd /usr/bin/ld; ldd /usr/bin/gdb; } | |
270 grep "$i" | awk '{ print $3 }')" | 272 grep "$i" | awk '{ print $3 }')" |
(...skipping 18 matching lines...) Expand all Loading... |
289 | 291 |
290 Successfully installed ${distname} ${arch} | 292 Successfully installed ${distname} ${arch} |
291 | 293 |
292 You can run programs inside of the chroot by invoking the "${target%bit}" | 294 You can run programs inside of the chroot by invoking the "${target%bit}" |
293 command. | 295 command. |
294 | 296 |
295 Your home directory is shared between the host and the chroot. But I configured | 297 Your home directory is shared between the host and the chroot. But I configured |
296 $HOME/chroot to be private to the chroot environment. You can use it | 298 $HOME/chroot to be private to the chroot environment. You can use it |
297 for files that need to differ between environments. | 299 for files that need to differ between environments. |
298 EOF | 300 EOF |
OLD | NEW |