| 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 |
| 11 # listed in PACKAGE_LIST_FILE (below) and their dependencies. Once created, | 11 # listed in PACKAGE_LIST_FILE (below) and their dependencies. Once created, |
| 12 # the password is set to PASSWORD (below). One can enter the chrooted | 12 # the password is set to PASSWORD (below). One can enter the chrooted |
| 13 # environment for work by running | 13 # environment for work by running |
| 14 # enter_chroot_dev_environment.sh /path/to/chroot-root | 14 # enter_chroot_dev_environment.sh /path/to/chroot-root |
| 15 | 15 |
| 16 # Load common constants. This should be the first executable line. | 16 # Load common constants. This should be the first executable line. |
| 17 # The path to common.sh should be relative to your script's location. | 17 # The path to common.sh should be relative to your script's location. |
| 18 . "$(dirname "$0")/common.sh" | 18 . "$(dirname "$0")/common.sh" |
| 19 | 19 |
| 20 # Script must be run outside the chroot | 20 # Script must be run outside the chroot and as a regular user. |
| 21 assert_outside_chroot | 21 assert_outside_chroot |
| 22 assert_not_root_user |
| 22 | 23 |
| 23 DEFAULT_PKGLIST="$SRC_ROOT/package_repo/package-list-dev.txt" | 24 DEFAULT_PKGLIST="$SRC_ROOT/package_repo/package-list-dev.txt" |
| 24 | 25 |
| 25 # Define command line flags | 26 # Define command line flags |
| 26 # See http://code.google.com/p/shflags/wiki/Documentation10x | 27 # See http://code.google.com/p/shflags/wiki/Documentation10x |
| 27 DEFINE_string suite "$DEFAULT_DEV_SUITE" "Repository suite to base image on." | 28 DEFINE_string suite "$DEFAULT_DEV_SUITE" "Repository suite to base image on." |
| 28 DEFINE_string mirror "$DEFAULT_DEV_MIRROR" "Local repository mirror to use." | 29 DEFINE_string mirror "$DEFAULT_DEV_MIRROR" "Local repository mirror to use." |
| 29 DEFINE_string chroot "$DEFAULT_CHROOT_DIR" \ | 30 DEFINE_string chroot "$DEFAULT_CHROOT_DIR" \ |
| 30 "Destination dir for the chroot environment." | 31 "Destination dir for the chroot environment." |
| 31 DEFINE_string pkglist "$DEFAULT_PKGLIST" \ | 32 DEFINE_string pkglist "$DEFAULT_PKGLIST" \ |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 CHROOT_EXAMPLE_OPT="--chroot=$FLAGS_chroot" | 193 CHROOT_EXAMPLE_OPT="--chroot=$FLAGS_chroot" |
| 193 fi | 194 fi |
| 194 | 195 |
| 195 echo "All set up. To enter the chroot, run:" | 196 echo "All set up. To enter the chroot, run:" |
| 196 echo " $SCRIPTS_DIR/enter_chroot.sh $CHROOT_EXAMPLE_OPT" | 197 echo " $SCRIPTS_DIR/enter_chroot.sh $CHROOT_EXAMPLE_OPT" |
| 197 echo "" | 198 echo "" |
| 198 echo "CAUTION: Do *NOT* rm -rf the chroot directory; if there are stale bind" | 199 echo "CAUTION: Do *NOT* rm -rf the chroot directory; if there are stale bind" |
| 199 echo "mounts you may end up deleting your source tree too. To unmount and" | 200 echo "mounts you may end up deleting your source tree too. To unmount and" |
| 200 echo "delete the chroot cleanly, use:" | 201 echo "delete the chroot cleanly, use:" |
| 201 echo " $0 --delete $CHROOT_EXAMPLE_OPT" | 202 echo " $0 --delete $CHROOT_EXAMPLE_OPT" |
| OLD | NEW |