#! /bin/sh

set -e

. /usr/share/debconf/confmodule
db_version 2.0

if grep -q '^DISTRIB_ID="Univention"$' /etc/lsb-release
then
	# Univention requires non-interactive install:
	# mysql credentials are read from their config
	# admin user is existing "Administrator" with unchanged password
	# header user is random and gets written to /root/egroupware-epl-install.log
	:
else
	if [ "$1" = configure -o "$1" = upgrade ]
	then
		db_input high "egroupware/header/user" || true
		db_input high "egroupware/header/password" || true
		db_input high "egroupware/admin/user" || true
		db_input high "egroupware/admin/password" || true
		db_input high "egroupware/lang" || true
		db_input high "egroupware/db_root" || true
		db_input high "egroupware/db_root_pw" || true
		db_go
	fi
fi