#!/bin/sh
#
# Check if the configuration and services are working as expected.
# This must be done after the services are restarted, ie
# 86debian-edu-restart

set -e

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

. $pkglibdir/debian-edu-common

logdir=/var/log

#set -x

print "info: Storing the current debconf database into $logdir/installer-debconf-answers.log"
debconf-get-selections > $logdir/installer-debconf-answers.log || true

print "info: Storing the list of currently selected packages into $logdir/installer-dpkg-selections.log"
dpkg --get-selections > $logdir/installer-dpkg-selections.log || true

if test -x /usr/sbin/debian-edu-test-install ; then
    print
    print "info: Testing the installation:"
    print
    if [ "$debian_edu_error_flag_file" ] ; then 
        export debian_edu_error_flag_file
    fi
    /usr/sbin/debian-edu-test-install || true
    print
    print "info: Testing done"
fi

exit 0
