#!/bin/sh -e

# Unfortunately, we can't use in-target here as this doesn't allow to set the
# debconf frontend to noninteractive.

. /lib/chroot-setup.sh

if ! chroot_setup; then
	logger -t live-installer -- "Unexpected error; command not executed: '$@'"
	exit 1
fi

DEBIAN_FRONTEND=noninteractive
export DEBIAN_FRONTEND

# Reconfigure console-setup
if [ -e /target/var/lib/dpkg/info/console-setup.postinst ]; then
	log-output -t live-installer chroot /target \
	dpkg-reconfigure --no-reload console-setup

	chroot /target setupcon --save-only
fi

chroot_cleanup
