#!/bin/sh -e
. /usr/share/debconf/confmodule
db_version 2.0

# This conf script is capable of backing up
db_capb backup

db_title inadyn

STATE=1
while [ "$STATE" != 0 -a "$STATE" != 7 ]; do
    case "$STATE" in
	1)
	    db_input critical inadyn/wizard || true
	    ;;

	2)
	    db_get inadyn/wizard
	    if [ "$RET" = "false" ]; then
		# User maintains their own inadyn.conf
		exit 0
	    fi
	    ;;

	3)
	    db_input critical inadyn/provider || true
	    ;;

	4)
	    db_input critical inadyn/username || true
	    ;;

	5)
	    db_input critical inadyn/password || true
	    ;;

	6)
	    db_input critical inadyn/hostname || true
	    ;;
    esac

    if db_go; then
	STATE=$(($STATE + 1))
    else
	STATE=$(($STATE - 1))
    fi
done
