Created
August 9, 2013 19:29
-
-
Save menski/6196451 to your computer and use it in GitHub Desktop.
archlinux brother dcp165c driver patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff -ur usr-orig/local/Brother/Printer/dcp165c/cupswrapper/cupswrapperdcp165c usr/local/Brother/Printer/dcp165c/cupswrapper/cupswrapperdcp165c | |
| --- usr-orig/local/Brother/Printer/dcp165c/cupswrapper/cupswrapperdcp165c 2008-10-24 15:31:42.000000000 +0200 | |
| +++ usr/local/Brother/Printer/dcp165c/cupswrapper/cupswrapperdcp165c 2013-08-07 11:19:59.387221477 +0200 | |
| @@ -23,53 +23,8 @@ | |
| device_name=`echo $printer_name | eval sed -e 's/MFC/MFC-/' -e 's/DCP/DCP-/' -e 's/FAX/FAX-/'` | |
| pcfilename=`echo $printer_name | tr -d '[A-Z]'` | |
| device_model="Printer" | |
| -if [ "$1" = '-e' ]; then | |
| - lpadmin -x ${printer_name} | |
| - rm -f /usr/share/cups/model/br${printer_model}.ppd | |
| - rm -f /usr/share/ppd/br${printer_model}.ppd | |
| - rm -f /usr/lib/cups/filter/brlpdwrapper${printer_model} | |
| - rm -f /usr/lib64/cups/filter/brlpdwrapper${printer_model} | |
| - rm -f /usr/local/Brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1 | |
| -if [ -e /etc/init.d/cups ]; then | |
| - /etc/init.d/cups restart | |
| -elif [ -e /etc/init.d/cupsys ]; then | |
| - /etc/init.d/cupsys restart | |
| -fi | |
| -# /etc/init.d/cups restart | |
| - exit 0 | |
| -fi | |
| -if [ "$1" = "-r" ]; then | |
| - lpadmin -x ${printer_name} | |
| -if [ -e /etc/init.d/cups ]; then | |
| - /etc/init.d/cups restart | |
| -elif [ -e /etc/init.d/cupsys ]; then | |
| - /etc/init.d/cupsys restart | |
| -fi | |
| -# /etc/init.d/cups restart | |
| - exit 0 | |
| -fi | |
| -if [ "$1" = "help" ] || [ "$1" = "-h" ]; then | |
| - echo 'option -h : help' | |
| - echo ' -i : install' | |
| - echo ' -e : uninstall' | |
| - echo ' -r : remove printer' | |
| - exit 0 | |
| -fi | |
| -#mkdir -p /usr/local/Brother/${device_model}/${printer_model}/filter | |
| -#mkdir -p /usr/lib/cups/filter | |
| -if [ -e "/usr/local/Brother/${device_model}/${printer_model}/lpd/filter${printer_model}" ]; then | |
| - : | |
| -else | |
| - echo "ERROR : Brother LPD filter is not installed." | |
| -fi | |
| -rm -f /usr/share/cups/model/br${printer_model}.ppd | |
| -if [ -d "/usr/share/cups/model" ]; then | |
| - ppd_file_name=/usr/share/cups/model/br${printer_model}.ppd | |
| -else | |
| - ppd_file_name=/usr/share/ppd/br${printer_model}.ppd | |
| -fi | |
| -#ppd_file_name=/usr/share/cups/model/br${printer_model}.ppd | |
| +ppd_file_name=brother.ppd | |
| cat <<ENDOFPPDFILE1 >$ppd_file_name | |
| *PPD-Adobe: "4.3" | |
| @@ -697,30 +652,9 @@ | |
| ENDOFPPDFILE1 | |
| -chmod 644 $ppd_file_name | |
| - | |
| -if [ -d /usr/share/ppd ] | |
| -then | |
| -if [ -d /usr/share/cups/model ] | |
| -then | |
| - cp $ppd_file_name /usr/share/ppd/br${printer_model}.ppd | |
| - chmod 644 /usr/share/ppd/br${printer_model}.ppd | |
| -fi | |
| -fi | |
| - | |
| ################################################# | |
| -if [ -d /usr/lib/cups/filter ] | |
| -then | |
| - brotherlpdwrapper=/usr/lib/cups/filter/brlpdwrapper${printer_model} | |
| -else | |
| - brotherlpdwrapper=/usr/lib64/cups/filter/brlpdwrapper${printer_model} | |
| -fi | |
| - | |
| - | |
| -rm -f $brotherlpdwrapper | |
| -#echo 'rm -f /usr/lib/cups/filter/brlpdwrapper${printer_model}' | |
| - | |
| +brotherlpdwrapper=brother.wrapper | |
| cat <<!ENDOFWFILTER! >$brotherlpdwrapper | |
| #! /bin/sh | |
| @@ -829,25 +763,25 @@ | |
| cat > \$INPUT_TEMP_PS | |
| fi | |
| fi | |
| -if [ -e "/usr/local/Brother/${device_model}/${printer_model}/lpd/filter${printer_model}" ]; then | |
| +if [ -e "/usr/share/brother/lpd/filter${printer_model}" ]; then | |
| : | |
| else | |
| - echo "ERROR: /usr/local/Brother/${device_model}/${printer_model}/lpd/filter${printer_model} does not exist" >>\$LOGFILE | |
| + echo "ERROR: /usr/share/brother/lpd/filter${printer_model} does not exist" >>\$LOGFILE | |
| errorcode=30 | |
| exit | |
| fi | |
| CUPSOPTION=\`echo "\$5 Copies=\$4" | sed -e 's/BrMirror=OFF/MirrorPrint=OFF/' -e 's/BrMirror=ON/MirrorPrint=ON/' -e 's/BrChain/Chain/' -e 's/BrBrightness/Brightness/' -e 's/BrContrast/Contrast/' -e 's/BrHalfCut/HalfCut/' -e 's/BrAutoTapeCut/AutoCut/' -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/'\` | |
| -if [ -e "/usr/local/Brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1" ]; then | |
| +if [ -e "/usr/share/brother/cupswrapper/brcupsconfpt1" ]; then | |
| if [ \$DEBUG = 0 ]; then | |
| - /usr/local/Brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1 ${printer_name} \$PPDC 0 "\$CUPSOPTION" "${printer_model}">> /dev/null | |
| + /usr/share/brother/cupswrapper/brcupsconfpt1 ${printer_name} \$PPDC 0 "\$CUPSOPTION" "${printer_model}">> /dev/null | |
| else | |
| - /usr/local/Brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1 ${printer_name} \$PPDC \$LOGCLEVEL "\$CUPSOPTION" "${printer_model}">>\$LOGFILE | |
| + /usr/share/brother/cupswrapper/brcupsconfpt1 ${printer_name} \$PPDC \$LOGCLEVEL "\$CUPSOPTION" "${printer_model}">>\$LOGFILE | |
| fi | |
| fi | |
| if [ \$DEBUG -lt 10 ]; then | |
| - cat \$INPUT_TEMP_PS | /usr/local/Brother/${device_model}/${printer_model}/lpd/filter${printer_model} "\$\$" "CUPS" "USB" | |
| + cat \$INPUT_TEMP_PS | /usr/share/brother/lpd/filter${printer_model} "\$\$" "CUPS" "USB" | |
| if [ \$LOGLEVEL -gt 2 ]; then | |
| if [ \$LOGFILE != "/dev/null" ]; then | |
| @@ -862,46 +796,3 @@ | |
| exit $errorcode | |
| !ENDOFWFILTER! | |
| - | |
| -chmod 755 $brotherlpdwrapper | |
| -#if [ -e /usr/lib64/cups/backend ]; then | |
| -# cp $brotherlpdwrapper $brotherlpdwrapper64 | |
| -#fi | |
| - | |
| -chmod a+w /usr/local/Brother/${device_model}/${printer_model}/inf/br${printer_model}rc | |
| -chmod a+w /usr/local/Brother/${device_model}/${printer_model}/inf | |
| -if [ -e /etc/init.d/lpd ]; then | |
| - /etc/init.d/lpd stop | |
| -fi | |
| -if [ -e /etc/init.d/lprng ]; then | |
| - /etc/init.d/lprng stop | |
| -fi | |
| - | |
| - | |
| -if [ -e /etc/init.d/cups ]; then | |
| - /etc/init.d/cups restart | |
| -elif [ -e /etc/init.d/cupsys ]; then | |
| - /etc/init.d/cupsys restart | |
| -fi | |
| - | |
| -sleep 2s | |
| - | |
| - | |
| -port2=`lpinfo -v | grep -i 'usb://Brother/${device_name}' | head -1` | |
| -if [ "$port2" = '' ];then | |
| - port2=`lpinfo -v | grep 'usb://Brother' | head -1` | |
| -fi | |
| - | |
| -if [ "$port2" = '' ];then | |
| - port2=`lpinfo -v | grep 'usb://' | head -1` | |
| -fi | |
| -port=`echo $port2| sed s/direct//g` | |
| - | |
| -if [ "$port" = '' ];then | |
| - port=usb:/dev/usb/lp0 | |
| -fi | |
| -#lpadmin -p ${printer_name} -E -v $port -m br${printer_model}.ppd | |
| -lpadmin -p ${printer_name} -E -v $port -P $ppd_file_name | |
| - | |
| -exit 0 | |
| - | |
| diff -ur usr-orig/local/Brother/Printer/dcp165c/inf/setupPrintcapij usr/local/Brother/Printer/dcp165c/inf/setupPrintcapij | |
| --- usr-orig/local/Brother/Printer/dcp165c/inf/setupPrintcapij 2008-10-24 15:32:59.000000000 +0200 | |
| +++ usr/local/Brother/Printer/dcp165c/inf/setupPrintcapij 2013-08-07 11:21:07.986431510 +0200 | |
| @@ -41,14 +41,14 @@ | |
| if [ "$3" = "USB" ]; then | |
| DEVICE_IF=/dev/usb/lp0 | |
| fi | |
| - | |
| + | |
| cat <<EOF >>$PRINTCAP_NAME | |
| ${BRPRINTER_NAME}:\\ | |
| :mx=0:\\ | |
| :sd=/var/spool/lpd/$BRPRINTER_MODEL:\\ | |
| :sh:\\ | |
| :lp=$DEVICE_IF:\\ | |
| - :if=/usr/local/Brother/Printer/$BRPRINTER_MODEL/lpd/filter$BRPRINTER_MODEL: | |
| + :if=/usr/share/brother/lpd/filter$BRPRINTER_MODEL: | |
| EOF | |
| ;; | |
| -e) | |
| diff -ur usr-orig/local/Brother/Printer/dcp165c/lpd/filterdcp165c usr/local/Brother/Printer/dcp165c/lpd/filterdcp165c | |
| --- usr-orig/local/Brother/Printer/dcp165c/lpd/filterdcp165c 2008-10-24 15:32:59.000000000 +0200 | |
| +++ usr/local/Brother/Printer/dcp165c/lpd/filterdcp165c 2013-08-07 11:20:33.066833637 +0200 | |
| @@ -21,7 +21,7 @@ | |
| PRINTER="dcp165c" | |
| PRINTER_TMP=$(echo $PRINTER | sed -e 's/ //g' -e 's/-//g') | |
| -BR_PRT_PATH=/usr/local/Brother/Printer/${PRINTER} | |
| +BR_PRT_PATH=/usr/share/brother | |
| RCFILE=`eval echo $BR_PRT_PATH/inf/brPRINTERrc | eval sed 's/PRINTER/"$PRINTER_TMP"/'` | |
| PAPER_INF=$BR_PRT_PATH/inf/paperinfij2 | |
| PSCONV=$BR_PRT_PATH/lpd/psconvertij2 | |
| @@ -40,7 +40,7 @@ | |
| #fi | |
| trap '' 2 | |
| -case "$FILE_TYPE" in | |
| +case "$FILE_TYPE" in | |
| "PostScript") | |
| eval cat $INPUT_TEMP | $PSCONV $PSCONV_OP | $BRCONV $BRCONV_OP | |
| RET=$? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pkgname=dcp165c | |
| pkgver=1.1.2 | |
| pkgrel=2 | |
| pkgdesc="CUPS driver for Brother DCP-165 printer" | |
| arch=('any') | |
| license=('custom:Brother Industries') | |
| depends=('cups') | |
| makedepends=('libarchive' 'patch') | |
| url="http://solutions.brother.com/linux/en_us/index.html" | |
| source=(brother-dcp165c.patch http://www.brother.com/pub/bsc/linux/dlf/dcp165ccupswrapper-1.1.2-2.i386.rpm http://www.brother.com/pub/bsc/linux/dlf/dcp165clpr-1.1.2-2.i386.rpm) | |
| md5sums=('a7d0a389795b3d16cdb1027a41f99335' '0bf765de513b8d1e37567ecf2c04897e' '22a0932c6547a682af4a16fb86100614' ) | |
| build() { | |
| cd "$srcdir" || return 1 | |
| for n in $srcdir/*.rpm; do | |
| bsdtar xf "$n" || return 1 | |
| done | |
| cd "$srcdir/usr" || return 1 | |
| patch -p1 < ../brother-dcp165c.patch | |
| cd "$srcdir" || return 1 | |
| "$srcdir/usr/local/Brother/Printer/dcp165c/cupswrapper/cupswrapperdcp165c" | |
| } | |
| package() { | |
| mkdir -p "$pkgdir/usr/share/" | |
| cp -R "$srcdir/usr/bin" "$pkgdir/usr" | |
| cp -R "$srcdir/usr/local/Brother/Printer/dcp165c/" "$pkgdir/usr/share/brother" | |
| rm "$pkgdir/usr/share/brother/cupswrapper/cupswrapperdcp165c" | |
| rm "$pkgdir/usr/share/brother/inf/setupPrintcapij" | |
| install -m 644 -D "$srcdir/brother.ppd" "$pkgdir/usr/share/cups/model/brdcp165c.ppd" | |
| install -m 755 -D "$srcdir/brother.wrapper" "$pkgdir/usr/lib/cups/filter/brlpdwrapperdcp165c" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment