#!/bin/sh

set -e

. /usr/share/debconf/confmodule

CONFFILE="/etc/default/tomcat7"
JAVA_OPTS="-Djava.awt.headless=true -Xmx128m"

if [ -e "${CONFFILE}" ]
then
	. ${CONFFILE} || true

	if [ -n "${TOMCAT7_USER}" ]; then
		db_set tomcat7/username "${TOMCAT7_USER}"
	fi

	if [ -n "${TOMCAT7_GROUP}" ]; then
		db_set tomcat7/groupname "${TOMCAT7_GROUP}"
	fi

	if [ -n "${JAVA_OPTS}" ]; then
		db_set tomcat7/javaopts "${JAVA_OPTS}"
	fi
fi

db_input low tomcat7/username || true
db_input low tomcat7/groupname || true
db_input low tomcat7/javaopts || true
db_go

db_stop
