#!/bin/sh -e
# This is a version of the apt-setup menu item with error handling for
# debian-edu.

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

. $pkglibdir/debian-edu-common

load_config

# On new installs, comment out the shipped sources.list, since it assumes
# they are on the network, which is wrong if this is a CD install (this may
# no longer br true; debootstrap generates a pretty decent sources.list).
# Anyway apt-setup generates a better one. Touch the file in any case, because
# apt-setup requires it exist.
touch /etc/apt/sources.list
if [ "$1" = "new" ]; then
        sed 's/^\([^#]\)/#\1/' /etc/apt/sources.list > /etc/apt/sources.list.new
        mv -f /etc/apt/sources.list.new /etc/apt/sources.list
fi

# Have apt-setup probe for a CD. If the CD is not present, this will exit
# nonzero.
if ! apt-setup probe; then
	print "info: apt-setup failed.  Jumping back."
	jump_to 125 debian-edu-insert-cd # Jump back and ask for the CD
else
	# Skip over the apt-setup menu item provided by base-config.
	jump_to 130 debian-edu-inst
fi
