updated on Sun Jan 22 08:00:21 UTC 2012
[aur-mirror.git] / brother-hl2150n / brother-hl2150n.patch
blobcd30672d9536ac7369af9328785deee295bc79c2
1 diff -Naur a/local/Brother/cupswrapper/cupswrapperHL2150N-2.0.2 b/local/Brother/cupswrapper/cupswrapperHL2150N-2.0.2
2 --- a/local/Brother/cupswrapper/cupswrapperHL2150N-2.0.2 2008-01-25 03:29:45.000000000 +0100
3 +++ b/local/Brother/cupswrapper/cupswrapperHL2150N-2.0.2 2009-08-12 16:56:46.849337866 +0200
4 @@ -18,14 +18,23 @@
5 # Place, Suite 330, Boston, MA 02111-1307 USA
8 +if [ -z "$DRIVER_PREFIX" ]; then
9 + DRIVER_PREFIX=/usr/local/Brother
10 +fi
11 +MODEL=HL2150N
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 HL2150N
19 - rm -f /usr/share/cups/model/HL2150N.ppd
20 - rm -f /usr/lib/cups/filter/brlpdwrapperHL2150N
21 - rm -f /usr/lib64/cups/filter/brlpdwrapperHL2150N
22 - rm -f /usr/local/Brother/cupswrapper/brcupsconfig3
23 - if [ -f /usr/share/ppd/HL2150N.ppd ];then
24 - rm -f /usr/share/ppd/HL2150N.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 +45,7 @@
36 exit 0
38 if [ "$1" = "-r" ]; then
39 - lpadmin -x HL2150N
40 + lpadmin -x ${MODEL}
41 if [ -e /etc/init.d/cups ]; then
42 /etc/init.d/cups restart
44 @@ -50,23 +59,23 @@
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
52 +mkdir -p $DESTDIR/usr/lib/cups/filter
53 +mkdir -p $DESTDIR/usr/share/cups/model
55 -if [ -e "/usr/local/Brother/lpd/filterHL2150N" ]; then
56 +if [ -e "${DESTDIR}/${DRIVER_PREFIX}/lpd/filter${MODEL}" ]; then
58 else
59 echo "ERROR : Brother LPD filter is not installed."
61 -rm -f /usr/share/cups/model/HL2150N.ppd
62 -ppd_file_name=/usr/share/cups/model/HL2150N.ppd
64 cat <<ENDOFPPDFILE >$ppd_file_name
65 *PPD-Adobe: "4.3"
66 *%================================================
67 *% Copyright(C) 2006 Brother Industries, Ltd.
68 -*% "Brother HL2150N for CUPS"
69 +*% "Brother ${MODEL} for CUPS"
70 *%================================================
72 *%==== General Information Keywords ========================
73 @@ -76,15 +85,15 @@
74 *LanguageVersion: English
75 *Manufacturer: "Brother"
76 *PCFileName: "HL2150.PPD"
77 -*Product: "(Brother HL2150N series)"
78 +*Product: "(Brother ${MODEL} series)"
79 *cupsVersion: 1.1
80 *cupsManualCopies: True
81 *cupsModelNumber: 68
82 -*cupsFilter: "application/vnd.cups-postscript 0 brlpdwrapperHL2150N"
83 +*cupsFilter: "application/vnd.cups-postscript 0 brlpdwrapper${MODEL}"
84 *PSVersion: "(3010.106) 3"
85 -*ModelName: "HL2150N"
86 -*NickName: "Brother HL2150N for CUPS"
87 -*ShortNickName: "Brother HL2150N for CUPS"
88 +*ModelName: "${MODEL}"
89 +*NickName: "Brother ${MODEL} for CUPS"
90 +*ShortNickName: "Brother ${MODEL} for CUPS"
92 *%==== Basic Device Capabilities =============
93 *LanguageLevel: "3"
94 @@ -335,13 +344,11 @@
95 ENDOFPPDFILE
97 chmod 755 $ppd_file_name
98 -if [ -e '/usr/share/ppd' ];then
99 - cp $ppd_file_name /usr/share/ppd
100 +if [ -e "$DESTDIR/usr/share/ppd" ];then
101 + cp $ppd_file_name $DESTDIR/usr/share/ppd
104 -brotherlpdwrapper=/usr/lib/cups/filter/brlpdwrapperHL2150N
105 -brotherlpdwrapper64=/usr/lib64/cups/filter/brlpdwrapperHL2150N
106 -rm -f $brotherlpdwrapper
107 +rm -f $brotherlpdwrapper
110 cat <<!ENDOFWFILTER! >$brotherlpdwrapper
111 @@ -387,11 +394,11 @@
112 LOGFILE=/tmp/br_cupsfilter_debug_log
115 -PRINTER=HL2150N
116 +PRINTER=${MODEL}
119 if [ "\$PPD" = "" ]; then
120 - PPD="/usr/share/cups/model/HL2150N.ppd"
121 + PPD="/usr/share/cups/model/${MODEL}.ppd"
125 @@ -473,25 +480,25 @@
129 -if [ -e "/usr/local/Brother/lpd/filter\$PRINTER" ]; then
130 +if [ -e "${DRIVER_PREFIX}/lpd/filter\$PRINTER" ]; then
132 else
133 - echo "ERROR: /usr/local/Brother/lpd/filter\$PRINTER does not exist" >>\$LOGFILE
134 + echo "ERROR: ${DRIVER_PREFIX}/lpd/filter\$PRINTER does not exist" >>\$LOGFILE
135 errorcode=30
136 exit $errorcode
139 -if [ -e "/usr/local/Brother/cupswrapper/brcupsconfig3" ]; then
140 +if [ -e "${DRIVER_PREFIX}/cupswrapper/brcupsconfig3" ]; then
141 if [ \$DEBUG = 0 ]; then
142 - /usr/local/Brother/cupswrapper/brcupsconfig3 \$PRINTER \$PPD 0 "\$options" >> /dev/null
143 + ${DRIVER_PREFIX}/cupswrapper/brcupsconfig3 \$PRINTER \$PPD 0 "\$options" >> /dev/null
144 else
145 - /usr/local/Brother/cupswrapper/brcupsconfig3 \$PRINTER \$PPD \$LOGCLEVEL "\$options" >>\$LOGFILE
146 + ${DRIVER_PREFIX}/cupswrapper/brcupsconfig3 \$PRINTER \$PPD \$LOGCLEVEL "\$options" >>\$LOGFILE
151 if [ \$DEBUG -le 2 ]; then
152 - cat \$INPUT_TEMP_PS | /usr/local/Brother/lpd/filter\$PRINTER
153 + cat \$INPUT_TEMP_PS | ${DRIVER_PREFIX}/lpd/filter\$PRINTER
156 if [ \$DEBUG -ge 2 ]; then
157 @@ -509,32 +516,34 @@
160 chmod 755 $brotherlpdwrapper
161 -if [ -e /usr/lib64/cups/filter ]; then
162 +if [ -e "$DESTDIR/usr/lib64/cups/filter" ]; then
163 cp $brotherlpdwrapper $brotherlpdwrapper64
166 -chmod a+w /usr/local/Brother/inf/brHL2150Nrc
167 -chmod a+w /usr/local/Brother/inf
168 -if [ -e /etc/init.d/lpd ]; then
169 - /etc/init.d/lpd stop
171 -if [ -e /etc/init.d/lprng ]; then
172 - /etc/init.d/lprng stop
174 - if [ -e /etc/init.d/cups ]; then
175 - /etc/init.d/cups restart
176 - fi
177 - if [ -e /etc/init.d/cupsys ]; then
178 - /etc/init.d/cupsys restart
179 - fi
180 -sleep 2s
181 -port2=`lpinfo -v | grep -i 'usb://Brother/HL-2150N' | head -1`
182 -if [ "$port2" = '' ];then
183 - port2=`lpinfo -v | grep 'usb://' | head -1`
185 -port=`echo $port2| sed s/direct//g`
186 -if [ "$port" = '' ];then
187 - port=usb:/dev/usb/lp0
188 +chmod a+w $DESTDIR/${DRIVER_PREFIX}/inf/br${MODEL}rc
189 +chmod a+w $DESTDIR/${DRIVER_PREFIX}/inf
190 +if [ "$1" != "-s" ]; then
191 + if [ -e /etc/init.d/lpd ]; then
192 + /etc/init.d/lpd stop
193 + fi
194 + if [ -e /etc/init.d/lprng ]; then
195 + /etc/init.d/lprng stop
196 + fi
197 + if [ -e /etc/init.d/cups ]; then
198 + /etc/init.d/cups restart
199 + fi
200 + if [ -e /etc/init.d/cupsys ]; then
201 + /etc/init.d/cupsys restart
202 + fi
203 + sleep 2s
204 + port2=`lpinfo -v | grep -i 'usb://Brother/HL-2140' | head -1`
205 + if [ "$port2" = '' ];then
206 + port2=`lpinfo -v | grep 'usb://' | head -1`
207 + fi
208 + port=`echo $port2| sed s/direct//g`
209 + if [ "$port" = '' ];then
210 + port=usb:/dev/usb/lp0
211 + fi
212 + lpadmin -p ${MODEL} -E -v $port -P $ppd_file_name
214 -lpadmin -p HL2150N -E -v $port -P /usr/share/cups/model/HL2150N.ppd
215 - exit 0
216 +exit 0