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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 # Install initial packages directly with dpkg_no_scripts.sh | 179 # Install initial packages directly with dpkg_no_scripts.sh |
180 ARCH="$FLAGS_arch" | 180 ARCH="$FLAGS_arch" |
181 if [ "$ARCH" = "x86" ]; then | 181 if [ "$ARCH" = "x86" ]; then |
182 ARCH="i?86" # Match i386 | i686 | 182 ARCH="i?86" # Match i386 | i686 |
183 fi | 183 fi |
184 for p in $PACKAGES $EXTRA_PACKAGES; do | 184 for p in $PACKAGES $EXTRA_PACKAGES; do |
185 PKG=$(ls "${REPO}"/${p}_*_$ARCH.deb || /bin/true) | 185 PKG=$(ls "${REPO}"/${p}_*_$ARCH.deb || /bin/true) |
186 if [ -z "$PKG" ]; then | 186 if [ -z "$PKG" ]; then |
187 PKG=$(ls "${REPO}"/${p}_*_all.deb) | 187 PKG=$(ls "${REPO}"/${p}_*_all.deb) |
188 fi | 188 fi |
189 sudo "${SCRIPTS_DIR}"/dpkg_no_scripts.sh \ | 189 sudo ARCH="$FLAGS_arch" "${SCRIPTS_DIR}"/dpkg_no_scripts.sh \ |
190 --root="$ROOT_FS_DIR" --nodpkg_fallback --unpack "$PKG" | 190 --root="$ROOT_FS_DIR" --nodpkg_fallback --unpack "$PKG" |
191 sudo "${SCRIPTS_DIR}"/dpkg_no_scripts.sh \ | 191 sudo ARCH="$FLAGS_arch" "${SCRIPTS_DIR}"/dpkg_no_scripts.sh \ |
192 --root="$ROOT_FS_DIR" --nodpkg_fallback --configure "$p" | 192 --root="$ROOT_FS_DIR" --nodpkg_fallback --configure "$p" |
193 done | 193 done |
194 | 194 |
195 # Make sure that apt is ready to work. We use --fix-broken to trigger apt | 195 # Make sure that apt is ready to work. We use --fix-broken to trigger apt |
196 # to install additional critical packages. If there are any of these, we | 196 # to install additional critical packages. If there are any of these, we |
197 # disable the maintainer scripts so they install ok. | 197 # disable the maintainer scripts so they install ok. |
198 TMP_FORCE_NO_SCRIPTS="-o=DPkg::options::=--nodpkg_fallback" | 198 TMP_FORCE_NO_SCRIPTS="-o=DPkg::options::=--nodpkg_fallback" |
199 sudo APT_CONFIG="$APT_CONFIG" DEBIAN_FRONTEND=noninteractive \ | 199 sudo APT_CONFIG="$APT_CONFIG" DEBIAN_FRONTEND=noninteractive ARCH="$FLAGS_arch"\ |
200 apt-get $TMP_FORCE_NO_SCRIPTS --force-yes --fix-broken install | 200 apt-get $TMP_FORCE_NO_SCRIPTS --force-yes --fix-broken install |
201 | 201 |
202 # TODO: Remove these hacks when we stop having maintainer scripts altogether. | 202 # TODO: Remove these hacks when we stop having maintainer scripts altogether. |
203 sudo cp -a /dev/* "${ROOT_FS_DIR}/dev" | 203 sudo cp -a /dev/* "${ROOT_FS_DIR}/dev" |
204 sudo cp -a /etc/resolv.conf "${ROOT_FS_DIR}/etc/resolv.conf" | 204 sudo cp -a /etc/resolv.conf "${ROOT_FS_DIR}/etc/resolv.conf" |
205 sudo ln -sf /bin/true "${ROOT_FS_DIR}/usr/sbin/invoke-rc.d" | 205 sudo ln -sf /bin/true "${ROOT_FS_DIR}/usr/sbin/invoke-rc.d" |
206 sudo ln -sf /bin/true "${ROOT_FS_DIR}/usr/sbin/update-rc.d" | 206 sudo ln -sf /bin/true "${ROOT_FS_DIR}/usr/sbin/update-rc.d" |
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 trap cleanup_rootfs_mounts EXIT | 214 trap cleanup_rootfs_mounts EXIT |
215 | 215 |
216 # Install packages from the given package-lists | 216 # Install packages from the given package-lists |
217 PACKAGE_LISTS=$(echo "$FLAGS_package_list" | sed -e 's/,/ /g') | 217 PACKAGE_LISTS=$(echo "$FLAGS_package_list" | sed -e 's/,/ /g') |
218 for p in $PACKAGE_LISTS; do | 218 for p in $PACKAGE_LISTS; do |
219 COMPONENTS=$(cat "$p" | \ | 219 COMPONENTS=$(cat "$p" | \ |
220 sed -e 's/#.*//' | \ | 220 sed -e 's/#.*//' | \ |
221 grep -v '^ *$' | \ | 221 grep -v '^ *$' | \ |
222 sed '/$/{N;s/\n/ /;}') | 222 sed '/$/{N;s/\n/ /;}') |
223 sudo APT_CONFIG="$APT_CONFIG" DEBIAN_FRONTEND=noninteractive \ | 223 sudo APT_CONFIG="$APT_CONFIG" DEBIAN_FRONTEND=noninteractive \ |
224 apt-get --force-yes install $COMPONENTS | 224 ARCH="$FLAGS_arch" apt-get --force-yes install $COMPONENTS |
225 done | 225 done |
226 | 226 |
227 # Create kernel installation configuration to suppress warnings, | 227 # Create kernel installation configuration to suppress warnings, |
228 # install the kernel in /boot, and manage symlinks. | 228 # install the kernel in /boot, and manage symlinks. |
229 cat <<EOF | sudo dd of="${ROOT_FS_DIR}/etc/kernel-img.conf" | 229 cat <<EOF | sudo dd of="${ROOT_FS_DIR}/etc/kernel-img.conf" |
230 link_in_boot = yes | 230 link_in_boot = yes |
231 do_symlinks = yes | 231 do_symlinks = yes |
232 minimal_swap = yes | 232 minimal_swap = yes |
233 clobber_modules = yes | 233 clobber_modules = yes |
234 warn_reboot = no | 234 warn_reboot = no |
235 do_bootloader = no | 235 do_bootloader = no |
236 do_initrd = yes | 236 do_initrd = yes |
237 warn_initrd = no | 237 warn_initrd = no |
238 EOF | 238 EOF |
239 | 239 |
240 # Install the kernel. | 240 # Install the kernel. |
241 sudo APT_CONFIG="$APT_CONFIG" DEBIAN_FRONTEND=noninteractive \ | 241 sudo APT_CONFIG="$APT_CONFIG" DEBIAN_FRONTEND=noninteractive ARCH="$FLAGS_arch"\ |
242 apt-get --force-yes install "linux-image-${KERNEL_VERSION}" | 242 apt-get --force-yes install "linux-image-${KERNEL_VERSION}" |
243 | 243 |
244 # List all packages installed so far, since these are what the local | 244 # List all packages installed so far, since these are what the local |
245 # repository needs to contain. | 245 # repository needs to contain. |
246 # TODO: Replace with list_installed_packages.sh when it is fixed up. | 246 # TODO: Replace with list_installed_packages.sh when it is fixed up. |
247 dpkg --root="${ROOT_FS_DIR}" -l > \ | 247 dpkg --root="${ROOT_FS_DIR}" -l > \ |
248 "${OUTPUT_DIR}/package_list_installed.txt" | 248 "${OUTPUT_DIR}/package_list_installed.txt" |
249 | 249 |
250 cleanup_rootfs_mounts | 250 cleanup_rootfs_mounts |
251 trap - EXIT | 251 trap - EXIT |
OLD | NEW |