#!/bin/sh
#
# Ask the user to inset the CD

set -e

pkglibdir=/usr/lib/debian-edu-install

. $pkglibdir/debian-edu-common

init_debconf

#set -x

load_config

print "info: Ask the user to insert the install CD"

# Make sure the frontend is interactive if we loop back from 65debian-edu-inst.
if test "$NONINTERACTIVE" = true; then
    db_get debconf/frontend || true
    if test "$RET" = "Noninteractive" || test "$RET" = "noninteractive" ; then
    	debconf-set-frontend Dialog
	# Restart this script with Dialog frontend
	jump_to 125 debian-edu-insert-cd
    fi
fi

db_fset debian-edu-install/insert-cd seen false || true
db_input critical debian-edu-install/insert-cd || [ $? -eq 30 ]
db_go || true

# Enable noninteractive frontend if it worked to set default answers
if test "$NONINTERACTIVE" = true ; then
    debconf-set-frontend Noninteractive
fi

exit 0
