updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / brother-mfc7440n / brother-mfc7440n.patch
blob2cff024306dd39e4271eb7dec42da5980e255f08
1 --- usr/local/Brother/cupswrapper/cupswrapperMFC7440N-2.0.2.orig 2010-08-13 20:13:16.009849388 -0700
2 +++ usr/local/Brother/cupswrapper/cupswrapperMFC7440N-2.0.2 2008-01-24 18:29:49.000000000 -0800
3 @@ -17,15 +17,23 @@
4 # this program; if not, write to the Free Software Foundation, Inc., 59 Temple
5 # Place, Suite 330, Boston, MA 02111-1307 USA
7 +if [ -z "$DRIVER_PREFIX" ]; then
8 + DRIVER_PREFIX=/usr/local/Brother
9 +fi
10 +MODEL=MFC7440N
12 +ppd_file_name=$DESTDIR/usr/share/cups/model/$MODEL.ppd
13 +brotherlpdwrapper=$DESTDIR/usr/lib/cups/filter/brlpdwrapper$MODEL
14 +brotherlpdwrapper64=$DESTDIR/usr/lib64/cups/filter/brlpdwrapper$MODEL
16 if [ "$1" = '-e' ]; then
17 - lpadmin -x MFC7440N
18 - rm -f /usr/share/cups/model/MFC7440N.ppd
19 - rm -f /usr/lib/cups/filter/brlpdwrapperMFC7440N
20 - rm -f /usr/lib64/cups/filter/brlpdwrapperMFC7440N
21 - rm -f /usr/local/Brother/cupswrapper/brcupsconfig3
22 - if [ -f /usr/share/ppd/MFC7440N.ppd ];then
23 - rm -f /usr/share/ppd/MFC7440N.ppd
24 + lpadmin -x $MODEL
25 + rm -f /usr/share/cups/model/$MODEL.ppd
26 + rm -f /usr/lib/cups/filter/brlpdwrapper$MODEL
27 + rm -f /usr/lib64/cups/filter/brlpdwrapper$MODEL
28 + rm -f ${DRIVER_PREFIX}/cupswrapper/brcupsconfig3
29 + if [ -f /usr/share/ppd/$MODEL.ppd ];then
30 + rm -f /usr/share/ppd/$MODEL.ppd
32 if [ -e /etc/init.d/cups ]; then
33 /etc/init.d/cups restart
34 @@ -36,7 +44,7 @@
35 exit 0
37 if [ "$1" = "-r" ]; then
38 - lpadmin -x MFC7440N
39 + lpadmin -x $MODEL
40 if [ -e /etc/init.d/cups ]; then
41 /etc/init.d/cups restart
43 @@ -50,23 +58,24 @@
44 echo ' -i : install'
45 echo ' -e : uninstall'
46 echo ' -r : remove printer'
47 + echo ' -s : simple install (Do not touch services)'
48 exit 0
50 -mkdir -p /usr/lib/cups/filter
52 -if [ -e "/usr/local/Brother/lpd/filterMFC7440N" ]; then
53 +mkdir -p $DESTDIR/usr/lib/cups/filter
54 +mkdir -p $DESTDIR/usr/share/cups/model
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/MFC7440N.ppd
62 -ppd_file_name=/usr/share/cups/model/MFC7440N.ppd
64 cat <<ENDOFPPDFILE >$ppd_file_name
65 *PPD-Adobe: "4.3"
66 *%================================================
67 *% Copyright(C) 2006 Brother Industries, Ltd.
68 -*% "Brother MFC7440N for CUPS"
69 +*% "Brother $MODEL for CUPS"
70 *%================================================
72 *%==== General Information Keywords ========================
73 @@ -75,16 +84,16 @@
74 *LanguageEncoding: ISOLatin1
75 *LanguageVersion: English
76 *Manufacturer: "Brother"
77 -*PCFileName: "MFC7440.PPD"
78 -*Product: "(Brother MFC7440N series)"
79 +*PCFileName: "$MODEL.PPD"
80 +*Product: "(Brother $MODEL series)"
81 *cupsVersion: 1.1
82 *cupsManualCopies: True
83 *cupsModelNumber: 68
84 -*cupsFilter: "application/vnd.cups-postscript 0 brlpdwrapperMFC7440N"
85 +*cupsFilter: "application/vnd.cups-postscript 0 brlpdwrapper$MODEL"
86 *PSVersion: "(3010.106) 3"
87 -*ModelName: "MFC7440N"
88 -*NickName: "Brother MFC7440N for CUPS"
89 -*ShortNickName: "Brother MFC7440N for CUPS"
90 +*ModelName: "$MODEL"
91 +*NickName: "Brother $MODEL for CUPS"
92 +*ShortNickName: "Brother $MODEL for CUPS"
94 *%==== Basic Device Capabilities =============
95 *LanguageLevel: "3"
96 @@ -335,14 +344,11 @@
97 ENDOFPPDFILE
99 chmod 755 $ppd_file_name
100 -if [ -e '/usr/share/ppd' ];then
101 +if [ -e "$DESTDIR/usr/share/ppd" ];then
102 cp $ppd_file_name /usr/share/ppd
105 -brotherlpdwrapper=/usr/lib/cups/filter/brlpdwrapperMFC7440N
106 -brotherlpdwrapper64=/usr/lib64/cups/filter/brlpdwrapperMFC7440N
107 -rm -f $brotherlpdwrapper
109 +rm -f $brotherlpdwrapper
111 cat <<!ENDOFWFILTER! >$brotherlpdwrapper
112 #! /bin/sh
113 @@ -387,11 +393,11 @@
114 LOGFILE=/tmp/br_cupsfilter_debug_log
117 -PRINTER=MFC7440N
118 +PRINTER=$MODEL
121 if [ "\$PPD" = "" ]; then
122 - PPD="/usr/share/cups/model/MFC7440N.ppd"
123 + PPD="/usr/share/cups/model/$MODEL.ppd"
127 @@ -473,25 +479,25 @@
131 -if [ -e "/usr/local/Brother/lpd/filter\$PRINTER" ]; then
132 +if [ -e "${DRIVER_PREFIX}/lpd/filter\$PRINTER" ]; then
134 else
135 - echo "ERROR: /usr/local/Brother/lpd/filter\$PRINTER does not exist" >>\$LOGFILE
136 + echo "ERROR: ${DRIVER_PREFIX}/lpd/filter\$PRINTER does not exist" >>\$LOGFILE
137 errorcode=30
138 exit $errorcode
141 -if [ -e "/usr/local/Brother/cupswrapper/brcupsconfig3" ]; then
142 +if [ -e "${DRIVER_PREFIX}/cupswrapper/brcupsconfig3" ]; then
143 if [ \$DEBUG = 0 ]; then
144 - /usr/local/Brother/cupswrapper/brcupsconfig3 \$PRINTER \$PPD 0 "\$options" >> /dev/null
145 + ${DRIVER_PREFIX}/cupswrapper/brcupsconfig3 \$PRINTER \$PPD 0 "\$options" >> /dev/null
146 else
147 - /usr/local/Brother/cupswrapper/brcupsconfig3 \$PRINTER \$PPD \$LOGCLEVEL "\$options" >>\$LOGFILE
148 + ${DRIVER_PREFIX}/cupswrapper/brcupsconfig3 \$PRINTER \$PPD \$LOGCLEVEL "\$options" >>\$LOGFILE
153 if [ \$DEBUG -le 2 ]; then
154 - cat \$INPUT_TEMP_PS | /usr/local/Brother/lpd/filter\$PRINTER
155 + cat \$INPUT_TEMP_PS | ${DRIVER_PREFIX}/lpd/filter\$PRINTER
158 if [ \$DEBUG -ge 2 ]; then
159 @@ -509,32 +515,34 @@
162 chmod 755 $brotherlpdwrapper
163 -if [ -e /usr/lib64/cups/filter ]; then
164 +if [ -e "$DESTDIR/usr/lib64/cups/filter" ]; then
165 cp $brotherlpdwrapper $brotherlpdwrapper64
168 -chmod a+w /usr/local/Brother/inf/brMFC7440Nrc
169 -chmod a+w /usr/local/Brother/inf
170 -if [ -e /etc/init.d/lpd ]; then
171 - /etc/init.d/lpd stop
173 -if [ -e /etc/init.d/lprng ]; then
174 - /etc/init.d/lprng stop
175 +chmod a+w $DESTDIR/${DRIVER_PREFIX}/inf/br${MODEL}rc
176 +chmod a+w $DESTDIR/${DRIVER_PREFIX}/inf
177 +if [ "$1" != "-s" ]; then
178 + if [ -e /etc/init.d/lpd ]; then
179 + /etc/init.d/lpd stop
180 + fi
181 + if [ -e /etc/init.d/lprng ]; then
182 + /etc/init.d/lprng stop
183 + fi
184 + if [ -e /etc/init.d/cups ]; then
185 + /etc/init.d/cups restart
186 + fi
187 + if [ -e /etc/init.d/cupsys ]; then
188 + /etc/init.d/cupsys restart
189 + fi
190 + sleep 2s
191 + port2=`lpinfo -v | grep -i 'usb://Brother/MFC-7440N' | head -1`
192 + if [ "$port2" = '' ];then
193 + port2=`lpinfo -v | grep 'usb://' | head -1`
194 + fi
195 + port=`echo $port2| sed s/direct//g`
196 + if [ "$port" = '' ];then
197 + port=usb:/dev/usb/lp0
198 + fi
199 + lpadmin -p $MODEL -E -v $port -P $ppd_file_name
201 - if [ -e /etc/init.d/cups ]; then
202 - /etc/init.d/cups restart
203 - fi
204 - if [ -e /etc/init.d/cupsys ]; then
205 - /etc/init.d/cupsys restart
206 - fi
207 -sleep 2s
208 -port2=`lpinfo -v | grep -i 'usb://Brother/MFC-7440N' | head -1`
209 -if [ "$port2" = '' ];then
210 - port2=`lpinfo -v | grep 'usb://' | head -1`
212 -port=`echo $port2| sed s/direct//g`
213 -if [ "$port" = '' ];then
214 - port=usb:/dev/usb/lp0
216 -lpadmin -p MFC7440N -E -v $port -P /usr/share/cups/model/MFC7440N.ppd
217 - exit 0
218 +exit 0