#!/bin/sh
#
# debconf script for the Debian GNU/Linux ash package
#
# $Id: dash.config,v 1.1 2002/09/14 06:17:50 herbert Exp $

set -e

. /usr/share/debconf/confmodule

db_version 2.0

if [ "$1" = configure ] && [ -z "$2" ]; then
	set +e
	db_fget ash/sh seen
	err=$?
	set -e

	case $err in
	0)
		if [ "$RET" = true ]; then
			db_fset dash/sh seen true
			db_get ash/sh
			db_set dash/sh "$RET"
			exit
		fi
		;;
	10)
		# ash/sh does not exist
		;;
	*)
		echo "db_fget exited with $err" >&2
		exit $err
		;;
	esac
fi

# if "configuring and for the first time and bash is already installed"
if [ "$1" = configure ] && [ -z "$2" ] && dpkg-query -W bash >/dev/null; then
	# bash is pulling in dash
	db_input high dash/sh || true
else
	db_input low dash/sh || true
fi
db_go
