blob: a1ec8c06fe59bf72e1e078424463cb3d4f61bb07 (
plain)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
post_install() {
/opt/brother/Printers/DCP1510/inf/setupPrintcap DCP1510 -i USB
/opt/brother/Printers/DCP1510/inf/braddprinter -i DCP1510
if [ ! -e /usr/sbin/pstops ];then
PSTOPS=/usr/bin/pstops
if [ "`echo $PSTOPS | grep -i cups`" != "" ];then
PSTOPS=""
fi
if [ "$PSTOPS" != "" ];then
echo \[psconvert2\] >>/opt/brother/Printers/DCP1510/inf/brDCP1510func
echo pstops=$PSTOPS >>/opt/brother/Printers/DCP1510/inf/brDCP1510func
fi
fi
ln -s /opt/brother/Printers/DCP1510/inf/brDCP1510rc /etc/opt/brother/Printers/DCP1510/inf/brDCP1510rc
if [ ! -e /usr/bin/brprintconflsr3_DCP1510 ];then
echo "#! /bin/sh" > /usr/bin/brprintconflsr3_DCP1510
echo "/opt/brother/Printers/DCP1510/lpd/brprintconflsr3 -P DCP1510" '$''*' >>/usr/bin/brprintconflsr3_DCP1510
chmod 755 /usr/bin/brprintconflsr3_DCP1510
fi
if [ -e /usr/lib/cups/filter ] && [ ! -e /usr/lib/cups/filter/brother_lpdwrapper_DCP1510 ];then
ln -s /opt/brother/Printers/DCP1510/cupswrapper/brother_lpdwrapper_DCP1510 /usr/lib/cups/filter
fi
if [ -e /usr/lib32/cups/filter ] && [ ! -e /usr/lib32/cups/filter/brother_lpdwrapper_DCP1510 ];then
ln -s /opt/brother/Printers/DCP1510/cupswrapper/brother_lpdwrapper_DCP1510 /usr/lib32/cups/filter
fi
if [ -e /usr/lib64/cups/filter ] && [ ! -e /usr/lib64/cups/filter/brother_lpdwrapper_DCP1510 ];then
ln -s /opt/brother/Printers/DCP1510/cupswrapper/brother_lpdwrapper_DCP1510 /usr/lib64/cups/filter
fi
if [ -e /usr/libexec/cups/filter ] && [ ! -e /usr/libexec/cups/filter/brother_lpdwrapper_DCP1510 ];then
ln -s /opt/brother/Printers/DCP1510/cupswrapper/brother_lpdwrapper_DCP1510 /usr/libexec/cups/filter
fi
if [ -e /usr/share/cups/model ];then
ln -s /opt/brother/Printers/DCP1510/cupswrapper/brother-DCP1510-cups-en.ppd /usr/share/cups/model
PPDDIR=/usr/share/cups/model/
fi
if [ -e /usr/share/ppd ];then
if [ ! -e /usr/share/ppd/brother ];then
mkdir /usr/share/ppd/brother
fi
ln -s /opt/brother/Printers/DCP1510/cupswrapper/brother-DCP1510-cups-en.ppd /usr/share/ppd/brother
PPDDIR=/usr/share/ppd/brother/
fi
uris=$(lpinfo -v)
for uri in $uris
do
URI=$(echo $uri | grep DCP-1510 | grep usb)
if [ "$URI" != '' ];then
break;
fi
done
if [ "$URI" = '' ];then
for uri in $uris
do
URI=$(echo $uri | grep DCP-1510)
if [ "$URI" != '' ];then
break;
fi
done
fi
if [ "$URI" = '' ];then
for uri in $uris
do
URI=$(echo $uri | grep -i Brother | grep usb)
if [ "$URI" != '' ];then
break;
fi
done
fi
if [ "$URI" = '' ];then
for uri in $uris
do
URI=$(echo $uri | grep usb)
if [ "$URI" != '' ];then
break;
fi
done
fi
if [ "$URI" = '' ];then
URI="usb://dev/usb/lp0"
fi
if [ "$(which semanage 2> /dev/null)" != '' ];then
semanage fcontext -a -t cupsd_rw_etc_t '/etc/opt/brother/Printers/DCP1510/inf(/.*)?'
semanage fcontext -a -t cupsd_rw_etc_t '/opt/brother/Printers/DCP1510/inf(/.*)?'
semanage fcontext -a -t bin_t '/opt/brother/Printers/DCP1510/lpd(/.*)?'
semanage fcontext -a -t bin_t '/opt/brother/Printers/DCP1510/cupswrapper(/.*)?'
if [ "$(which restorecon 2> /dev/null)" != '' ];then
restorecon -R /opt/brother/Printers/DCP1510
restorecon -R /etc/opt/brother/Printers/DCP1510
fi
fi
echo "Start your cups service:"
echo ">>> systemctl start org.cups.cupsd"
echo "and add your printer in http://localhost:631/admin"
}
pre_remove() {
/opt/brother/Printers/DCP1510/inf/setupPrintcap DCP1510 -e USB
/opt/brother/Printers/DCP1510/inf/braddprinter -e DCP1510
rm -fR /var/spool/lpd/DCP1510/* 2>/dev/null
rm /etc/opt/brother/Printers/DCP1510/inf/brDCP1510rc 2>/dev/null
if [ -e /usr/bin/brprintconflsr3_DCP1510 ];then
rm /usr/bin/brprintconflsr3_DCP1510
fi
if [ -e /usr/lib/cups/filter/brother_lpdwrapper_DCP1510 ];then
rm /usr/lib/cups/filter/brother_lpdwrapper_DCP1510
fi
if [ -e /usr/lib32/cups/filter/brother_lpdwrapper_DCP1510 ];then
rm /usr/lib32/cups/filter/brother_lpdwrapper_DCP1510
fi
if [ -e /usr/lib64/cups/filter/brother_lpdwrapper_DCP1510 ];then
rm /usr/lib64/cups/filter/brother_lpdwrapper_DCP1510
fi
if [ -e /usr/libexec/cups/filter/brother_lpdwrapper_DCP1510 ];then
rm /usr/libexec/cups/filter/brother_lpdwrapper_DCP1510
fi
if [ -e /usr/share/ppd/brother/brother-DCP1510-cups-en.ppd ];then
rm /usr/share/ppd/brother/brother-DCP1510-cups-en.ppd
rmdir /usr/share/ppd/brother 2> /dev/null
fi
if [ -e /usr/share/cups/model/brother-DCP1510-cups-en.ppd ];then
rm /usr/share/cups/model/brother-DCP1510-cups-en.ppd
fi
}
post_remove() {
if [ "$(which semanage 2> /dev/null)" != '' ];then
semanage fcontext -d -t cupsd_rw_etc_t '/opt/brother/Printers/DCP1510/inf(/.*)?'
semanage fcontext -d -t cupsd_rw_etc_t '/etc/opt/brother/Printers/DCP1510/inf(/.*)?'
semanage fcontext -d -t bin_t '/opt/brother/Printers/DCP1510/lpd(/.*)?'
semanage fcontext -d -t bin_t '/opt/brother/Printers/DCP1510/cupswrapper(/.*)?'
if [ "$(which restorecon 2> /dev/null)" != '' ];then
restorecon -R /opt/brother/Printers/DCP1510
restorecon -R /etc/opt/brother/Printers/DCP1510
fi
fi
}
|