#! /bin/sh
set -e

. /usr/share/debconf/confmodule

db_get oem-config-udeb/frontend
apt-install "oem-config${RET:+-$RET}"

db_input high oem-config-udeb/instructions || true
db_go || true

# Copy the value of debian-installer/locale over to the target system so that
# it gets used by oem-config as the default language selection.
# debian-installer/framebuffer is needed for oem-config-debconf.
db_get debian-installer/locale
LOCALE="$RET"
db_get debian-installer/framebuffer
FRAMEBUFFER="$RET"
chroot /target debconf-set-selections <<EOF || true
oem-config debian-installer/locale select $LOCALE
oem-config debian-installer/framebuffer boolean $FRAMEBUFFER
EOF
