| 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 11 matching lines...) Expand all Loading... |
| 22 assert_not_root_user | 22 assert_not_root_user |
| 23 | 23 |
| 24 DEFAULT_PKGLIST="$SRC_ROOT/package_repo/package-list-dev.txt" | 24 DEFAULT_PKGLIST="$SRC_ROOT/package_repo/package-list-dev.txt" |
| 25 | 25 |
| 26 # Define command line flags | 26 # Define command line flags |
| 27 # See http://code.google.com/p/shflags/wiki/Documentation10x | 27 # See http://code.google.com/p/shflags/wiki/Documentation10x |
| 28 DEFINE_string suite "$DEFAULT_DEV_SUITE" \ | 28 DEFINE_string suite "$DEFAULT_DEV_SUITE" \ |
| 29 "Ubuntu suite to use to create the development chroot." | 29 "Ubuntu suite to use to create the development chroot." |
| 30 DEFINE_string mirror "$DEFAULT_DEV_MIRROR" \ | 30 DEFINE_string mirror "$DEFAULT_DEV_MIRROR" \ |
| 31 "Ubuntu mirror to use to create the development chroot." | 31 "Ubuntu mirror to use to create the development chroot." |
| 32 DEFINE_string mirror_src "$DEFAULT_DEV_MIRROR" \ |
| 33 "Ubuntu mirror to use to apt-get package sources." |
| 32 DEFINE_string chroot "$DEFAULT_CHROOT_DIR" \ | 34 DEFINE_string chroot "$DEFAULT_CHROOT_DIR" \ |
| 33 "Destination dir for the chroot environment." | 35 "Destination dir for the chroot environment." |
| 34 DEFINE_string pkglist "$DEFAULT_PKGLIST" \ | 36 DEFINE_string pkglist "$DEFAULT_PKGLIST" \ |
| 35 "File listing additional packages to install." | 37 "File listing additional packages to install." |
| 36 DEFINE_boolean delete $FLAGS_FALSE "Delete an existing chroot." | 38 DEFINE_boolean delete $FLAGS_FALSE "Delete an existing chroot." |
| 37 DEFINE_boolean replace $FLAGS_FALSE "Overwrite existing chroot, if any." | 39 DEFINE_boolean replace $FLAGS_FALSE "Overwrite existing chroot, if any." |
| 38 | 40 |
| 39 # Parse command line flags | 41 # Parse command line flags |
| 40 FLAGS "$@" || exit 1 | 42 FLAGS "$@" || exit 1 |
| 41 eval set -- "${FLAGS_ARGV}" | 43 eval set -- "${FLAGS_ARGV}" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 # prefer our tools or custom packages | 136 # prefer our tools or custom packages |
| 135 bash_chroot "echo deb $DEFAULT_CHROMEOS_SERVER/tools chromiumos_dev \ | 137 bash_chroot "echo deb $DEFAULT_CHROMEOS_SERVER/tools chromiumos_dev \ |
| 136 main > /etc/apt/sources.list" | 138 main > /etc/apt/sources.list" |
| 137 # use specified mirror and suite for the rest of the development chroot | 139 # use specified mirror and suite for the rest of the development chroot |
| 138 bash_chroot "echo deb $FLAGS_mirror $FLAGS_suite \ | 140 bash_chroot "echo deb $FLAGS_mirror $FLAGS_suite \ |
| 139 main restricted multiverse universe >> /etc/apt/sources.list" | 141 main restricted multiverse universe >> /etc/apt/sources.list" |
| 140 # NOTE: Add additional repos here, possibly via command-line args. | 142 # NOTE: Add additional repos here, possibly via command-line args. |
| 141 | 143 |
| 142 # Enable sources for upstream packages. Currently, kernel source is checked in | 144 # Enable sources for upstream packages. Currently, kernel source is checked in |
| 143 # and all other sources are pulled via DEPS files. | 145 # and all other sources are pulled via DEPS files. |
| 144 bash_chroot "echo deb-src $FLAGS_mirror $FLAGS_suite \ | 146 bash_chroot "echo deb-src $FLAGS_mirror_src $FLAGS_suite \ |
| 145 main restricted multiverse universe >> /etc/apt/sources.list" | 147 main restricted multiverse universe >> /etc/apt/sources.list" |
| 146 | 148 |
| 147 # Set /etc/debian_chroot so '(chroot)' shows up in shell prompts | 149 # Set /etc/debian_chroot so '(chroot)' shows up in shell prompts |
| 148 CHROOT_BASE=`basename $FLAGS_chroot` | 150 CHROOT_BASE=`basename $FLAGS_chroot` |
| 149 bash_chroot "echo $CHROOT_BASE > /etc/debian_chroot" | 151 bash_chroot "echo $CHROOT_BASE > /etc/debian_chroot" |
| 150 | 152 |
| 151 # Copy config from outside chroot into chroot | 153 # Copy config from outside chroot into chroot |
| 152 sudo cp /etc/hosts "$FLAGS_chroot/etc/hosts" | 154 sudo cp /etc/hosts "$FLAGS_chroot/etc/hosts" |
| 153 | 155 |
| 154 # Add ourselves as a user inside the chroot | 156 # Add ourselves as a user inside the chroot |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 CHROOT_EXAMPLE_OPT="--chroot=$FLAGS_chroot" | 205 CHROOT_EXAMPLE_OPT="--chroot=$FLAGS_chroot" |
| 204 fi | 206 fi |
| 205 | 207 |
| 206 echo "All set up. To enter the chroot, run:" | 208 echo "All set up. To enter the chroot, run:" |
| 207 echo " $SCRIPTS_DIR/enter_chroot.sh $CHROOT_EXAMPLE_OPT" | 209 echo " $SCRIPTS_DIR/enter_chroot.sh $CHROOT_EXAMPLE_OPT" |
| 208 echo "" | 210 echo "" |
| 209 echo "CAUTION: Do *NOT* rm -rf the chroot directory; if there are stale bind" | 211 echo "CAUTION: Do *NOT* rm -rf the chroot directory; if there are stale bind" |
| 210 echo "mounts you may end up deleting your source tree too. To unmount and" | 212 echo "mounts you may end up deleting your source tree too. To unmount and" |
| 211 echo "delete the chroot cleanly, use:" | 213 echo "delete the chroot cleanly, use:" |
| 212 echo " $0 --delete $CHROOT_EXAMPLE_OPT" | 214 echo " $0 --delete $CHROOT_EXAMPLE_OPT" |
| OLD | NEW |