#!/bin/sh

set -e

. /usr/share/debconf/confmodule

case "$1" in
    configure*)
    db_get flashplugin-nonfree/local
    if [ -d "$RET" -a -f "$RET"/flash_linux.tar.gz ]; then
	LOCALFILE="-l $RET"
	INSTALL="true"
    fi
    if [ -z "$LOCALFILE" ]; then
	db_get flashplugin-nonfree/httpget
	if [ "$RET" = "true" ]; then
	    INSTALL=$RET
	    db_get flashplugin-nonfree/http_proxy
	    HTTP_PROXY=$RET
	fi
    fi
    db_get flashplugin-nonfree/delete
    if [ "$RET" = "true" ]; then
	DELETE="-d"
    fi
    
    if [ "$INSTALL" = "true" ]; then
	http_proxy=$HTTP_PROXY /usr/sbin/update-flashplugin $DELETE $LOCALFILE || true
    fi
    ;;
esac

#DEBHELPER#
