updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / brother-hl2140 / 0001-brother-hl2140.patch
blobf2c0aca5aae2d7b2355f11b258dfb00a1e62b7b6
1 diff -Naur old/usr/local/Brother/cupswrapper/cupswrapperHL2140-2.0.2 new/usr/local/Brother/cupswrapper/cupswrapperHL2140-2.0.2
2 --- old/usr/local/Brother/cupswrapper/cupswrapperHL2140-2.0.2 2008-01-24 21:29:45.000000000 -0500
3 +++ new/usr/local/Brother/cupswrapper/cupswrapperHL2140-2.0.2 2010-01-19 17:11:34.000000000 -0500
4 @@ -17,15 +17,23 @@
5 # this program; if not, write to the Free Software Foundation, Inc., 59 Temple
6 # Place, Suite 330, Boston, MA 02111-1307 USA
8 +if [ -z "$DRIVER_PREFIX" ]; then
9 + DRIVER_PREFIX=/usr/local/Brother
10 +fi
11 +MODEL=HL2140
13 +ppd_file_name=$DESTDIR/usr/share/cups/model/$MODEL.ppd
14 +brotherlpdwrapper=$DESTDIR/usr/lib/cups/filter/brlpdwrapper$MODEL
15 +brotherlpdwrapper64=$DESTDIR/usr/lib64/cups/filter/brlpdwrapper$MODEL
17 if [ "$1" = '-e' ]; then
18 - lpadmin -x HL2140
19 - rm -f /usr/share/cups/model/HL2140.ppd
20 - rm -f /usr/lib/cups/filter/brlpdwrapperHL2140
21 - rm -f /usr/lib64/cups/filter/brlpdwrapperHL2140
22 - rm -f /usr/local/Brother/cupswrapper/brcupsconfig3
23 - if [ -f /usr/share/ppd/HL2140.ppd ];then
24 - rm -f /usr/share/ppd/HL2140.ppd
25 + lpadmin -x $MODEL
26 + rm -f /usr/share/cups/model/$MODEL.ppd
27 + rm -f /usr/lib/cups/filter/brlpdwrapper$MODEL
28 + rm -f /usr/lib64/cups/filter/brlpdwrapper$MODEL
29 + rm -f ${DRIVER_PREFIX}/cupswrapper/brcupsconfig3
30 + if [ -f /usr/share/ppd/$MODEL.ppd ];then
31 + rm -f /usr/share/ppd/$MODEL.ppd
33 if [ -e /etc/init.d/cups ]; then
34 /etc/init.d/cups restart
35 @@ -36,7 +44,7 @@
36 exit 0
38 if [ "$1" = "-r" ]; then
39 - lpadmin -x HL2140
40 + lpadmin -x $MODEL
41 if [ -e /etc/init.d/cups ]; then
42 /etc/init.d/cups restart
44 @@ -50,23 +58,24 @@
45 echo ' -i : install'
46 echo ' -e : uninstall'
47 echo ' -r : remove printer'
48 + echo ' -s : simple install (Do not touch services)'
49 exit 0
51 -mkdir -p /usr/lib/cups/filter
53 -if [ -e "/usr/local/Brother/lpd/filterHL2140" ]; then
54 +mkdir -p $DESTDIR/usr/lib/cups/filter
55 +mkdir -p $DESTDIR/usr/share/cups/model
57 +if [ -e "${DESTDIR}/${DRIVER_PREFIX}/lpd/filter$MODEL" ]; then
59 else
60 echo "ERROR : Brother LPD filter is not installed."
62 -rm -f /usr/share/cups/model/HL2140.ppd
63 -ppd_file_name=/usr/share/cups/model/HL2140.ppd
65 cat <<ENDOFPPDFILE >$ppd_file_name
66 *PPD-Adobe: "4.3"
67 *%================================================
68 *% Copyright(C) 2006 Brother Industries, Ltd.
69 -*% "Brother HL2140 for CUPS"
70 +*% "Brother $MODEL for CUPS"
71 *%================================================
73 *%==== General Information Keywords ========================
74 @@ -75,16 +84,16 @@
75 *LanguageEncoding: ISOLatin1
76 *LanguageVersion: English
77 *Manufacturer: "Brother"
78 -*PCFileName: "HL2140.PPD"
79 -*Product: "(Brother HL2140 series)"
80 +*PCFileName: "$MODEL.PPD"
81 +*Product: "(Brother $MODEL series)"
82 *cupsVersion: 1.1
83 *cupsManualCopies: True
84 *cupsModelNumber: 68
85 -*cupsFilter: "application/vnd.cups-postscript 0 brlpdwrapperHL2140"
86 +*cupsFilter: "application/vnd.cups-postscript 0 brlpdwrapper$MODEL"
87 *PSVersion: "(3010.106) 3"
88 -*ModelName: "HL2140"
89 -*NickName: "Brother HL2140 for CUPS"
90 -*ShortNickName: "Brother HL2140 for CUPS"
91 +*ModelName: "$MODEL"
92 +*NickName: "Brother $MODEL for CUPS"
93 +*ShortNickName: "Brother $MODEL for CUPS"
95 *%==== Basic Device Capabilities =============
96 *LanguageLevel: "3"
97 @@ -335,14 +344,11 @@
98 ENDOFPPDFILE
100 chmod 755 $ppd_file_name
101 -if [ -e '/usr/share/ppd' ];then
102 +if [ -e "$DESTDIR/usr/share/ppd" ];then
103 cp $ppd_file_name /usr/share/ppd
106 -brotherlpdwrapper=/usr/lib/cups/filter/brlpdwrapperHL2140
107 -brotherlpdwrapper64=/usr/lib64/cups/filter/brlpdwrapperHL2140
108 -rm -f $brotherlpdwrapper
110 +rm -f $brotherlpdwrapper
112 cat <<!ENDOFWFILTER! >$brotherlpdwrapper
113 #! /bin/sh
114 @@ -387,11 +393,11 @@
115 LOGFILE=/tmp/br_cupsfilter_debug_log
118 -PRINTER=HL2140
119 +PRINTER=$MODEL
122 if [ "\$PPD" = "" ]; then
123 - PPD="/usr/share/cups/model/HL2140.ppd"
124 + PPD="/usr/share/cups/model/$MODEL.ppd"
128 @@ -473,25 +479,25 @@
132 -if [ -e "/usr/local/Brother/lpd/filter\$PRINTER" ]; then
133 +if [ -e "${DRIVER_PREFIX}/lpd/filter\$PRINTER" ]; then
135 else
136 - echo "ERROR: /usr/local/Brother/lpd/filter\$PRINTER does not exist" >>\$LOGFILE
137 + echo "ERROR: ${DRIVER_PREFIX}/lpd/filter\$PRINTER does not exist" >>\$LOGFILE
138 errorcode=30
139 exit $errorcode
142 -if [ -e "/usr/local/Brother/cupswrapper/brcupsconfig3" ]; then
143 +if [ -e "${DRIVER_PREFIX}/cupswrapper/brcupsconfig3" ]; then
144 if [ \$DEBUG = 0 ]; then
145 - /usr/local/Brother/cupswrapper/brcupsconfig3 \$PRINTER \$PPD 0 "\$options" >> /dev/null
146 + ${DRIVER_PREFIX}/cupswrapper/brcupsconfig3 \$PRINTER \$PPD 0 "\$options" >> /dev/null
147 else
148 - /usr/local/Brother/cupswrapper/brcupsconfig3 \$PRINTER \$PPD \$LOGCLEVEL "\$options" >>\$LOGFILE
149 + ${DRIVER_PREFIX}/cupswrapper/brcupsconfig3 \$PRINTER \$PPD \$LOGCLEVEL "\$options" >>\$LOGFILE
154 if [ \$DEBUG -le 2 ]; then
155 - cat \$INPUT_TEMP_PS | /usr/local/Brother/lpd/filter\$PRINTER
156 + cat \$INPUT_TEMP_PS | ${DRIVER_PREFIX}/lpd/filter\$PRINTER
159 if [ \$DEBUG -ge 2 ]; then
160 @@ -509,32 +515,35 @@
163 chmod 755 $brotherlpdwrapper
164 -if [ -e /usr/lib64/cups/filter ]; then
165 +if [ -e "$DESTDIR/usr/lib64/cups/filter" ]; then
166 cp $brotherlpdwrapper $brotherlpdwrapper64
169 -chmod a+w /usr/local/Brother/inf/brHL2140rc
170 -chmod a+w /usr/local/Brother/inf
171 -if [ -e /etc/init.d/lpd ]; then
172 - /etc/init.d/lpd stop
174 -if [ -e /etc/init.d/lprng ]; then
175 - /etc/init.d/lprng stop
177 - if [ -e /etc/init.d/cups ]; then
178 - /etc/init.d/cups restart
179 - fi
180 - if [ -e /etc/init.d/cupsys ]; then
181 - /etc/init.d/cupsys restart
182 - fi
183 -sleep 2s
184 -port2=`lpinfo -v | grep -i 'usb://Brother/HL-2140' | head -1`
185 -if [ "$port2" = '' ];then
186 - port2=`lpinfo -v | grep 'usb://' | head -1`
188 -port=`echo $port2| sed s/direct//g`
189 -if [ "$port" = '' ];then
190 - port=usb:/dev/usb/lp0
191 +chmod a+w $DESTDIR/${DRIVER_PREFIX}/inf/br${MODEL}rc
192 +chmod a+w $DESTDIR/${DRIVER_PREFIX}/inf
193 +if [ "$1" != "-s" ]; then
194 + if [ -e /etc/init.d/lpd ]; then
195 + /etc/init.d/lpd stop
196 + fi
197 + if [ -e /etc/init.d/lprng ]; then
198 + /etc/init.d/lprng stop
199 + fi
200 + if [ -e /etc/init.d/cups ]; then
201 + /etc/init.d/cups restart
202 + fi
203 + if [ -e /etc/init.d/cupsys ]; then
204 + /etc/init.d/cupsys restart
205 + fi
206 + sleep 2s
207 + port2=`lpinfo -v | grep -i 'usb://Brother/HL-2140' | head -1`
208 + if [ "$port2" = '' ];then
209 + port2=`lpinfo -v | grep 'usb://' | head -1`
210 + fi
211 + port=`echo $port2| sed s/direct//g`
212 + if [ "$port" = '' ];then
213 + port=usb:/dev/usb/lp0
214 + fi
215 + lpadmin -p $MODEL -E -v $port -P $ppd_file_name
217 -lpadmin -p HL2140 -E -v $port -P /usr/share/cups/model/HL2140.ppd
218 - exit 0
220 +exit 0
221 diff -Naur old/usr/local/Brother/inf/brHL2140rc new/usr/local/Brother/inf/brHL2140rc
222 --- old/usr/local/Brother/inf/brHL2140rc 2008-01-24 21:29:34.000000000 -0500
223 +++ new/usr/local/Brother/inf/brHL2140rc 2010-01-19 17:11:55.000000000 -0500
224 @@ -4,7 +4,7 @@
225 PaperSource=Tray1
226 Duplex=OFF
227 DuplexType=Long
228 -PaperType=A4
229 +PaperType=Letter
230 Media=PlainPaper
231 Copies=1
232 Sleep=PrinterDefault