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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}$CHROOT_TRUNK_DIR")" | 92 MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}$CHROOT_TRUNK_DIR")" |
93 if [ -z "$(mount | grep -F "on $MOUNTED_PATH")" ] | 93 if [ -z "$(mount | grep -F "on $MOUNTED_PATH")" ] |
94 then | 94 then |
95 sudo mount --bind "$FLAGS_trunk" "$MOUNTED_PATH" | 95 sudo mount --bind "$FLAGS_trunk" "$MOUNTED_PATH" |
96 fi | 96 fi |
97 | 97 |
98 MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}${INNER_CHROME_ROOT}")" | 98 MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}${INNER_CHROME_ROOT}")" |
99 if [ -z "$(mount | grep -F "on $MOUNTED_PATH")" ] | 99 if [ -z "$(mount | grep -F "on $MOUNTED_PATH")" ] |
100 then | 100 then |
101 CHROME_ROOT="$(readlink -f "$FLAGS_chrome_root")" | 101 ! CHROME_ROOT="$(readlink -f "$FLAGS_chrome_root")" |
102 if [ -z "$CHROME_ROOT" ]; then | 102 if [ -z "$CHROME_ROOT" ]; then |
103 ! CHROME_ROOT="$(cat "${FLAGS_chroot}${CHROME_ROOT_CONFIG}" \ | 103 ! CHROME_ROOT="$(cat "${FLAGS_chroot}${CHROME_ROOT_CONFIG}" \ |
104 2>/dev/null)" | 104 2>/dev/null)" |
105 fi | 105 fi |
106 if [[ ( -z "$CHROME_ROOT" ) || ( ! -d "${CHROME_ROOT}/src" ) ]]; then | 106 if [[ ( -z "$CHROME_ROOT" ) || ( ! -d "${CHROME_ROOT}/src" ) ]]; then |
107 echo "Not mounting chrome source" | 107 echo "Not mounting chrome source" |
108 sudo rm -f "${FLAGS_chroot}${CHROME_ROOT_CONFIG}" | 108 sudo rm -f "${FLAGS_chroot}${CHROME_ROOT_CONFIG}" |
109 else | 109 else |
110 echo "Mounting chrome source at: $INNER_CHROME_ROOT" | 110 echo "Mounting chrome source at: $INNER_CHROME_ROOT" |
111 echo "$CHROME_ROOT" | \ | 111 echo "$CHROME_ROOT" | \ |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 215 |
216 # Run command or interactive shell. Also include the non-chrooted path to | 216 # Run command or interactive shell. Also include the non-chrooted path to |
217 # the source trunk for scripts that may need to print it (e.g. | 217 # the source trunk for scripts that may need to print it (e.g. |
218 # build_image.sh). | 218 # build_image.sh). |
219 sudo chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ | 219 sudo chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ |
220 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C "$@" | 220 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C "$@" |
221 | 221 |
222 # Remove trap and explicitly unmount | 222 # Remove trap and explicitly unmount |
223 trap - EXIT | 223 trap - EXIT |
224 teardown_env | 224 teardown_env |
OLD | NEW |