| 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 | 385 |
| 386 # If this system has a "/media" mountpoint, import it into the chroot | 386 # If this system has a "/media" mountpoint, import it into the chroot |
| 387 # environment. Most modern distributions use this mount point to | 387 # environment. Most modern distributions use this mount point to |
| 388 # automatically mount devices such as CDROMs, USB sticks, etc... | 388 # automatically mount devices such as CDROMs, USB sticks, etc... |
| 389 if [ -d /media ] && | 389 if [ -d /media ] && |
| 390 ! grep -qs '^/media' /etc/schroot/mount-"${target}"; then | 390 ! grep -qs '^/media' /etc/schroot/mount-"${target}"; then |
| 391 echo '/media /media none rw,rbind 0 0' | | 391 echo '/media /media none rw,rbind 0 0' | |
| 392 sudo sh -c 'cat >>/etc/schroot/mount-'"${target}" | 392 sudo sh -c 'cat >>/etc/schroot/mount-'"${target}" |
| 393 fi | 393 fi |
| 394 | 394 |
| 395 # Share /dev/shm and possibly /run/shm | 395 # Share /dev/shm, /run and /run/shm. |
| 396 grep -qs '^/dev/shm' /etc/schroot/mount-"${target}" || | 396 grep -qs '^/dev/shm' /etc/schroot/mount-"${target}" || |
| 397 echo '/dev/shm /dev/shm none rw,bind 0 0' | | 397 echo '/dev/shm /dev/shm none rw,bind 0 0' | |
| 398 sudo sh -c 'cat >>/etc/schroot/mount-'"${target}" | 398 sudo sh -c 'cat >>/etc/schroot/mount-'"${target}" |
| 399 if [ -d "/var/lib/chroot/${target}/run" ] && | 399 if [ ! -d "/var/lib/chroot/${target}/run" ] && |
| 400 ! grep -qs '^/run/shm' /etc/schroot/mount-"${target}"; then | 400 ! grep -qs '^/run' /etc/schroot/mount-"${target}"; then |
| 401 echo '/run /run none rw,bind 0 0' | |
| 402 sudo sh -c 'cat >>/etc/schroot/mount-'"${target}" |
| 403 fi |
| 404 if ! grep -qs '^/run/shm' /etc/schroot/mount-"${target}"; then |
| 401 { [ -d /run ] && echo '/run/shm /run/shm none rw,bind 0 0' || | 405 { [ -d /run ] && echo '/run/shm /run/shm none rw,bind 0 0' || |
| 402 echo '/dev/shm /run/shm none rw,bind 0 0'; } | | 406 echo '/dev/shm /run/shm none rw,bind 0 0'; } | |
| 403 sudo sh -c 'cat >>/etc/schroot/mount-'"${target}" | 407 sudo sh -c 'cat >>/etc/schroot/mount-'"${target}" |
| 404 fi | 408 fi |
| 405 | 409 |
| 406 # Set up a special directory that changes contents depending on the target | 410 # Set up a special directory that changes contents depending on the target |
| 407 # that is executing. | 411 # that is executing. |
| 408 d="$(readlink -f "${HOME}/chroot" 2>/dev/null || echo "${HOME}/chroot")" | 412 d="$(readlink -f "${HOME}/chroot" 2>/dev/null || echo "${HOME}/chroot")" |
| 409 s="${d}/.${target}" | 413 s="${d}/.${target}" |
| 410 echo "${s} ${d} none rw,bind 0 0" | | 414 echo "${s} ${d} none rw,bind 0 0" | |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 | 804 |
| 801 For Chrome, this probably means you want to make your "out" directory a | 805 For Chrome, this probably means you want to make your "out" directory a |
| 802 symbolic link that points somewhere inside of "${HOME}/chroot". | 806 symbolic link that points somewhere inside of "${HOME}/chroot". |
| 803 | 807 |
| 804 You still need to run "gclient runhooks" whenever you switch from building | 808 You still need to run "gclient runhooks" whenever you switch from building |
| 805 outside of the chroot to inside of the chroot. But you will find that you | 809 outside of the chroot to inside of the chroot. But you will find that you |
| 806 don't have to repeatedly erase and then completely rebuild all your object | 810 don't have to repeatedly erase and then completely rebuild all your object |
| 807 and binary files. | 811 and binary files. |
| 808 | 812 |
| 809 EOF | 813 EOF |
| OLD | NEW |