updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / brother-hl4150cdn / 0001-brother-hl4150cdn.patch
blob1a2f4bfe8af97b62f7b1b488b597a566ca40c2df
1 --- src/usr/local/Brother/Printer/hl4150cdn/cupswrapper/cupswrapperhl4150cdn 2010-08-04 22:36:49.000000000 -0500
2 +++ new/usr/local/Brother/Printer/hl4150cdn/cupswrapper/cupswrapperhl4150cdn 2011-09-29 08:37:00.000000000 -0500
3 @@ -17,75 +17,45 @@
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
11 printer_model=""hl4150cdn""
12 printer_name=`echo $printer_model | tr '[a-z]' '[A-Z]'`
13 device_name=`echo $printer_name | eval sed -e 's/MFC/MFC-/' -e 's/DCP/DCP-/' -e 's/FAX/FAX-/'`
14 pcfilename=`echo $printer_name | tr -d '[A-Z]'`
15 device_model="Printer"
16 -tmp_filter=/var/tmp/brlpdwrapper${printer_model}
17 -if [ "$1" = '-e' ]; then
18 - lpadmin -x ${printer_name}
19 - rm -f /usr/share/cups/model/br${printer_model}.ppd
20 - rm -f /usr/share/ppd/br${printer_model}.ppd
21 - rm -f /usr/lib/cups/filter/brlpdwrapper${printer_model}
22 - rm -f /usr/lib64/cups/filter/brlpdwrapper${printer_model}
23 - rm -f /usr/local/Brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1
24 -if [ -e /etc/init.d/cups ]; then
25 - /etc/init.d/cups restart
26 -elif [ -e /etc/init.d/cupsys ]; then
27 - /etc/init.d/cupsys restart
28 -fi
29 -# /etc/init.d/cups restart
30 - exit 0
31 -fi
32 -if [ "$1" = "-r" ]; then
33 - lpadmin -x ${printer_name}
34 -if [ -e /etc/init.d/cups ]; then
35 - /etc/init.d/cups restart
36 -elif [ -e /etc/init.d/cupsys ]; then
37 - /etc/init.d/cupsys restart
38 -fi
39 -# /etc/init.d/cups restart
40 - exit 0
41 -fi
42 +tmp_filter=$PKGDIR/brlpdwrapper${printer_model}
43 +ppd_file_name=$DESTDIR/usr/share/cups/model/$printer_model.ppd
44 +brotherlpdwrapper=$DESTDIR/usr/lib/cups/filter/brlpdwrapper$printer_model
45 +brotherlpdwrapper64=$DESTDIR/usr/lib64/cups/filter/brlpdwrapper$printer_model
47 if [ "$1" = "help" ] || [ "$1" = "-h" ]; then
48 echo 'option -h : help'
49 echo ' -i : install'
50 echo ' -e : uninstall'
51 echo ' -r : remove printer'
52 + echo ' -s : simple install (Do not touch services)'
53 exit 0
55 #mkdir -p /usr/local/Brother/${device_model}/${printer_model}/filter
56 #mkdir -p /usr/lib/cups/filter
57 +mkdir -p $DESTDIR/usr/lib/cups/filter
58 +mkdir -p $DESTDIR/usr/share/cups/model
60 -if [ -e "/usr/local/Brother/${device_model}/${printer_model}/lpd/filter${printer_model}" ]; then
61 +if [ -e "$SRCDIR/usr/local/Brother/${device_model}/${printer_model}/lpd/filter${printer_model}" ]; then
63 else
64 echo "ERROR : Brother LPD filter is not installed."
66 -rm -f /usr/share/cups/model/br${printer_model}.ppd
67 -if [ -d "/usr/share/cups/model" ]; then
68 - ppd_file_name=/usr/share/cups/model/br${printer_model}.ppd
69 -else
70 - ppd_file_name=/usr/share/ppd/br${printer_model}.ppd
71 -fi
73 -if [ -e "/usr/local/Brother/${device_model}/${printer_model}/cupswrapper/${printer_model}.ppd" ]; then
74 -cp "/usr/local/Brother/${device_model}/${printer_model}/cupswrapper/${printer_model}.ppd" $ppd_file_name
75 +if [ -e "$SRCDIR/usr/local/Brother/${device_model}/${printer_model}/cupswrapper/${printer_model}.ppd" ]; then
76 +cp "$SRCDIR/usr/local/Brother/${device_model}/${printer_model}/cupswrapper/${printer_model}.ppd" $ppd_file_name
79 chmod 644 $ppd_file_name
81 -if [ -d /usr/share/ppd ]
82 -then
83 -if [ -d /usr/share/cups/model ]
84 -then
85 - cp $ppd_file_name /usr/share/ppd/br${printer_model}.ppd
86 - chmod 644 /usr/share/ppd/br${printer_model}.ppd
87 -fi
88 -fi
91 # create temporary CUPS Filter
93 @@ -198,25 +168,25 @@
94 cat > \$INPUT_TEMP_PS
97 -if [ -e "/usr/local/Brother/${device_model}/${printer_model}/lpd/filter${printer_model}" ]; then
98 +if [ -e "/usr/share/Brother/${device_model}/${printer_model}/lpd/filter${printer_model}" ]; then
100 else
101 - echo "ERROR: /usr/local/Brother/${device_model}/${printer_model}/lpd/filter${printer_model} does not exist" >>\$LOGFILE
102 + echo "ERROR: /usr/share/Brother/${device_model}/${printer_model}/lpd/filter${printer_model} does not exist" >>\$LOGFILE
103 errorcode=30
104 exit
107 CUPSOPTION=\`echo "\$5 Copies=\$4" | sed -e 's/PageSize/media/' -e 's/BrSheets/Sheets/' -e 's/multiple-document-handling/Collate/' -e 's/separate-documents-collated-copies/ON/' -e 's/separate-documents-uncollated-copies/OFF/'\`
108 -if [ -e "/usr/local/Brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1" ]; then
109 +if [ -e "/usr/share/Brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1" ]; then
110 if [ \$DEBUG = 0 ]; then
111 - /usr/local/Brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1 ${printer_name} \$PPDC 0 "\$CUPSOPTION" "${printer_model}">> /dev/null
112 + /usr/share/Brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1 ${printer_name} \$PPDC 0 "\$CUPSOPTION" "${printer_model}">> /dev/null
113 else
114 - /usr/local/Brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1 ${printer_name} \$PPDC \$LOGCLEVEL "\$CUPSOPTION" "${printer_model}">>\$LOGFILE
115 + /usr/share/Brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1 ${printer_name} \$PPDC \$LOGCLEVEL "\$CUPSOPTION" "${printer_model}">>\$LOGFILE
119 if [ \$DEBUG -lt 10 ]; then
120 - cat \$INPUT_TEMP_PS | /usr/local/Brother/${device_model}/${printer_model}/lpd/filter${printer_model} "\$\$" "CUPS" "USB"
121 + cat \$INPUT_TEMP_PS | /usr/share/Brother/${device_model}/${printer_model}/lpd/filter${printer_model} "\$\$" "CUPS" "USB"
123 if [ \$LOGLEVEL -gt 2 ]; then
124 if [ \$LOGFILE != "/dev/null" ]; then
125 @@ -235,30 +205,27 @@
126 chmod 755 $tmp_filter
129 -# check /usr/lib/cups/filter
131 -if [ -d /usr/lib/cups/filter ]; then
132 - brotherlpdwrapper=/usr/lib/cups/filter/brlpdwrapper${printer_model}
133 - rm -f $brotherlpdwrapper
134 - cp $tmp_filter $brotherlpdwrapper
138 # check /usr/lib64/cups/filter
140 -if [ -e /usr/lib64/cups/filter ]; then
141 - brotherlpdwrapper64=/usr/lib64/cups/filter/brlpdwrapper${printer_model}
142 +if [ -e $DESTDIR/usr/lib64/cups/filter ]; then
143 + brotherlpdwrapper64=$DESTDIR/usr/lib64/cups/filter/brlpdwrapper${printer_model}
144 rm -f $brotherlpdwrapper64
145 cp $tmp_filter $brotherlpdwrapper64
148 +if [ -d $DESTDIR/usr/lib/cups/filter ]; then
149 + brotherlpdwrapper=$DESTDIR/usr/lib/cups/filter/brlpdwrapper${printer_model}
150 + rm -f $brotherlpdwrapper
151 + cp $tmp_filter $brotherlpdwrapper
155 # remove temporary script file
157 rm -f $tmp_filter
159 -chmod a+w /usr/local/Brother/${device_model}/${printer_model}/inf/br${printer_model}rc
160 -chmod a+w /usr/local/Brother/${device_model}/${printer_model}/inf
161 +chmod a+w $DESTDIR/usr/share/Brother/${device_model}/${printer_model}/inf/br${printer_model}rc
162 +chmod a+w $DESTDIR/usr/share/Brother/${device_model}/${printer_model}/inf
163 if [ -e /etc/init.d/lpd ]; then
164 /etc/init.d/lpd stop
166 @@ -266,7 +233,6 @@
167 /etc/init.d/lprng stop
171 if [ -e /etc/init.d/cups ]; then
172 /etc/init.d/cups restart
173 elif [ -e /etc/init.d/cupsys ]; then
174 @@ -275,22 +241,5 @@
176 sleep 2s
179 -port2=`lpinfo -v | grep -i 'usb://Brother/${device_name}' | head -1`
180 -if [ "$port2" = '' ];then
181 - port2=`lpinfo -v | grep 'usb://Brother' | head -1`
184 -if [ "$port2" = '' ];then
185 - port2=`lpinfo -v | grep 'usb://' | head -1`
187 -port=`echo $port2| sed s/direct//g`
189 -if [ "$port" = '' ];then
190 - port=usb:/dev/usb/lp0
192 -#lpadmin -p ${printer_name} -E -v $port -m br${printer_model}.ppd
193 -lpadmin -p ${printer_name} -E -v $port -P $ppd_file_name
195 exit 0