updated on Thu Jan 19 20:01:47 UTC 2012
[aur-mirror.git] / brother-mfc260c-cupswrapper / brother-mfc260c-cupswrapper.patch
blob1e6d44e6edf39bed650423f587e1ea23aeac8d7d
1 diff -Naur data.org/usr/local/Brother/Printer/mfc260c/cupswrapper/cupswrappermfc260c data/usr/local/Brother/Printer/mfc260c/cupswrapper/cupswrappermfc260c
2 --- data.org/usr/local/Brother/Printer/mfc260c/cupswrapper/cupswrappermfc260c 2008-11-08 18:51:51.000000000 +0100
3 +++ data/usr/local/Brother/Printer/mfc260c/cupswrapper/cupswrappermfc260c 2008-11-08 19:37:11.000000000 +0100
4 @@ -22,49 +22,9 @@
5 printer_name=`echo $printer_model | tr '[a-z]' '[A-Z]'`
6 device_name=`echo $printer_name | eval sed -e 's/MFC/MFC-/' -e 's/DCP/DCP-/' -e 's/FAX/FAX-/'`
7 pcfilename=`echo $printer_name | tr -d '[A-Z]'`
8 -device_model="Printer"
9 -if [ "$1" = '-e' ]; then
10 - lpadmin -x ${printer_name}
11 - rm -f /usr/share/cups/model/br${printer_model}.ppd
12 - rm -f /usr/share/ppd/br${printer_model}.ppd
13 - rm -f /usr/lib/cups/filter/brlpdwrapper${printer_model}
14 - rm -f /usr/lib64/cups/filter/brlpdwrapper${printer_model}
15 - rm -f /usr/local/Brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1
16 -if [ -e /etc/init.d/cups ]; then
17 - /etc/init.d/cups restart
18 -elif [ -e /etc/init.d/cupsys ]; then
19 - /etc/init.d/cupsys restart
20 -fi
21 -# /etc/init.d/cups restart
22 - exit 0
23 -fi
24 -if [ "$1" = "-r" ]; then
25 - lpadmin -x ${printer_name}
26 -if [ -e /etc/init.d/cups ]; then
27 - /etc/init.d/cups restart
28 -elif [ -e /etc/init.d/cupsys ]; then
29 - /etc/init.d/cupsys restart
30 -fi
31 -# /etc/init.d/cups restart
32 - exit 0
33 -fi
34 -if [ "$1" = "help" ] || [ "$1" = "-h" ]; then
35 - echo 'option -h : help'
36 - echo ' -i : install'
37 - echo ' -e : uninstall'
38 - echo ' -r : remove printer'
39 - exit 0
40 -fi
41 -#mkdir -p /usr/local/Brother/${device_model}/${printer_model}/filter
42 -#mkdir -p /usr/lib/cups/filter
43 +device_model="printer"
45 -if [ -e "/usr/local/Brother/${device_model}/${printer_model}/lpd/filter${printer_model}" ]; then
46 - :
47 -else
48 - echo "ERROR : Brother LPD filter is not installed."
49 -fi
50 -rm -f /usr/share/cups/model/br${printer_model}.ppd
51 -ppd_file_name=/usr/share/cups/model/br${printer_model}.ppd
52 +ppd_file_name=br${printer_model}.ppd
54 cat <<ENDOFPPDFILE1 >$ppd_file_name
55 *PPD-Adobe: "4.3"
56 @@ -669,27 +629,8 @@
58 ENDOFPPDFILE_END
60 -chmod 644 $ppd_file_name
62 -if [ -d /usr/share/ppd ]
63 -then
64 - cp $ppd_file_name /usr/share/ppd/br${printer_model}.ppd
65 - chmod 644 /usr/share/ppd/br${printer_model}.ppd
66 -fi
68 -#################################################
70 -if [ -d /usr/lib/cups/filter ]
71 -then
72 - brotherlpdwrapper=/usr/lib/cups/filter/brlpdwrapper${printer_model}
73 -else
74 - brotherlpdwrapper=/usr/lib64/cups/filter/brlpdwrapper${printer_model}
75 -fi
78 -rm -f $brotherlpdwrapper
79 -#echo 'rm -f /usr/lib/cups/filter/brlpdwrapper${printer_model}'
81 +brotherlpdwrapper=brlpdwrapper${printer_model}
83 cat <<!ENDOFWFILTER! >$brotherlpdwrapper
84 #! /bin/sh
85 @@ -798,25 +739,25 @@
86 cat > \$INPUT_TEMP_PS
89 -if [ -e "/usr/local/Brother/${device_model}/${printer_model}/lpd/filter${printer_model}" ]; then
90 +if [ -e "/usr/share/brother/${device_model}/${printer_model}/lpd/filter${printer_model}" ]; then
92 else
93 - echo "ERROR: /usr/local/Brother/${device_model}/${printer_model}/lpd/filter${printer_model} does not exist" >>\$LOGFILE
94 + echo "ERROR: /usr/share/brother/${device_model}/${printer_model}/lpd/filter${printer_model} does not exist" >>\$LOGFILE
95 errorcode=30
96 exit
99 CUPSOPTION=\`echo "\$5 Copies=\$4" | sed -e 's/BrChain/Chain/' -e 's/BrBrightness/Brightness/' -e 's/BrContrast/Contrast/' -e 's/BrHalfCut/HalfCut/' -e 's/BrAutoTapeCut/AutoCut/' -e 's/BrMirror/Mirror/' -e 's/BrHalftonePattern/Halftone/' -e 's/Binary/Binary/' -e 's/Dither/Dither/' -e 's/ErrorDiffusion/ErrorDiffusion/' -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/'\`
100 -if [ -e "/usr/local/Brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1" ]; then
101 +if [ -e "/usr/share/brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1" ]; then
102 if [ \$DEBUG = 0 ]; then
103 - /usr/local/Brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1 ${printer_name} \$PPDC 0 "\$CUPSOPTION" "${printer_model}">> /dev/null
104 + /usr/share/brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1 ${printer_name} \$PPDC 0 "\$CUPSOPTION" "${printer_model}">> /dev/null
105 else
106 - /usr/local/Brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1 ${printer_name} \$PPDC \$LOGCLEVEL "\$CUPSOPTION" "${printer_model}">>\$LOGFILE
107 + /usr/share/brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1 ${printer_name} \$PPDC \$LOGCLEVEL "\$CUPSOPTION" "${printer_model}">>\$LOGFILE
111 if [ \$DEBUG -lt 10 ]; then
112 - cat \$INPUT_TEMP_PS | /usr/local/Brother/${device_model}/${printer_model}/lpd/filter${printer_model} "\$\$" "CUPS" "USB"
113 + cat \$INPUT_TEMP_PS | /usr/share/brother/${device_model}/${printer_model}/lpd/filter${printer_model} "\$\$" "CUPS" "USB"
115 if [ \$LOGLEVEL -gt 2 ]; then
116 if [ \$LOGFILE != "/dev/null" ]; then
117 @@ -828,48 +769,7 @@
119 rm -f \$INPUT_TEMP_PS
121 -exit $errorcode
122 +exit \$errorcode
124 !ENDOFWFILTER!
126 -chmod 755 $brotherlpdwrapper
127 -#if [ -e /usr/lib64/cups/backend ]; then
128 -# cp $brotherlpdwrapper $brotherlpdwrapper64
129 -#fi
131 -chmod a+w /usr/local/Brother/${device_model}/${printer_model}/inf/br${printer_model}rc
132 -chmod a+w /usr/local/Brother/${device_model}/${printer_model}/inf
133 -if [ -e /etc/init.d/lpd ]; then
134 - /etc/init.d/lpd stop
136 -if [ -e /etc/init.d/lprng ]; then
137 - /etc/init.d/lprng stop
141 -if [ -e /etc/init.d/cups ]; then
142 - /etc/init.d/cups restart
143 -elif [ -e /etc/init.d/cupsys ]; then
144 - /etc/init.d/cupsys restart
147 -sleep 2s
150 -port2=`lpinfo -v | grep -i 'usb://Brother/${device_name}' | head -1`
151 -if [ "$port2" = '' ];then
152 - port2=`lpinfo -v | grep 'usb://Brother' | head -1`
155 -if [ "$port2" = '' ];then
156 - port2=`lpinfo -v | grep 'usb://' | head -1`
158 -port=`echo $port2| sed s/direct//g`
160 -if [ "$port" = '' ];then
161 - port=usb:/dev/usb/lp0
163 -lpadmin -p ${printer_name} -E -v $port -m br${printer_model}.ppd
165 -exit 0