#!/bin/sh
set -e

. /usr/share/debconf/confmodule

CONFIGFILE=/etc/default/xfstt

if [ "$1" = configure ]; then
	db_get xfstt/listen_tcp || true

	case "$RET" in
	true)	RET=yes
		;;
	false)	RET=no
		;;
	esac

	if [ -e $CONFIGFILE ]; then
		sed -e "s/^ *LISTEN_TCP=.*/LISTEN_TCP=\"$RET\"/" \
			< $CONFIGFILE > $CONFIGFILE.tmp
		mv -f $CONFIGFILE.tmp $CONFIGFILE
	else
		(
		echo "# Defaults for xfstt init.d script"
		echo "#"
		echo "# Valid values are: yes no"
		echo "LISTEN_TCP=\"$RET\""
		) > $CONFIGFILE
	fi
fi

#DEBHELPER#

db_stop

exit 0
