#!/bin/sh -e
# Read the settings file wrote by the boot-floppies, and translaste some
# values therein into the debconf db.
. /usr/share/debconf/confmodule

if [ -e /root/dbootstrap_settings ]; then
	. /root/dbootstrap_settings || true

	# Take whatever verbosity level was used in boot floppies, and use it.
	if [ "$VERBOSE" = yes ]; then
		db_set debconf/priority low
	elif [ "$VERBOSE" = quiet ]; then
		db_set debconf/priority critical
	fi

	# If there is a proxy setting, use that as the default for apt
	# setup.
	if [ "$HTTP_PROXY" ]; then
		db_set apt-setup/http_proxy "$HTTP_PROXY"
	fi

	# If there is a suite setting, use that as the default for apt
	# setup.
	if [ "$SUITE" ]; then
		db_set apt-setup/distribution "$SUITE"
	fi

	# TODO: move rest of settings over too. Ideally, all the dbootstrap
	# settings stuff should be in the debconf db and other scripts can
	# just use it from there. That will pave the way for d-i just
	# copying in a debconf db.
fi
