get_pw () { # Use Debconf to get a password get_pw__pwname=$1 get_pw__priority=$2 get_pw__ok='' while [ -z "$get_pw__ok" ] ; do db_input ${get_pw__priority} ${get_pw__pwname} || get_pw__retcode=$? || true db_input ${get_pw__priority} ${get_pw__pwname}_confirm || true db_go if [ "$get_pw__retcode" = 30 ] ; then get_pw__ok="not-asked" else db_get ${get_pw__pwname} || true get_pw__PW1=$RET db_get ${get_pw__pwname}_confirm || true get_pw__PW2=$RET if [ "$get_pw__PW1" = "$get_pw__PW2" ] ; then get_pw__ok="confirmed" else get_pw__ok="mismatch" db_fset ${get_pw__pwname} seen false db_fset ${get_pw__pwname}_confirm seen false fi fi done case $get_pw__ok in not-asked) echo "not-asked" ;; confirmed) echo "confirmed" ;; *) echo "SHOULDN'T HAVE HAPPENED" exit 1 ;; esac }