#!/bin/sh
# Return true if this is a Debian Edu test install, and false if it
# isn't.
. /usr/share/debconf/confmodule

db_get cdrom/codename || true
CDDISTRIBUTION="$RET"

db_get mirror/distribution || true
DISTRIBUTION="$RET"

# Detect test installs over PXE
db_get preseed/early_command || true
EARLYCMD="$RET"

if [ -f /tmp/debian-edu-profile-udeb-testinstall ] || \
   grep -iq "/$CDDISTRIBUTION-test" /cdrom/.disk/mkisofs 2>/dev/null || \
   echo "$EARLYCMD" | grep -iq "/$DISTRIBUTION-test/" ; then
    logger -t edu-is-testinstall "detected test install"
    touch /tmp/debian-edu-profile-udeb-testinstall
    exit 0
else
    logger -t edu-is-testinstall "detected production install"
    exit 1
fi
