case $MODE in
  configure)
    ARCH=${ARCH:-"$(dpkg --print-architecture)"}
    # force building an i386 environment on amd64 servers
    if [ "$ARCH" = "amd64" ]; then
	ARCH=i386

	if [ -z "$option_dist_value" ] ; then
	    option_dist_value=$(debian-edu-current-codename)
	    echo "info: Missing LTSP dist value, setting to $option_dist_value"
	fi

	# Make sure to inherit proxy setting from host, inspired by
	# ltsp-build-client/Debian/010-http-proxy in the ltsp-server
	# package.  See also bug #766460.
	if [ -z "$http_proxy" ]; then
	    eval $(apt-config shell http_proxy acquire::http::proxy)
	    [ "$http_proxy" = "false" ] && http_proxy=""
	    export http_proxy
	fi

	# Force network APT source for the netinst CD, as the i386
	# binaries are missing on the CD.
	if [ file:///media/cdrom = "$option_mirror_value" ] ; then
	    if grep -qi "^deb cdrom:.*i386" /etc/apt/sources.list; then
		echo "info: Found i386 binaries on amd64 CD/DVD.  Keeping LTSP mirror as '$MIRROR'"
	    else
		NEWMIRROR=$(awk '/^deb (http|ftp):\/\/.* main/ { if (!first) { print $2; first=1 } }' < /etc/apt/sources.list)
		echo "info: Changing LTSP mirror from '$option_mirror_value' to '$NEWMIRROR'"
		option_mirror_value=$NEWMIRROR
		if wget --timeout=30 --tries=3 -qO - http://ftp.skolelinux.org/skolelinux/dists/$option_dist_value/Release | grep -q " local/binary" ; then 
		    option_extra_mirror_value="http://ftp.skolelinux.org/skolelinux/ $option_dist_value local"
		    echo "info: Added LTSP extra mirror '$option_extra_mirror_value'"
		fi
		NEWCOMPONENTS=$(echo $option_components_value | sed -r -e 's/(,local|local,)//')
		echo "info: Removing 'local' from components for other mirrors"
		option_components_value=$NEWCOMPONENTS
		echo "info: Adding Debian-Edu Archive key to apt-keys"
		option_apt_keys_value="$option_apt_keys_value,/usr/share/keyrings/debian-edu-archive-keyring.gpg"
		if [ high = "$http_proxy" ]; then
		    unset http_proxy
		    echo "info: http_proxy was set to high, this seems to be a debconf bug, remove it"
		fi
	    fi
	fi
    fi
  ;;
esac
