#!/bin/sh

set -e

. /usr/share/debconf/confmodule

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

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

	if [ -n "${TOMCAT8_USER}" ]; then
		db_set tomcat8/username "${TOMCAT8_USER}"
	fi

	if [ -n "${TOMCAT8_GROUP}" ]; then
		db_set tomcat8/groupname "${TOMCAT8_GROUP}"
	fi

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

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

db_stop
