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 16 matching lines...) Expand all Loading... | |
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 "Comma separated set of package-list files to use." | 32 "Comma separated set of package-list files to use." |
33 DEFINE_string mirror "$DEFAULT_IMG_MIRROR" \ | 33 DEFINE_string mirror "$DEFAULT_IMG_MIRROR" \ |
34 "The upstream package mirror to use." | 34 "The upstream package mirror to use." |
35 DEFINE_string suite "$DEFAULT_IMG_SUITE" \ | 35 DEFINE_string suite "$DEFAULT_IMG_SUITE" \ |
36 "The upstream package suite to use." | 36 "The upstream package suite to use." |
37 DEFINE_string mirror2 "" "Additional package mirror to use (URL only)." | |
38 DEFINE_string suite2 "" "Package suite for additional mirror." | |
37 | 39 |
38 # Parse command line | 40 # Parse command line |
39 FLAGS "$@" || exit 1 | 41 FLAGS "$@" || exit 1 |
40 eval set -- "${FLAGS_ARGV}" | 42 eval set -- "${FLAGS_ARGV}" |
41 | 43 |
42 # Die on any errors. | 44 # Die on any errors. |
43 set -e | 45 set -e |
44 | 46 |
45 KERNEL_DEB_PATH=$(find "${FLAGS_build_root}/${FLAGS_arch}/local_packages" \ | 47 KERNEL_DEB_PATH=$(find "${FLAGS_build_root}/${FLAGS_arch}/local_packages" \ |
46 -name "linux-image-*.deb") | 48 -name "linux-image-*.deb") |
(...skipping 27 matching lines...) Expand all Loading... | |
74 | 76 |
75 # Sometimes the volatile directory is left mounted and sometimes it is not, | 77 # Sometimes the volatile directory is left mounted and sometimes it is not, |
76 # so we precede by '!' to disable the ERR trap. | 78 # so we precede by '!' to disable the ERR trap. |
77 ! sudo umount "$ROOT_FS_DIR"/lib/modules/2.6.*/volatile/ > /dev/null 2>&1 | 79 ! sudo umount "$ROOT_FS_DIR"/lib/modules/2.6.*/volatile/ > /dev/null 2>&1 |
78 | 80 |
79 sudo umount "${ROOT_FS_DIR}/proc" | 81 sudo umount "${ROOT_FS_DIR}/proc" |
80 } | 82 } |
81 | 83 |
82 # Set up repository for locally built packages; these take highest precedence. | 84 # Set up repository for locally built packages; these take highest precedence. |
83 mkdir -p "${SETUP_DIR}/local_packages" | 85 mkdir -p "${SETUP_DIR}/local_packages" |
84 cp "${FLAGS_build_root}/${FLAGS_arch}/local_packages"/* \ | 86 cp "${FLAGS_build_root}/${FLAGS_arch}/local_packages"/*.deb \ |
85 "${SETUP_DIR}/local_packages" | 87 "${SETUP_DIR}/local_packages" |
86 cd "$SETUP_DIR" | 88 cd "$SETUP_DIR" |
87 dpkg-scanpackages local_packages/ /dev/null | \ | 89 dpkg-scanpackages local_packages/ /dev/null | \ |
88 gzip > local_packages/Packages.gz | 90 gzip > local_packages/Packages.gz |
89 cd - | 91 cd - |
90 | 92 |
91 # Create the temporary apt source.list used to install packages. | 93 # Create the temporary apt source.list used to install packages. |
92 APT_SOURCE="${OUTPUT_DIR}/sources.list" | 94 APT_SOURCE="${OUTPUT_DIR}/sources.list" |
93 cat <<EOF > "$APT_SOURCE" | 95 cat <<EOF > "$APT_SOURCE" |
94 deb file:"$SETUP_DIR" local_packages/ | 96 deb copy:"$SETUP_DIR" local_packages/ |
tedbo
2010/01/21 19:17:14
Why do you want to change this to copy into the ap
cjwatson
2010/01/22 11:27:34
As discussed yesterday, it's because otherwise dpk
tedbo
2010/01/22 17:39:42
No, please leave it in. I have it myself in my loc
| |
95 deb $FLAGS_mirror $FLAGS_suite main restricted multiverse universe | 97 deb $FLAGS_mirror $FLAGS_suite main restricted multiverse universe |
96 EOF | 98 EOF |
99 if [ -n "$FLAGS_mirror2" ] && [ -n "$FLAGS_suite2" ]; then | |
100 cat <<EOF >> "$APT_SOURCE" | |
101 deb $FLAGS_mirror2 $FLAGS_suite2 main restricted multiverse universe | |
102 EOF | |
103 fi | |
97 | 104 |
98 # Cache directory for APT to use. This cache is re-used across builds. We | 105 # Cache directory for APT to use. This cache is re-used across builds. We |
99 # rely on the cache to reduce traffic to the hosted repositories. | 106 # rely on the cache to reduce traffic to the hosted repositories. |
100 APT_CACHE_DIR="${FLAGS_build_root}/apt_cache-${FLAGS_arch}/" | 107 APT_CACHE_DIR="${FLAGS_build_root}/apt_cache-${FLAGS_arch}/" |
101 mkdir -p "${APT_CACHE_DIR}/archives/partial" | 108 mkdir -p "${APT_CACHE_DIR}/archives/partial" |
102 | 109 |
110 if [ "${FLAGS_arch}" = x86 ]; then | |
111 APT_ARCH=i386 | |
112 else | |
113 APT_ARCH="${FLAGS_arch}" | |
114 fi | |
115 | |
103 # Create the apt configuration file. See "man apt.conf" | 116 # Create the apt configuration file. See "man apt.conf" |
104 APT_PARTS="${OUTPUT_DIR}/apt.conf.d" | 117 APT_PARTS="${OUTPUT_DIR}/apt.conf.d" |
105 mkdir -p "$APT_PARTS" # An empty apt.conf.d to avoid other configs. | 118 mkdir -p "$APT_PARTS" # An empty apt.conf.d to avoid other configs. |
106 export APT_CONFIG="${OUTPUT_DIR}/apt.conf" | 119 export APT_CONFIG="${OUTPUT_DIR}/apt.conf" |
107 cat <<EOF > "$APT_CONFIG" | 120 cat <<EOF > "$APT_CONFIG" |
108 APT | 121 APT |
109 { | 122 { |
110 Install-Recommends "0"; | 123 Install-Recommends "0"; |
111 Install-Suggests "0"; | 124 Install-Suggests "0"; |
112 Get | 125 Get |
113 { | 126 { |
114 Assume-Yes "1"; | 127 Assume-Yes "1"; |
115 AllowUnauthenticated "1"; | 128 AllowUnauthenticated "1"; |
116 }; | 129 }; |
130 Architecture "${APT_ARCH}"; | |
117 }; | 131 }; |
118 Dir | 132 Dir |
119 { | 133 { |
120 Bin { | 134 Bin { |
121 dpkg "${SCRIPTS_DIR}/dpkg_no_scripts.sh"; | 135 dpkg "${SCRIPTS_DIR}/dpkg_no_scripts.sh"; |
122 }; | 136 }; |
123 Cache "$APT_CACHE_DIR"; | 137 Cache "$APT_CACHE_DIR"; |
124 Cache { | 138 Cache { |
125 archives "${APT_CACHE_DIR}/archives"; | 139 archives "${APT_CACHE_DIR}/archives"; |
126 }; | 140 }; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 apt-get --force-yes install "linux-image-${KERNEL_VERSION}" | 256 apt-get --force-yes install "linux-image-${KERNEL_VERSION}" |
243 | 257 |
244 # List all packages installed so far, since these are what the local | 258 # List all packages installed so far, since these are what the local |
245 # repository needs to contain. | 259 # repository needs to contain. |
246 # TODO: Replace with list_installed_packages.sh when it is fixed up. | 260 # TODO: Replace with list_installed_packages.sh when it is fixed up. |
247 dpkg --root="${ROOT_FS_DIR}" -l > \ | 261 dpkg --root="${ROOT_FS_DIR}" -l > \ |
248 "${OUTPUT_DIR}/package_list_installed.txt" | 262 "${OUTPUT_DIR}/package_list_installed.txt" |
249 | 263 |
250 cleanup_rootfs_mounts | 264 cleanup_rootfs_mounts |
251 trap - EXIT | 265 trap - EXIT |
OLD | NEW |