#!/bin/sh

set -e

# XXX Note when updating to also update
# debian/flashplugin-installer.postinst and debian/post-download-hook
FLASH_VERSION=20161213.1
FILENAME=adobe-flashplugin_${FLASH_VERSION}.orig.tar.gz
SHA256SUM_TGZ="abf0dad1f238ef95a3404c49b3c1047d42e022b6402df36e438d18f475f711cf"

. /usr/share/debconf/confmodule

while true; do
	db_input medium flashplugin-installer/local || true
	db_go
	db_get flashplugin-installer/local
	if [ -n "$RET" ] && [ -d "$RET" ] && [ -f "$RET/$FILENAME" ] \
	   && echo "$SHA256SUM_TGZ  $RET/$FILENAME" | sha256sum -c > /dev/null 2>&1
	then
		break
	elif [ "x$RET" = "x" ]; then
		break
	fi
	db_reset flashplugin-installer/not_exist || true
	db_reset flashplugin-installer/local || true
	db_input medium flashplugin-installer/not_exist || true
	db_go
done
