#!/usr/bin/env bash
# https://www.openprinting.org/driver/epson-201106w/
UPSTREAM_DRIVER_VERSION=1.0.1-1lsb3.2
DRIVER_VERSION=1.0.1-1
RELEASE="stable"
DEPENDS=""

apt install -y lsb-release escputil mtink 



wget -c --directory-prefix /var/tmp http://download.ebz.epson.net/dsc/op/${RELEASE}/debian/dists/lsb3.2/main/binary-amd64/epson-inkjet-printer-201106w_${UPSTREAM_DRIVER_VERSION}_amd64.deb

pushd /var/tmp/
	dpkg-deb -R epson-inkjet-printer-201106w_${UPSTREAM_DRIVER_VERSION}_amd64.deb epson-inkjet-printer-201106w_${DRIVER_VERSION}_amd64
	pushd epson-inkjet-printer-201106w_${DRIVER_VERSION}_amd64
		sed -i 's,^\(Version: \).*,\1'${DRIVER_VERSION}',' DEBIAN/control
		sed -i 's,^\(Depends: \).*,\1'${DEPENDS}',' DEBIAN/control
	popd
	dpkg-deb -b epson-inkjet-printer-201106w_${DRIVER_VERSION}_amd64 epson-inkjet-printer-201106w_${DRIVER_VERSION}_amd64.deb

	dpkg -i epson-inkjet-printer-201106w_${DRIVER_VERSION}_amd64.deb
popd


apt -f install
