#!/usr/bin/make -f
# -*- makefile -*-

# Use bash and not the default sh
SHELL := /bin/bash

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This has to be exported to make some magic below work.
export DH_OPTIONS

source := $(shell dpkg-parsechangelog -S Source)

%:
	dh $@

override_dh_auto_clean:
	# Cleanup first
	mkdir -p usr/lib/firefox-esr/distribution/extensions
	rm -f usr/lib/firefox-esr/distribution/extensions/*
	wget -q -nc https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/ -O usr/lib/firefox-esr/distribution/extensions/uBlock0@raymondhill.net.xpi
	wget -q -nc https://addons.mozilla.org/firefox/downloads/latest/skip-redirect/ -O usr/lib/firefox-esr/distribution/extensions/skipredirect@sblask.xpi
	#wget -q -nc https://addons.mozilla.org/firefox/downloads/latest/https-everywhere/ -O usr/lib/firefox-esr/distribution/extensions/https-everywhere@eff.org.xpi
	#wget -q -nc https://addons.mozilla.org/firefox/downloads/latest/privacy-badger17/ -O usr/lib/firefox-esr/distribution/extensions/jid1-MnnxcxisBPnSXQ@jetpack.xpi
	#wget -q -nc https://addons.mozilla.org/firefox/downloads/latest/keepassxc-browser/ -O usr/lib/firefox-esr/distribution/keepassxc-browser@keepassxc.org

override_dh_builddeb:
	dh_builddeb
	# Cleanup build directory when done
	rm -rf ./debian/$(source)
