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 # Script to install packages into the target root file system. | 7 # Script to install packages into the target root file system. |
8 # | 8 # |
9 # NOTE: This script should be called by build_image.sh. Do not run this | 9 # NOTE: This script should be called by build_image.sh. Do not run this |
10 # on your own unless you know what you are doing. | 10 # on your own unless you know what you are doing. |
(...skipping 11 matching lines...) Expand all Loading... |
22 # Flags | 22 # Flags |
23 DEFINE_string output_dir "" \ | 23 DEFINE_string output_dir "" \ |
24 "The location of the output directory to use [REQUIRED]." | 24 "The location of the output directory to use [REQUIRED]." |
25 DEFINE_string root "" \ | 25 DEFINE_string root "" \ |
26 "The root file system to install packages in." | 26 "The root file system to install packages in." |
27 DEFINE_string arch "x86" \ | 27 DEFINE_string arch "x86" \ |
28 "The target architecture to build for. One of { x86, armel }." | 28 "The target architecture to build for. One of { x86, armel }." |
29 DEFINE_string build_root "$DEFAULT_BUILD_ROOT" \ | 29 DEFINE_string build_root "$DEFAULT_BUILD_ROOT" \ |
30 "Root of build output" | 30 "Root of build output" |
31 DEFINE_string package_list "$DEFAULT_PKGLIST" \ | 31 DEFINE_string package_list "$DEFAULT_PKGLIST" \ |
32 "The package list file to use." | 32 "Comma separated set of package-list files to use." |
33 DEFINE_string server "$DEFAULT_EXT_MIRROR" \ | 33 DEFINE_string server "$DEFAULT_EXT_MIRROR" \ |
34 "The package server to use." | 34 "The package server to use." |
35 DEFINE_string suite "$DEFAULT_IMG_SUITE" \ | 35 DEFINE_string suite "$DEFAULT_IMG_SUITE" \ |
36 "The package suite to use." | 36 "The package suite to use." |
37 | 37 |
38 # Parse command line | 38 # Parse command line |
39 FLAGS "$@" || exit 1 | 39 FLAGS "$@" || exit 1 |
40 eval set -- "${FLAGS_ARGV}" | 40 eval set -- "${FLAGS_ARGV}" |
41 | 41 |
42 # Die on any errors. | 42 # Die on any errors. |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 207 |
208 # Set up mounts for working within the rootfs. We copy some basic | 208 # Set up mounts for working within the rootfs. We copy some basic |
209 # network information from the host so that maintainer scripts can | 209 # network information from the host so that maintainer scripts can |
210 # access the network as needed. | 210 # access the network as needed. |
211 # TODO: All of this rootfs mount stuff can be removed as soon as we stop | 211 # TODO: All of this rootfs mount stuff can be removed as soon as we stop |
212 # running the maintainer scripts on install. | 212 # running the maintainer scripts on install. |
213 sudo mount -t proc proc "${ROOT_FS_DIR}/proc" | 213 sudo mount -t proc proc "${ROOT_FS_DIR}/proc" |
214 sudo cp /etc/hosts "${ROOT_FS_DIR}/etc" | 214 sudo cp /etc/hosts "${ROOT_FS_DIR}/etc" |
215 trap cleanup_rootfs_mounts EXIT | 215 trap cleanup_rootfs_mounts EXIT |
216 | 216 |
217 # Install prod packages | 217 # Install packages from the given package-lists |
218 COMPONENTS=`cat $FLAGS_package_list | sed -e 's/#.*//' | grep -v '^ *$' | sed '/
$/{N;s/\n/ /;}'` | 218 PACKAGE_LISTS=$(echo "$FLAGS_package_list" | sed -e 's/,/ /g') |
219 sudo APT_CONFIG="$APT_CONFIG" DEBIAN_FRONTEND=noninteractive \ | 219 for p in $PACKAGE_LISTS; do |
220 apt-get --force-yes install $COMPONENTS | 220 COMPONENTS=$(cat "$p" | \ |
| 221 sed -e 's/#.*//' | \ |
| 222 grep -v '^ *$' | \ |
| 223 sed '/$/{N;s/\n/ /;}') |
| 224 sudo APT_CONFIG="$APT_CONFIG" DEBIAN_FRONTEND=noninteractive \ |
| 225 apt-get --force-yes install $COMPONENTS |
| 226 done |
221 | 227 |
222 # Create kernel installation configuration to suppress warnings, | 228 # Create kernel installation configuration to suppress warnings, |
223 # install the kernel in /boot, and manage symlinks. | 229 # install the kernel in /boot, and manage symlinks. |
224 cat <<EOF | sudo dd of="${ROOT_FS_DIR}/etc/kernel-img.conf" | 230 cat <<EOF | sudo dd of="${ROOT_FS_DIR}/etc/kernel-img.conf" |
225 link_in_boot = yes | 231 link_in_boot = yes |
226 do_symlinks = yes | 232 do_symlinks = yes |
227 minimal_swap = yes | 233 minimal_swap = yes |
228 clobber_modules = yes | 234 clobber_modules = yes |
229 warn_reboot = no | 235 warn_reboot = no |
230 do_bootloader = no | 236 do_bootloader = no |
231 do_initrd = yes | 237 do_initrd = yes |
232 warn_initrd = no | 238 warn_initrd = no |
233 EOF | 239 EOF |
234 | 240 |
235 # Install the kernel. | 241 # Install the kernel. |
236 sudo APT_CONFIG="$APT_CONFIG" DEBIAN_FRONTEND=noninteractive \ | 242 sudo APT_CONFIG="$APT_CONFIG" DEBIAN_FRONTEND=noninteractive \ |
237 apt-get --force-yes install "linux-image-${KERNEL_VERSION}" | 243 apt-get --force-yes install "linux-image-${KERNEL_VERSION}" |
238 | 244 |
239 # List all packages installed so far, since these are what the local | 245 # List all packages installed so far, since these are what the local |
240 # repository needs to contain. | 246 # repository needs to contain. |
241 # TODO: Replace with list_installed_packages.sh when it is fixed up. | 247 # TODO: Replace with list_installed_packages.sh when it is fixed up. |
242 dpkg --root="${ROOT_FS_DIR}" -l > \ | 248 dpkg --root="${ROOT_FS_DIR}" -l > \ |
243 "${OUTPUT_DIR}/package_list_installed.txt" | 249 "${OUTPUT_DIR}/package_list_installed.txt" |
244 | 250 |
245 cleanup_rootfs_mounts | 251 cleanup_rootfs_mounts |
246 trap - EXIT | 252 trap - EXIT |
OLD | NEW |