Just thought I'd post this here since there are a few threads with people having trouble installing this printer and the [SOLVED] ones are using 11.04.. I tried following suggestions from this thread, this thread, and this blog post but couldn't get it to work in 12.04 (printer showed in cups but just hung, didn't print). I also use arch linux and the install script I use for arch also worked for me on 12.04. I connect through usb though I imagine connecting over the network would work by changing he device URI in /etc/cups/pritners.conf to use an IP address as mentioned in the above threads.
Code:
#!/bin/bash
# Brother HL-2270DW printer install tested on arch and ubuntu 12.04
# https://bbs.archlinux.org/viewtopic.php?id=109570
# https://bugs.gentoo.org/show_bug.cgi?id=285166#c12
# http://github.com/willejos/bash
[[ $UID -ne 0 ]] && echo "Must run as root" && exit 1
which bsdtar > /dev/null
if [ $? == 1 ]; then
echo "you need to install bsdtar before running this script"
exit 1;
fi
which perl > /dev/null
if [ $? == 1 ]; then
echo "you need to install perl before running this script"
exit 1;
fi
echo -e "\nMake sure cups is running before proceeding...\n"
read -p "Hit any button to continue." -n 1
echo -e "\n\nWhere's your init script directory?"
echo -e "1. /etc/init.d/\n2. /etc/rc.d/"
read -p "(Select 1 or 2): " INIT_DIR
while [[ $INIT_DIR != 1 && $INIT_DIR != 2 ]]; do
read -p "Where's your init script directory? (choose 1 or 2): " INIT_DIR
done
START_DIR=$(pwd)
mkdir br_tmp && cd br_tmp
wget http://www.brother.com/pub/bsc/linux/dlf/hl2270dwlpr-2.1.0-1.i386.rpm
wget http://www.brother.com/pub/bsc/linux/dlf/cupswrapperHL2270DW-2.0.4-2.i386.rpm
if [[ ! -f hl2270dwlpr-2.1.0-1.i386.rpm || ! -f cupswrapperHL2270DW-2.0.4-2.i386.rpm ]]; then
echo -e "One or both files not found: \n hl2270dwlpr-2.1.0-1.i386.rpm \n cupswrapperHL2270DW-2.0.4-2.i386.rpm \n\n Was there a problem with the download?"
exit 1;
fi
# extract and check directories exist
bsdtar -xf hl2270dwlpr-2.1.0-1.i386.rpm
bsdtar -xf cupswrapperHL2270DW-2.0.4-2.i386.rpm
HL_DIR=""$START_DIR"/br_tmp/usr/local/Brother/Printer/HL2270DW/inf/"
CUPS_DIR=""$START_DIR"/br_tmp/usr/local/Brother/Printer/HL2270DW/cupswrapper/"
if [[ ! -d "$HL_DIR" || ! -d "$CUPS_DIR" ]]; then
echo "rpm extraction failed"
exit 1
fi
# in-place edit files
cd "$HL_DIR"
perl -pi -e 's/printcap.local/printcap/g' setupPrintcap2
if [ "$INIT_DIR" == "2" ]; then
cd "$CUPS_DIR"
perl -pi -e 's/init.d/rc.d/g' cupswrapperHL2270DW-2.0.4
fi
# copy files to system and install cupswrapper
cd "$START_DIR"/br_tmp/
cp -ri usr/* /usr/
cp -ri var/* /var/
cd ../ && rm -rf br_tmp
echo -e "If I hang here, be patient....\n"
/usr/local/Brother/Printer/HL2270DW/cupswrapper/cupswrapperHL2270DW-2.0.4 || exit 1
echo -e "\nNext steps: "
echo "Make sure printer shows up in cups config @ http://127.0.0.1:631"
echo "Edit /etc/cups/printers.conf and change the DeviceURI from ‘usb:xxxxx’ to ‘file:///dev/usb/lp0′ (or usb/lp1 or whatever exists, no quotes)."
echo -e "Restart cups\n"
Bookmarks