#!/bin/sh 

set -e

# Make sure only root can read the repository.
chmod 700 /var/lib/changetrack

# If there exists a default setting already, do not ask any questions.
DEFAULTFILE=/etc/default/changetrack
if [ -r $DEFAULTFILE ]; then
    exit 0
fi

# Source debconf library.
. /usr/share/debconf/confmodule

# The default arguments to changetrack is accumulated here.
DEFAULTS=""

# Ask questions using debconf.
db_go

# Use quiet mode when reporting changes?
db_get changetrack/quiet
if [ "$RET" = "true" ]; then
    DEFAULTS="-q"
fi

# Use unified diffs when reporting changes?
db_get changetrack/unified_diff
if [ "$RET" = "true" ]; then
    DEFAULTS="$DEFAULTS -u"
fi

cat > $DEFAULTFILE <<EOF
# Added by $0
PARAMS="$DEFAULTS"
EOF

#DEBHELPER#

exit 0
