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 # This script sets up an Ubuntu chroot environment. The ideas come | 7 # This script sets up an Ubuntu chroot environment. The ideas come |
8 # from https://wiki.ubuntu.com/DebootstrapChroot and conversations with | 8 # from https://wiki.ubuntu.com/DebootstrapChroot and conversations with |
9 # tedbo. The script is passed the path to an empty folder, which will be | 9 # tedbo. The script is passed the path to an empty folder, which will be |
10 # populated with the files to form an Ubuntu Jaunty system with the packages | 10 # populated with the files to form an Ubuntu Jaunty system with the packages |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 in_chroot groupadd -g 5000 eng | 159 in_chroot groupadd -g 5000 eng |
160 in_chroot useradd -G ${DEFGROUPS} -g eng -u `id -u` -s \ | 160 in_chroot useradd -G ${DEFGROUPS} -g eng -u `id -u` -s \ |
161 /bin/bash -m -c "${FULLNAME}" -p ${CRYPTED_PASSWD} ${USER} | 161 /bin/bash -m -c "${FULLNAME}" -p ${CRYPTED_PASSWD} ${USER} |
162 | 162 |
163 # Bind-mount trunk into chroot so we can install local packages | 163 # Bind-mount trunk into chroot so we can install local packages |
164 mkdir "${FLAGS_chroot}$CHROOT_TRUNK_DIR" | 164 mkdir "${FLAGS_chroot}$CHROOT_TRUNK_DIR" |
165 sudo mount --bind "$GCLIENT_ROOT" "${FLAGS_chroot}$CHROOT_TRUNK_DIR" | 165 sudo mount --bind "$GCLIENT_ROOT" "${FLAGS_chroot}$CHROOT_TRUNK_DIR" |
166 | 166 |
167 # Niceties for interactive logins ('enter_chroot.sh'); these are ignored | 167 # Niceties for interactive logins ('enter_chroot.sh'); these are ignored |
168 # when specifying a command to enter_chroot.sh. | 168 # when specifying a command to enter_chroot.sh. |
169 # Warn less when apt-get installing packqages | |
170 echo "export LANG=C" >> "$FLAGS_chroot/home/$USER/.bashrc" | |
171 chmod a+x "$FLAGS_chroot/home/$USER/.bashrc" | |
172 # Automatically change to scripts directory | 169 # Automatically change to scripts directory |
173 echo "cd trunk/src/scripts" >> "$FLAGS_chroot/home/$USER/.profile" | 170 echo "cd trunk/src/scripts" >> "$FLAGS_chroot/home/$USER/.profile" |
174 | 171 |
175 # Warn if attempting to use source control commands inside the chroot | 172 # Warn if attempting to use source control commands inside the chroot |
176 for NOUSE in svn gcl gclient | 173 for NOUSE in svn gcl gclient |
177 do | 174 do |
178 echo "alias $NOUSE='echo In the chroot, it is a bad idea to run $NOUSE'" \ | 175 echo "alias $NOUSE='echo In the chroot, it is a bad idea to run $NOUSE'" \ |
179 >> "$FLAGS_chroot/home/$USER/.profile" | 176 >> "$FLAGS_chroot/home/$USER/.profile" |
180 done | 177 done |
181 | 178 |
(...skipping 27 matching lines...) Expand all Loading... |
209 CHROOT_EXAMPLE_OPT="--chroot=$FLAGS_chroot" | 206 CHROOT_EXAMPLE_OPT="--chroot=$FLAGS_chroot" |
210 fi | 207 fi |
211 | 208 |
212 echo "All set up. To enter the chroot, run:" | 209 echo "All set up. To enter the chroot, run:" |
213 echo " $SCRIPTS_DIR/enter_chroot.sh $CHROOT_EXAMPLE_OPT" | 210 echo " $SCRIPTS_DIR/enter_chroot.sh $CHROOT_EXAMPLE_OPT" |
214 echo "" | 211 echo "" |
215 echo "CAUTION: Do *NOT* rm -rf the chroot directory; if there are stale bind" | 212 echo "CAUTION: Do *NOT* rm -rf the chroot directory; if there are stale bind" |
216 echo "mounts you may end up deleting your source tree too. To unmount and" | 213 echo "mounts you may end up deleting your source tree too. To unmount and" |
217 echo "delete the chroot cleanly, use:" | 214 echo "delete the chroot cleanly, use:" |
218 echo " $0 --delete $CHROOT_EXAMPLE_OPT" | 215 echo " $0 --delete $CHROOT_EXAMPLE_OPT" |
OLD | NEW |