summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjc_gargma <jc_gargma@iserlohn-fortress.net>2019-10-17 13:42:15 -0700
committerjc_gargma <jc_gargma@iserlohn-fortress.net>2019-10-17 13:42:15 -0700
commitd9a946cb4a109c3735b109ad36c0ed595edac303 (patch)
tree5c6ee01b80fa52d53997a91e2c72f3d873c2b1b7
downloadbrscan4-d9a946cb4a109c3735b109ad36c0ed595edac303.tar.xz
Initial commitHEADmaster
-rw-r--r--PKGBUILD51
-rwxr-xr-xbrscan4.install46
-rwxr-xr-xmk-udev-rules17
3 files changed, 114 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 0000000..68ed68e
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,51 @@
+# Maintainer: jc_gargma <jc_gargma@iserlohn-fortress.net>
+# Maintainer (AUR): Harvey <harv@gmx.de>
+
+# # I maintain this because:
+# I use it and it is not in an official repo
+# AUR version uses md5sum and cluttered if clause
+
+license=('GPL' 'custom:Brother')
+arch=('i686' 'x86_64')
+pkgname=brscan4
+pkgver=0.4.8_1
+pkgrel=1
+pkgdesc="SANE drivers from Brother for brscan4 compatible models"
+depends=('sane' 'libusb-compat')
+group=('non-free')
+url="http://support.brother.com"
+install=brscan4.install
+
+ if [ "$CARCH" == "x86_64" ]; then
+ pkg="dlf006648/${pkgname}-${pkgver/_/-}.x86_64.rpm"
+ pkg_sha256sum="cd61be4fab254cc7c8cfcc82c19ddf2ef1fe91bfce493be62b5946f191bbcdad"
+ else
+ pkg="dlf006647/${pkgname}-${pkgver/_/-}.i386.rpm"
+ pkg_sha256sum="ff0254519a9b421e1d493fbcffefb992d6689b105e48ba1dd561cf48832cb72a"
+ fi
+
+source=("https://download.brother.com/welcome/$pkg"
+ "http://www.brother.com/agreement/English_sane/agree.html"
+ mk-udev-rules)
+sha256sums=($pkg_sha256sum
+ '3434bca1936d6a5fd6afd810cde7e1876dd4d1496722b09af180278480f464f2'
+ '2ca808c50a255e90902cfb6622964dc71c863cc085763fd918e5a795450bb73f')
+
+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/40-$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 0000000..3936d2a
--- /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 0000000..8f00b79
--- /dev/null
+++ b/mk-udev-rules
@@ -0,0 +1,17 @@
+#!/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\"";
+ print "ATTR{idProduct}==\"" id "\", MODE=\"0664\", GROUP=\"lp\", ENV{libsane_matched}=\"yes\"";
+}
+END {
+ print "LABEL=\"brscan4_end\"";
+}
+