#! /bin/sh -e
#
# Last finishing touch before rebooting into the installed system.
#
# Try to avoid adding new code here.  Please put it in
# debian-edu-config in the
# /usr/share/debian-edu-config/d-i/finish-install script instead.

. /usr/share/debconf/confmodule
. /lib/debian-edu-common

log() {
    logger -t 10debian-edu-install "$@"
}

error() {
    logger -t 10debian-edu-install "error: $@"
}

at_exit() {
    error "script $0 terminated unexpectedly."
}
disable_exception() { trap - INT TERM EXIT; }
trap at_exit INT TERM EXIT

# Stop automatic lvm resize script set up before base-installer
# started.
rm -f /target/debian-edu-extend-file-systems

load_proxy_conf

hook=/target/usr/share/debian-edu-config/d-i/finish-install
if [ -x $hook ] ; then
    log "Running debian-edu-config finish-install hook"
    $hook
else
    error "Unable to find $hook"
fi

edu-eatmydata-install disable

disable_exception
exit 0
