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 27 matching lines...) Expand all Loading... |
38 | 38 |
39 # Parse command line flags | 39 # Parse command line flags |
40 FLAGS "$@" || exit 1 | 40 FLAGS "$@" || exit 1 |
41 eval set -- "${FLAGS_ARGV}" | 41 eval set -- "${FLAGS_ARGV}" |
42 | 42 |
43 # Only now can we die on error. shflags functions leak non-zero error codes, | 43 # Only now can we die on error. shflags functions leak non-zero error codes, |
44 # so will die prematurely if 'set -e' is specified before now. | 44 # so will die prematurely if 'set -e' is specified before now. |
45 # TODO: replace shflags with something less error-prone, or contribute a fix. | 45 # TODO: replace shflags with something less error-prone, or contribute a fix. |
46 set -e | 46 set -e |
47 | 47 |
48 COMPONENTS=`cat $FLAGS_pkglist | grep -v ' *#' | grep -v '^ *$' | tr '\n' ' '` | 48 COMPONENTS=`cat $FLAGS_pkglist | sed -e 's/#.*//' | grep -v '^ *$' | tr '\n' ' '
` |
49 FULLNAME="Chrome OS dev user" | 49 FULLNAME="Chrome OS dev user" |
50 DEFGROUPS="eng,admin,adm,dialout,cdrom,floppy,audio,dip,video" | 50 DEFGROUPS="eng,admin,adm,dialout,cdrom,floppy,audio,dip,video" |
51 PASSWORD=chronos | 51 PASSWORD=chronos |
52 CRYPTED_PASSWD=$(perl -e 'print crypt($ARGV[0], "foo")', $PASSWORD) | 52 CRYPTED_PASSWD=$(perl -e 'print crypt($ARGV[0], "foo")', $PASSWORD) |
53 | 53 |
54 function in_chroot { | 54 function in_chroot { |
55 sudo chroot "$FLAGS_chroot" "$@" | 55 sudo chroot "$FLAGS_chroot" "$@" |
56 } | 56 } |
57 | 57 |
58 function bash_chroot { | 58 function bash_chroot { |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 CHROOT_EXAMPLE_OPT="--chroot=$FLAGS_chroot" | 206 CHROOT_EXAMPLE_OPT="--chroot=$FLAGS_chroot" |
207 fi | 207 fi |
208 | 208 |
209 echo "All set up. To enter the chroot, run:" | 209 echo "All set up. To enter the chroot, run:" |
210 echo " $SCRIPTS_DIR/enter_chroot.sh $CHROOT_EXAMPLE_OPT" | 210 echo " $SCRIPTS_DIR/enter_chroot.sh $CHROOT_EXAMPLE_OPT" |
211 echo "" | 211 echo "" |
212 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" |
213 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" |
214 echo "delete the chroot cleanly, use:" | 214 echo "delete the chroot cleanly, use:" |
215 echo " $0 --delete $CHROOT_EXAMPLE_OPT" | 215 echo " $0 --delete $CHROOT_EXAMPLE_OPT" |
OLD | NEW |