Fix issue where debconf was asking about the kernel config.

The chroot's apt.conf.d has a debconf file which tells apt
to run dpkg-preconfigure on all packages before installing.
We don't want to do this, especially with an automated build.
This CL changes the apt config used by install_packages.sh to
be self-contained and skip including the default configs by
using the APT_CONFIG evnironement variable.

The CL also cleans up some of the apt command lines as well
as getting rid of some ugly "$ROOT_FS_DIR/..".

Review URL: http://codereview.chromium.org/522003
This commit is contained in:
tedbo 2009-12-23 13:01:00 -08:00
parent 54fd4a350f
commit 551a0d0278

View File

@ -52,7 +52,7 @@ if [[ ! -d "$ROOT_FS_DIR" ]]; then
fi
# Create the temporary apt source.list used to install packages.
APT_SOURCE="${ROOT_FS_DIR}/../sources.list"
APT_SOURCE="${FLAGS_output_dir}/sources.list"
cat <<EOF > "$APT_SOURCE"
deb file:"$FLAGS_setup_dir" local_packages/
deb $FLAGS_server $FLAGS_suite main restricted multiverse universe
@ -63,17 +63,29 @@ APT_CACHE_DIR="${FLAGS_output_dir}/tmp/cache/"
mkdir -p "${APT_CACHE_DIR}/archives/partial"
# Create the apt configuration file. See "man apt.conf"
APT_CONFIG="${ROOT_FS_DIR}/../apt.conf"
APT_PARTS="${FLAGS_output_dir}/apt.conf.d"
mkdir -p "$APT_PARTS" # An empty apt.conf.d to avoid other configs.
export APT_CONFIG="${FLAGS_output_dir}/apt.conf"
cat <<EOF > "$APT_CONFIG"
APT
{
Install-Recommends "0";
Install-Suggests "0";
Get
{
Assume-Yes "1";
};
};
Dir
{
Cache "$APT_CACHE_DIR"; # TODO: Empty string to disable?
Cache "$APT_CACHE_DIR";
Cache {
archives "${APT_CACHE_DIR}/archives"; # TODO: Why do we need this?
archives "${APT_CACHE_DIR}/archives";
};
Etc
{
sourcelist "$APT_SOURCE"
sourcelist "$APT_SOURCE";
parts "$APT_PARTS";
};
State "${ROOT_FS_DIR}/var/lib/apt/";
State
@ -88,12 +100,12 @@ DPkg
EOF
# TODO: Full audit of the apt conf dump to make sure things are ok.
apt-config -c="$APT_CONFIG" dump > "${ROOT_FS_DIR}/../apt.conf.dump"
apt-config dump > "${FLAGS_output_dir}/apt.conf.dump"
# Install prod packages
COMPONENTS=`cat $FLAGS_package_list | grep -v ' *#' | grep -v '^ *$' | sed '/$/{N;s/\n/ /;}'`
sudo apt-get -c="$APT_CONFIG" update
sudo apt-get -c="$APT_CONFIG" --yes --force-yes --no-install-recommends \
sudo APT_CONFIG="$APT_CONFIG" apt-get update
sudo APT_CONFIG="$APT_CONFIG" apt-get --force-yes \
install $COMPONENTS
# Create kernel installation configuration to suppress warnings,
@ -110,13 +122,13 @@ warn_initrd = no
EOF
# Install the kernel.
sudo apt-get -c="$APT_CONFIG" --yes --force-yes --no-install-recommends \
sudo APT_CONFIG="$APT_CONFIG" apt-get --force-yes \
install "linux-image-${FLAGS_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).
sudo apt-get -c="$APT_CONFIG" --yes --force-yes --no-install-recommends \
sudo APT_CONFIG="$APT_CONFIG" apt-get --force-yes \
install bootchart
# Clean up the apt cache.