rpi-brother-printer-setup/📄 rpi-brother-airprint.sh
시골약사 f1f8118cce Add AirPrint setup script and README
- Add automated installation script for Brother HL-L2335D with AirPrint
- Include README with quick install commands and usage guide
- Support curl/wget one-liner installation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-04 14:35:22 +00:00

56 lines
1.7 KiB
Bash

#!/bin/bash
set -e
echo "=== Raspberry Pi AirPrint + Brother HL-L2335D Setup ==="
### 0. 기본 업데이트
sudo apt-get update -y
sudo apt-get upgrade -y
### 1. CUPS + AirPrint 관련 패키지 설치
sudo apt-get install -y \
cups cups-client cups-filters \
avahi-daemon avahi-discover avahi-utils \
printer-driver-brlaser printer-driver-gutenprint \
system-config-printer
# ipp-usb 충돌 방지 (USB 프린터 직접 잡도록)
sudo systemctl stop ipp-usb || true
sudo systemctl disable ipp-usb || true
### 2. CUPS 권한 및 방화벽
sudo usermod -aG lpadmin $USER
sudo cupsctl --remote-admin --remote-any --share-printers
### 3. Brother HL-L2335D 큐 등록
PRINTER_NAME="HLL2335D"
PRINTER_URI="usb://Brother/HL-L2335D%20series?serial=$(lsusb -d 04f9: | awk '{print $6}' || echo AUTO)"
# 기존 큐 제거
sudo lpadmin -x $PRINTER_NAME 2>/dev/null || true
# brlaser 드라이버를 이용한 큐 생성
sudo lpadmin -p $PRINTER_NAME -E \
-v "$PRINTER_URI" \
-m drv:///brlaser.drv/brl2335d.ppd \
-D "Brother HL-L2335D (brlaser)"
# 큐 공유/활성화
sudo lpadmin -p $PRINTER_NAME -o printer-is-shared=true
sudo cupsaccept $PRINTER_NAME
sudo cupsenable $PRINTER_NAME
sudo lpadmin -d $PRINTER_NAME
### 4. Avahi AirPrint 서비스 확인
if ! systemctl is-active --quiet avahi-daemon; then
sudo systemctl enable avahi-daemon --now
fi
### 5. 테스트 페이지 출력
echo "Hello from Raspberry Pi + Brother HL-L2335D (brlaser)" | lp -d $PRINTER_NAME
echo "=== 완료! ==="
echo "➡ iPhone/iPad: AirPrint 프린터 목록에서 '${PRINTER_NAME}' 확인"
echo "➡ Windows: 네트워크 프린터 추가 → ipp://raspberrypi.local/printers/${PRINTER_NAME}"
echo "➡ 관리 페이지: http://$(hostname -I | awk '{print $1}'):631"