| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 The Chromium OS 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 # Script to enter the chroot environment | 7 # Script to enter the chroot environment |
| 8 | 8 |
| 9 # Load common constants. This should be the first executable line. | 9 # Load common constants. This should be the first executable line. |
| 10 # The path to common.sh should be relative to your script's location. | 10 # The path to common.sh should be relative to your script's location. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 echo "Mounting chroot environment." | 77 echo "Mounting chroot environment." |
| 78 | 78 |
| 79 # Mount only if not already mounted | 79 # Mount only if not already mounted |
| 80 MOUNTED_PATH="$(readlink -f "$FLAGS_chroot/proc")" | 80 MOUNTED_PATH="$(readlink -f "$FLAGS_chroot/proc")" |
| 81 if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ] | 81 if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ] |
| 82 then | 82 then |
| 83 sudo mount none -t proc "$MOUNTED_PATH" || \ | 83 sudo mount none -t proc "$MOUNTED_PATH" || \ |
| 84 die "Could not mount $MOUNTED_PATH" | 84 die "Could not mount $MOUNTED_PATH" |
| 85 fi | 85 fi |
| 86 | 86 |
| 87 MOUNTED_PATH="$(readlink -f "$FLAGS_chroot/sys")" |
| 88 if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ] |
| 89 then |
| 90 sudo mount none -t sysfs "$MOUNTED_PATH" || \ |
| 91 die "Could not mount $MOUNTED_PATH" |
| 92 fi |
| 93 |
| 87 MOUNTED_PATH="$(readlink -f "$FLAGS_chroot/dev/pts")" | 94 MOUNTED_PATH="$(readlink -f "$FLAGS_chroot/dev/pts")" |
| 88 if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ] | 95 if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ] |
| 89 then | 96 then |
| 90 sudo mount none -t devpts "$MOUNTED_PATH" || \ | 97 sudo mount none -t devpts "$MOUNTED_PATH" || \ |
| 91 die "Could not mount $MOUNTED_PATH" | 98 die "Could not mount $MOUNTED_PATH" |
| 92 fi | 99 fi |
| 93 | 100 |
| 94 MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}$CHROOT_TRUNK_DIR")" | 101 MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}$CHROOT_TRUNK_DIR")" |
| 95 if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ] | 102 if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ] |
| 96 then | 103 then |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 230 |
| 224 # Run command or interactive shell. Also include the non-chrooted path to | 231 # Run command or interactive shell. Also include the non-chrooted path to |
| 225 # the source trunk for scripts that may need to print it (e.g. | 232 # the source trunk for scripts that may need to print it (e.g. |
| 226 # build_image.sh). | 233 # build_image.sh). |
| 227 sudo chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ | 234 sudo chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ |
| 228 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C "$@" | 235 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C "$@" |
| 229 | 236 |
| 230 # Remove trap and explicitly unmount | 237 # Remove trap and explicitly unmount |
| 231 trap - EXIT | 238 trap - EXIT |
| 232 teardown_env | 239 teardown_env |
| OLD | NEW |