#!/bin/bash
# Debconf config script for airtime

set -e

. /usr/share/debconf/confmodule

db_input high airtime/apache-setup || true
db_go ||true

db_get airtime/apache-setup
if [ "$RET" = "dedicated v-host" ]; then
	db_input high airtime/apache-servername || true
	db_go ||true
	db_input high airtime/apache-serveradmin || true
	db_go ||true
	db_input high airtime/apache-deldefault || true
	db_go ||true
fi

db_input high airtime/icecast-setup || true
db_go ||true

db_get airtime/icecast-setup
if [ "$RET" = "true" ]; then
        db_input high airtime/icecast-hostname || true
        db_go ||true
	db_input high airtime/icecast-sourcepw || true
	db_go ||true
	db_input high airtime/icecast-relaypw || true
	db_go ||true
	db_input high airtime/icecast-adminpw || true
	db_go ||true
fi

# Only ask for storage directory and admin password on clean installs
if [ ! -e /var/log/airtime/pypo/pypo.log ]; then
	db_input high airtime/storage-directory || true
	db_go ||true
	db_input high airtime/admin-password || true
	db_go ||true
fi

#DEBHELPER#

exit 0