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

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

Issue 548109: Build: allow package lists to be filtered by arch. (Closed)
Patch Set: fixes for review Created 10 years, 11 months 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/package-list-prod.txt ('k') | no next file » | 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 # 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 filter_pkgs() {
217 pkglist="$1"
218 arch="$2"
219
220 # to read list of package + version skipping empty lines and comments, and
221 # convert "foo 1.2-3" to "foo=1.2-3", use:
222 #pkgs="$(grep '^[^#]' "$pkglist" | cut -d ' ' -f 1-2 | sed 's/ /=/')"
223
224 # read list of "package [optional arch list]" skipping empty lines and
225 # comments
226 grep '^[^#]' "$pkglist" | while read pkg archspec; do
227 case "$archspec" in
228 ""|"[$arch "*|"[$arch]"|*" $arch]")
229 echo "$pkg"
230 ;;
231 *"!$arch "*|*"!$arch]")
232 :
233 ;;
234 "["*"!"*"]")
235 echo "$pkg"
236 ;;
237 esac
238 done
239 }
240
216 # Install packages from the given package-lists 241 # Install packages from the given package-lists
217 PACKAGE_LISTS=$(echo "$FLAGS_package_list" | sed -e 's/,/ /g') 242 PACKAGE_LISTS=$(echo "$FLAGS_package_list" | sed -e 's/,/ /g')
243 PKG_LIST_ARCH="$FLAGS_arch"
244 if [ "$PKG_LIST_ARCH" = "x86" ]; then
245 PKG_LIST_ARCH="i386"
246 fi
218 for p in $PACKAGE_LISTS; do 247 for p in $PACKAGE_LISTS; do
219 COMPONENTS=$(cat "$p" | \ 248 COMPONENTS=$(filter_pkgs "$p" "$PKG_LIST_ARCH")
220 sed -e 's/#.*//' | \
221 grep -v '^ *$' | \
222 sed '/$/{N;s/\n/ /;}')
223 sudo APT_CONFIG="$APT_CONFIG" DEBIAN_FRONTEND=noninteractive \ 249 sudo APT_CONFIG="$APT_CONFIG" DEBIAN_FRONTEND=noninteractive \
224 ARCH="$FLAGS_arch" apt-get --force-yes install $COMPONENTS 250 ARCH="$FLAGS_arch" apt-get --force-yes install $COMPONENTS
225 done 251 done
226 252
227 # Create kernel installation configuration to suppress warnings, 253 # Create kernel installation configuration to suppress warnings,
228 # install the kernel in /boot, and manage symlinks. 254 # install the kernel in /boot, and manage symlinks.
229 cat <<EOF | sudo dd of="${ROOT_FS_DIR}/etc/kernel-img.conf" 255 cat <<EOF | sudo dd of="${ROOT_FS_DIR}/etc/kernel-img.conf"
230 link_in_boot = yes 256 link_in_boot = yes
231 do_symlinks = yes 257 do_symlinks = yes
232 minimal_swap = yes 258 minimal_swap = yes
233 clobber_modules = yes 259 clobber_modules = yes
234 warn_reboot = no 260 warn_reboot = no
235 do_bootloader = no 261 do_bootloader = no
236 do_initrd = yes 262 do_initrd = yes
237 warn_initrd = no 263 warn_initrd = no
238 EOF 264 EOF
239 265
240 # Install the kernel. 266 # Install the kernel.
241 sudo APT_CONFIG="$APT_CONFIG" DEBIAN_FRONTEND=noninteractive ARCH="$FLAGS_arch"\ 267 sudo APT_CONFIG="$APT_CONFIG" DEBIAN_FRONTEND=noninteractive ARCH="$FLAGS_arch"\
242 apt-get --force-yes install "linux-image-${KERNEL_VERSION}" 268 apt-get --force-yes install "linux-image-${KERNEL_VERSION}"
243 269
244 # List all packages installed so far, since these are what the local 270 # List all packages installed so far, since these are what the local
245 # repository needs to contain. 271 # repository needs to contain.
246 # TODO: Replace with list_installed_packages.sh when it is fixed up. 272 # TODO: Replace with list_installed_packages.sh when it is fixed up.
247 dpkg --root="${ROOT_FS_DIR}" -l > \ 273 dpkg --root="${ROOT_FS_DIR}" -l > \
248 "${OUTPUT_DIR}/package_list_installed.txt" 274 "${OUTPUT_DIR}/package_list_installed.txt"
249 275
250 cleanup_rootfs_mounts 276 cleanup_rootfs_mounts
251 trap - EXIT 277 trap - EXIT
OLDNEW
« no previous file with comments | « src/package_repo/package-list-prod.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698