flatcar-scripts/install_packages.sh
tedbo d3ab617757 Remove pybootchartgui since it messes up our repo.
The mirroring process for the internal package repository puts
all mirrored packages into "main" for some reason. Since the Karmic
version of pybootchartgui is in "universe", when we use the internal
repository of packages we need to reference it based on "universe".
However, the external repo will have it at "main". We can't have it
both ways, so we'll need to give up on pybootchartgui until after we
fix up the repo mirroing.

Review URL: http://codereview.chromium.org/509010
2009-12-21 11:06:04 -08:00

83 lines
2.9 KiB
Bash
Executable File

#!/bin/sh
# Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Sets up the chromium-based os from inside a chroot of the root fs.
# NOTE: This script should be called by build_image.sh. Do not run this
# on your own unless you know what you are doing.
set -e
# Read options from the config file created by build_image.sh.
echo "Reading options..."
cat "$(dirname $0)/customize_opts.sh"
. "$(dirname $0)/customize_opts.sh"
PACKAGE_LIST_FILE="${SETUP_DIR}/package-list-prod.txt"
PACKAGE_LIST_FILE2="${SETUP_DIR}/package-list-2.txt"
COMPONENTS=`cat $PACKAGE_LIST_FILE | grep -v ' *#' | grep -v '^ *$' | sed '/$/{N;s/\n/ /;}'`
# Create the temporary apt source.list used to install packages.
cat <<EOF > /etc/apt/sources.list
deb file:"$SETUP_DIR" local_packages/
deb $SERVER $SUITE main restricted multiverse universe
EOF
# Install prod packages
apt-get update
apt-get --yes --force-yes install $COMPONENTS
# Create kernel installation configuration to suppress warnings,
# install the kernel in /boot, and manage symlinks.
cat <<EOF > /etc/kernel-img.conf
link_in_boot = yes
do_symlinks = yes
minimal_swap = yes
clobber_modules = yes
warn_reboot = no
do_bootloader = no
do_initrd = yes
warn_initrd = no
EOF
# NB: KERNEL_VERSION comes from customize_opts.sh
apt-get --yes --force-yes --no-install-recommends \
install "linux-image-${KERNEL_VERSION}"
# Setup bootchart.
# TODO: Move this and other developer oriented "components" into an optional
# package-list-prod-dev.txt (ideally with a better name).
apt-get --yes --force-yes --no-install-recommends install bootchart
# Install additional packages from a second mirror, if necessary. This must
# be done after all packages from the first repository are installed; after
# the apt-get update, apt-get and debootstrap will prefer the newest package
# versions (which are probably on this second mirror).
if [ -f "$PACKAGE_LIST_FILE2" ]
then
COMPONENTS2=`cat $PACKAGE_LIST_FILE2 | grep -v ' *#' | grep -v '^ *$' | sed '/$/{N;s/\n/ /;}'`
echo "deb $SERVER2 $SUITE2 main restricted multiverse universe" \
>> /etc/apt/sources.list
apt-get update
apt-get --yes --force-yes --no-install-recommends \
install $COMPONENTS2
fi
# List all packages installed so far, since these are what the local
# repository needs to contain.
# TODO: better place to put the list. Must still exist after the chroot
# is dismounted, so build_image.sh can get it. That rules out /tmp and
# $SETUP_DIR (which is under /tmp).
sudo sh -c "/trunk/src/scripts/list_installed_packages.sh \
> /etc/package_list_installed.txt"
# Clean up other useless stuff created as part of the install process.
rm -f /var/cache/apt/archives/*.deb
# List all packages still installed post-pruning
sudo sh -c "/trunk/src/scripts/list_installed_packages.sh \
> /etc/package_list_pruned.txt"