# Template file for 'imagescan-plugin-networkscan'
pkgname=imagescan-plugin-networkscan
version=1.1.1
revision=1
only_for_archs="i686 x86_64"
_bversion=1.3.26
_dst=ubuntu
_rel=17.10
build_style=fetch
depends="imagescan"
short_desc="Image Scan v3 Plugin for using Epson scanners over network"
maintainer="Giuseppe Fierro <gspe@ae-design.ws>"
license="Proprietary"
homepage="http://support.epson.net/linux/en/imagescanv3.php?version=${_bversion}"

case "${XBPS_TARGET_MACHINE}" in
	x86_64)
		_type=x64
		_arch=amd64
		_hash=ca0908b320a891b99059d0b8a36204fee6ce7e5a1b9cc9d0984ecde0a830ade5
		;;
	i686)
		_type=x86
		_arch=i386
		_hash=19d33cb489528c1b226e211e99a4958b05ea9a02a08c1e8a6303367dba33a097
		;;
esac

distfiles="https://download2.ebz.epson.net/imagescanv3/ubuntu/latest1/deb/${_type}/imagescan-bundle-${_dst}-${_rel}-${_bversion}.${_type}.deb.tar.gz"
checksum=${_hash}

do_extract() {
	tar xzf ${XBPS_SRCDISTDIR}/${pkgname}-${version}/imagescan-bundle-${_dst}-${_rel}-${_bversion}.${_type}.deb.tar.gz \
		imagescan-bundle-${_dst}-${_rel}-${_bversion}.${_type}.deb/plugins/${pkgname}_${version}-1epson4${_dst}${_rel}_${_arch}.deb
	ar x imagescan-bundle-${_dst}-${_rel}-${_bversion}.${_type}.deb/plugins/${pkgname}_${version}-1epson4${_dst}${_rel}_${_arch}.deb data.tar.xz
	tar xf data.tar.xz
}

do_install() {
	vlicense usr/share/doc/imagescan-plugin-networkscan/AVASYSPL.ja.txt
	vlicense usr/share/doc/imagescan-plugin-networkscan/AVASYSPL.en.txt

	rm usr/share/doc/imagescan-plugin-networkscan/AVASYSPL.ja.txt
	rm usr/share/doc/imagescan-plugin-networkscan/AVASYSPL.en.txt

	vcopy usr /
}
