diff options
-rw-r--r-- | .SRCINFO | 21 | ||||
-rw-r--r-- | PKGBUILD | 39 | ||||
-rwxr-xr-x | brscan4.install | 46 | ||||
-rwxr-xr-x | mk-udev-rules | 16 |
4 files changed, 122 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..a8feedb90ebe --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,21 @@ +pkgbase = brscan4 + pkgdesc = SANE drivers from Brother for brscan4 compatible models + pkgver = 0.4.3_0 + pkgrel = 5 + url = http://welcome.solutions.brother.com/bsc/public_s/id/linux/en/download_scn.html + install = brscan4.install + arch = i686 + arch = x86_64 + license = GPL + license = custom:Brother + depends = sane + depends = libusb-compat + source = http://download.brother.com/welcome/dlf006647/brscan4-0.4.3-0.i386.rpm + source = http://www.brother.com/agreement/English_sane/agree.html + source = mk-udev-rules + md5sums = d12d79fa08aaac5fdf5fdc85a5d380d2 + md5sums = ccffb9a6f6d436b21be25b0241068981 + md5sums = 9e0cf3931ce740494559f87644610c1b + +pkgname = brscan4 + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..6fe22fbfac15 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,39 @@ +# Maintainer: Harvey <harv@gmx.de> +license=('GPL' 'custom:Brother') +arch=('i686' 'x86_64') +pkgname=brscan4 +pkgver=0.4.3_0 +pkgrel=5 +pkgdesc="SANE drivers from Brother for brscan4 compatible models" +depends=('sane' 'libusb-compat') +url="http://welcome.solutions.brother.com/bsc/public_s/id/linux/en/download_scn.html" +install=brscan4.install + +[ "$CARCH" = "x86_64" ] && pkg="dlf006648/${pkgname}-${pkgver/_/-}.x86_64.rpm" || pkg="dlf006647/${pkgname}-${pkgver/_/-}.i386.rpm" +[ "$CARCH" = "x86_64" ] && pkg_md5sum="b15962f7694c1bd9cb7e2ec35c553480" || pkg_md5sum="d12d79fa08aaac5fdf5fdc85a5d380d2" + +source=("http://download.brother.com/welcome/$pkg" + "http://www.brother.com/agreement/English_sane/agree.html" + mk-udev-rules) +md5sums=($pkg_md5sum + 'ccffb9a6f6d436b21be25b0241068981' + '9e0cf3931ce740494559f87644610c1b') + +build() { + cd "$srcdir" + umask 022 + mkdir -p etc/udev/rules.d + ./mk-udev-rules opt/brother/scanner/brscan4/{Brsane4.ini,models4/*.ini} > etc/udev/rules.d/$pkgname.rules +} + +package() { + cp -r $srcdir/etc $pkgdir + cp -r $srcdir/opt $pkgdir + cp -r $srcdir/usr $pkgdir + install -D -m644 $srcdir/agree.html $pkgdir/usr/share/licenses/$pkgname/LICENSE.html + [ "$CARCH" = "x86_64" ] && mv $pkgdir/usr/lib64 $pkgdir/usr/lib + # move the links to the right direction + cd $pkgdir/usr/lib/sane + ln -sf libsane-brother4.so.1.0.7 $pkgdir/usr/lib/sane/libsane-brother4.so.1 + ln -sf libsane-brother4.so.1 $pkgdir/usr/lib/sane/libsane-brother4.so +} diff --git a/brscan4.install b/brscan4.install new file mode 100755 index 000000000000..3936d2a8df11 --- /dev/null +++ b/brscan4.install @@ -0,0 +1,46 @@ +# new package version +devices_file="/opt/brother/scanner/brscan4/brsanenetdevice4.cfg" + +pre_install() { + /bin/true +} + +# new package version +post_install() { + echo "Find additional documentation about scanner driver install at:" + echo "http://welcome.solutions.brother.com/bsc/public_s/id/linux/en/instruction_scn1.html" + echo "For a network installation run the following as root:" + echo "brsaneconfig4 -a name=\"Brother\" model=\"YOURMODELHERE\" ip=YOUR.SCANNER.IP.HERE" + /opt/brother/scanner/brscan4/setupSaneScan4 -i +} + +# the new package version +# old package version +pre_upgrade() { + # If user has already configured their scanner then make a config backup + if [ -f $devices_file ]; then + cp $devices_file $devices_file.backup || return 1 + fi +} + +# new package version +# old package version +post_upgrade() { + # After upgrade revert user's scanner config and delete a config backup + if [ -f $devices_file.backup ]; then + cp $devices_file.backup $devices_file || return 1 + rm $devices_file.backup || return 1 + fi +} + +# old package version +pre_remove() { + /opt/brother/scanner/brscan4/setupSaneScan4 -e + /bin/true +} + +# old package version +post_remove() { + /bin/true +} + diff --git a/mk-udev-rules b/mk-udev-rules new file mode 100755 index 000000000000..951ba28b9ad5 --- /dev/null +++ b/mk-udev-rules @@ -0,0 +1,16 @@ +#!/usr/bin/gawk -f +BEGIN { + FS = ","; + print "ACTION==\"add\", ATTR{idVendor}==\"04f9\", GOTO=\"brscan4\""; + print "GOTO=\"brscan4_end\""; + print "LABEL=\"brscan4\""; +} +NF >= 3 && $1 ~ /^ *0[xX][[:xdigit:]]+ *$/ { + id = "000" tolower( substr( $1, 3 )); + id = substr( id, length( id ) - 3 ); + print "ATTR{idProduct}==\"" id "\", MODE=\"0664\", GROUP=\"scanner\", ENV{libsane_matched}=\"yes\""; +} +END { + print "LABEL=\"brscan4_end\""; +} + |