| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 personality=linux$([ "${arch}" != 64bit ] && echo 32) | 196 personality=linux$([ "${arch}" != 64bit ] && echo 32) |
| 197 script-config=script-${target} | 197 script-config=script-${target} |
| 198 | 198 |
| 199 EOF | 199 EOF |
| 200 | 200 |
| 201 # Set up a special directory that changes contents depending on the target | 201 # Set up a special directory that changes contents depending on the target |
| 202 # that is executing. | 202 # that is executing. |
| 203 sed '/^FSTAB=/s,/mount-defaults",/mount-'"${target}"'",' \ | 203 sed '/^FSTAB=/s,/mount-defaults",/mount-'"${target}"'",' \ |
| 204 /etc/schroot/script-defaults | | 204 /etc/schroot/script-defaults | |
| 205 sudo sh -c 'cat >/etc/schroot/script-'"${target}" | 205 sudo sh -c 'cat >/etc/schroot/script-'"${target}" |
| 206 sudo cp /etc/schroot/mount-defaults /etc/schroot/mount-"${target}" | 206 sed '\,^/home[/[:space:]],s/\([,[:space:]]\)bind[[:space:]]/\1rbind /' \ |
| 207 /etc/schroot/mount-defaults | |
| 208 sudo sh -c 'cat > /etc/schroot/mount-'"${target}" |
| 207 echo "$HOME/chroot/.${target} $HOME/chroot none rw,bind 0 0" | | 209 echo "$HOME/chroot/.${target} $HOME/chroot none rw,bind 0 0" | |
| 208 sudo sh -c 'cat >>/etc/schroot/mount-'"${target}" | 210 sudo sh -c 'cat >>/etc/schroot/mount-'"${target}" |
| 209 mkdir -p "$HOME/chroot/.${target}" | 211 mkdir -p "$HOME/chroot/.${target}" |
| 210 | 212 |
| 211 # Install a helper script to launch commands in the chroot | 213 # Install a helper script to launch commands in the chroot |
| 212 sudo sh -c 'cat >/usr/local/bin/'"${target%bit}" <<EOF | 214 sudo sh -c 'cat >/usr/local/bin/'"${target%bit}" <<EOF |
| 213 #!/bin/bash | 215 #!/bin/bash |
| 214 if [ \$# -eq 0 ]; then | 216 if [ \$# -eq 0 ]; then |
| 215 exec schroot -c ${target%bit} -p | 217 exec schroot -c ${target%bit} -p |
| 216 else | 218 else |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 | 318 |
| 317 Successfully installed ${distname} ${arch} | 319 Successfully installed ${distname} ${arch} |
| 318 | 320 |
| 319 You can run programs inside of the chroot by invoking the "${target%bit}" | 321 You can run programs inside of the chroot by invoking the "${target%bit}" |
| 320 command. | 322 command. |
| 321 | 323 |
| 322 Your home directory is shared between the host and the chroot. But I configured | 324 Your home directory is shared between the host and the chroot. But I configured |
| 323 $HOME/chroot to be private to the chroot environment. You can use it | 325 $HOME/chroot to be private to the chroot environment. You can use it |
| 324 for files that need to differ between environments. | 326 for files that need to differ between environments. |
| 325 EOF | 327 EOF |
| OLD | NEW |