#
# This script will install the actual plugin, advise the user to read the
# license for Chrome and to re-login to have environment variables set
# properly.
#

BUILD_DIR="./var/tmp/${PKGNAME}.build"

case "${ACTION}" in
post)
	. usr/lib/chromium-pepper-flash/chromium-pepper-vars.sh

	mkdir -p "$BUILD_DIR"
	(
		cd "$BUILD_DIR"
		xbps-uhelper fetch "${CHROME_URL}>$PKGNAME.deb"
		echo "$CHROME_CHECKSUM  $PKGNAME.deb" > chksum
		sha256sum -c chksum || exit 1

		ar x "$PKGNAME.deb"
		tar xf data.tar.lzma
	) || {
		echo Error while extracting;
		rm -r $BUILD_DIR;
		exit 1;
	}
	mv $BUILD_DIR/opt/google/chrome/PepperFlash/libpepflashplayer.so "usr/lib/chromium-pepper-flash"
	mv $BUILD_DIR/opt/google/chrome/PepperFlash/manifest.json "usr/lib/chromium-pepper-flash"
	rm -r $BUILD_DIR
    cat << _EOF
=====================================================================

- The Pepper Adobe Flashplayer package is licensed software.

	You MUST read and agree to the license stored in
	/usr/share/licenses/chromium-pepper-flash/license.html
	before using it.

- Please re-login to update CHROME_FLAGS or re-source
  /etc/profile:

	$ source /etc/profile

=====================================================================
_EOF
    ;;
esac

