#! /bin/sh
set -e

# A cut-down version of 'which' from debianutils.
searchpath () {
	PROGRAM="$1"
	IFS_SAVE="$IFS"
	IFS=:
	RET=1
	for ELEMENT in $PATH; do
		if [ -z "$ELEMENT" ]; then
			ELEMENT=.
		fi
		if [ -f "$ELEMENT/$PROGRAM" ] && \
		   [ -x "$ELEMENT/$PROGRAM" ]; then
			RET=0
			break
		fi
	done
	IFS="$IFS_SAVE"
	return "$RET"
}

if [ "$1" = configure ]; then
    for update in update-mozilla-chrome \
		  update-mozilla-snapshot-chrome \
		  update-mozilla-firefox-chrome \
		  update-iceape-chrome; do
	if searchpath "$update"; then
	    "$update"
	fi
    done
fi

#DEBHELPER#

exit 0
