-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-brscan4.sh
70 lines (56 loc) · 1.96 KB
/
install-brscan4.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
#
# Bash script for installing brscan4 for Brother scanners
#
install_temp=/tmp/brscan4
# Install required packages and dependencies
apk update && apk add --no-cache \
dpkg
# Download driver
curl -L https://download.brother.com/welcome/dlf006645/brscan4-0.4.10-1.amd64.deb -o /tmp/brscan4-0.4.10-1.amd64.deb
# Unpackage deb file
dpkg-deb -xv /tmp/brscan4-0.4.10-1.amd64.deb $install_temp
# Copy files from packages
cp -r $install_temp/usr/bin/* /usr/bin
cp -r $install_temp/usr/lib64/* /usr/lib
cp -r $install_temp/opt /
cp -r $install_temp/etc /
# Fix symlinks
cd /usr/lib/sane
ln -sf libsane-brother4.so.1.0.7 libsane-brother4.so.1
ln -sf libsane-brother4.so.1 libsane-brother4.so
# Enable brscan4 for SANE
/opt/brother/scanner/brscan4/setupSaneScan4 -i
# From driver udevconfig.sh - Add rules for Brother scanners
udevrulefile="/usr/lib/udev/rules.d/50-brother-brscan4-libsane-type1.rules"
cat << %%_UDEV_RULE_%% > $udevrulefile
#
# udev rules
#
ACTION!="add", GOTO="brother_mfp_end"
SUBSYSTEM=="usb", GOTO="brother_mfp_udev_1"
SUBSYSTEM!="usb_device", GOTO="brother_mfp_end"
LABEL="brother_mfp_udev_1"
SYSFS{idVendor}=="04f9", GOTO="brother_mfp_udev_2"
ATTRS{idVendor}=="04f9", GOTO="brother_mfp_udev_2"
GOTO="brother_mfp_end"
LABEL="brother_mfp_udev_2"
ATTRS{bInterfaceClass}!="0ff", GOTO="brother_mfp_end"
ATTRS{bInterfaceSubClass}!="0ff", GOTO="brother_mfp_end"
ATTRS{bInterfaceProtocol}!="0ff", GOTO="brother_mfp_end"
#MODE="0666"
#GROUP="scanner"
ENV{libsane_matched}="yes"
#SYMLINK+="scanner-%k"
LABEL="brother_mfp_end"
%%_UDEV_RULE_%%
####
chmod 755 $udevrulefile
# Cleanup
rm -rf /tmp/brscan4-0.4.10-1.amd64.deb /tmp/brscan4
cat << EOF
------------------------------------------------------------------------------------
Installed! You can run -> scanimage -L <- and your scanner should appear.
Also if you don't use dpkg you can uninstall it using " apk del dpkg ".
------------------------------------------------------------------------------------
EOF