Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Side by Side Diff: src/scripts/make_chroot.sh

Issue 507005: Add ARM cross-compiler to chroot. (Closed)
Patch Set: Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/package_repo/repo_list_dev.txt ('k') | src/scripts/make_local_repo.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 and as a regular user. 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 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" "Repository suite to base image on." 28 DEFINE_string suite "$DEFAULT_DEV_SUITE" "Repository suite to base image on."
29 DEFINE_string mirror "$DEFAULT_DEV_MIRROR" "Local repository mirror to use." 29 DEFINE_string mirror "$DEFAULT_DEV_MIRROR" "Local repository mirror to use."
30 DEFINE_string mirror2 "" "Additional repository mirror to use (URL only)."
31 DEFINE_string suite2 "" "Repository suite for additional mirror."
30 DEFINE_string chroot "$DEFAULT_CHROOT_DIR" \ 32 DEFINE_string chroot "$DEFAULT_CHROOT_DIR" \
31 "Destination dir for the chroot environment." 33 "Destination dir for the chroot environment."
32 DEFINE_string pkglist "$DEFAULT_PKGLIST" \ 34 DEFINE_string pkglist "$DEFAULT_PKGLIST" \
33 "File listing additional packages to install." 35 "File listing additional packages to install."
34 DEFINE_boolean delete $FLAGS_FALSE "Delete an existing chroot." 36 DEFINE_boolean delete $FLAGS_FALSE "Delete an existing chroot."
35 DEFINE_boolean replace $FLAGS_FALSE "Overwrite existing chroot, if any." 37 DEFINE_boolean replace $FLAGS_FALSE "Overwrite existing chroot, if any."
36 38
37 # Parse command line flags 39 # Parse command line flags
38 FLAGS "$@" || exit 1 40 FLAGS "$@" || exit 1
39 eval set -- "${FLAGS_ARGV}" 41 eval set -- "${FLAGS_ARGV}"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 # the user's already typed in one sudo password...) 128 # the user's already typed in one sudo password...)
127 bash_chroot "echo %admin ALL=\(ALL\) ALL >> /etc/sudoers" 129 bash_chroot "echo %admin ALL=\(ALL\) ALL >> /etc/sudoers"
128 bash_chroot "echo $USER ALL=NOPASSWD: ALL >> /etc/sudoers" 130 bash_chroot "echo $USER ALL=NOPASSWD: ALL >> /etc/sudoers"
129 131
130 # Set up apt sources 132 # Set up apt sources
131 # If a local repository is used, it will have a different path when 133 # If a local repository is used, it will have a different path when
132 # bind-mounted inside the chroot 134 # bind-mounted inside the chroot
133 MIRROR_INSIDE="${FLAGS_mirror/$GCLIENT_ROOT/$CHROOT_TRUNK_DIR}" 135 MIRROR_INSIDE="${FLAGS_mirror/$GCLIENT_ROOT/$CHROOT_TRUNK_DIR}"
134 bash_chroot "echo deb $MIRROR_INSIDE $FLAGS_suite \ 136 bash_chroot "echo deb $MIRROR_INSIDE $FLAGS_suite \
135 main restricted multiverse universe > /etc/apt/sources.list" 137 main restricted multiverse universe > /etc/apt/sources.list"
138 # Additional repo? Note: Not mounted inside - must use URL
139 if [ -n "$FLAGS_mirror2" ]; then
140 bash_chroot "echo deb $FLAGS_mirror2 $FLAGS_suite2 \
141 main restricted multiverse universe >> /etc/apt/sources.list"
142 fi
143
136 # TODO: enable sources when needed. Currently, kernel source is checked in 144 # TODO: enable sources when needed. Currently, kernel source is checked in
137 # and all other sources are pulled via DEPS files. 145 # and all other sources are pulled via DEPS files.
138 #bash_chroot "echo deb-src $MIRROR_INSIDE $FLAGS_suite \ 146 #bash_chroot "echo deb-src $MIRROR_INSIDE $FLAGS_suite \
139 # main restricted multiverse universe >> /etc/apt/sources.list" 147 # main restricted multiverse universe >> /etc/apt/sources.list"
140 148
141 # Set /etc/debian_chroot so '(chroot)' shows up in shell prompts 149 # Set /etc/debian_chroot so '(chroot)' shows up in shell prompts
142 CHROOT_BASE=`basename $FLAGS_chroot` 150 CHROOT_BASE=`basename $FLAGS_chroot`
143 bash_chroot "echo $CHROOT_BASE > /etc/debian_chroot" 151 bash_chroot "echo $CHROOT_BASE > /etc/debian_chroot"
144 152
145 # Copy config from outside chroot into chroot 153 # Copy config from outside chroot into chroot
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 CHROOT_EXAMPLE_OPT="--chroot=$FLAGS_chroot" 206 CHROOT_EXAMPLE_OPT="--chroot=$FLAGS_chroot"
199 fi 207 fi
200 208
201 echo "All set up. To enter the chroot, run:" 209 echo "All set up. To enter the chroot, run:"
202 echo " $SCRIPTS_DIR/enter_chroot.sh $CHROOT_EXAMPLE_OPT" 210 echo " $SCRIPTS_DIR/enter_chroot.sh $CHROOT_EXAMPLE_OPT"
203 echo "" 211 echo ""
204 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"
205 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"
206 echo "delete the chroot cleanly, use:" 214 echo "delete the chroot cleanly, use:"
207 echo " $0 --delete $CHROOT_EXAMPLE_OPT" 215 echo " $0 --delete $CHROOT_EXAMPLE_OPT"
OLDNEW
« no previous file with comments | « src/package_repo/repo_list_dev.txt ('k') | src/scripts/make_local_repo.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698