#!/bin/bash # Canon LBP 2900B CAPT driver installer for Astra Linux # Tested on Astra Linux CE 1.7 / SE 1.7 (Debian-based) set -e DRIVER_URL="https://gdlp01.c-wss.com/gds/9/0100006719/01/captdriver-2.71-1.tar.gz" DRIVER_FILE="captdriver-2.71-1.tar.gz" DRIVER_DIR="captdriver-2.71-1" echo "=== Canon LBP 2900B driver install script for Astra Linux ===" # 1. Update system and install dependencies echo "[1/6] Installing dependencies..." sudo apt update sudo apt install -y build-essential libcups2-dev cups cups-client libglade2-dev # 2. Download driver if not exists if [ ! -f "$DRIVER_FILE" ]; then echo "[2/6] Downloading Canon CAPT driver..." wget -O "$DRIVER_FILE" "$DRIVER_URL" fi # 3. Extract and install echo "[3/6] Extracting driver..." tar -xvzf "$DRIVER_FILE" cd "$DRIVER_DIR" echo "[4/6] Installing driver packages..." sudo dpkg -i cndrvcups-common_*_amd64.deb sudo dpkg -i cndrvcups-capt_*_amd64.deb || sudo apt --fix-broken -y install # 4. Detect printer echo "[5/6] Detecting printer..." DEVICE_URI=$(lpinfo -v | grep "usb://Canon/LBP2900" | head -n 1 | awk '{print $2}') if [ -z "$DEVICE_URI" ]; then echo "❌ Printer not detected via USB. Connect and run: lpinfo -v" exit 1 fi echo "✔ Found printer at: $DEVICE_URI" # 5. Add printer to CUPS sudo /usr/sbin/lpadmin -p LBP2900 -m CNCUPSLBP2900CAPTK.ppd -v "$DEVICE_URI" -E sudo lpoptions -d LBP2900 # 6. Setup CAPT daemon echo "[6/6] Setting up CAPT daemon..." sudo /etc/init.d/ccpd start sudo systemctl enable ccpd sudo ccpdadmin -p LBP2900 -o /dev/usb/lp0 || true # Add udev rule to auto-detect printer after reboot UDEV_RULE="/etc/udev/rules.d/85-canon-capt.rules" echo "SUBSYSTEM==\"usb\", ATTRS{idVendor}==\"04a9\", ATTRS{idProduct}==\"2676\", OWNER=\"root\", GROUP=\"lp\", MODE=\"0664\"" | sudo tee "$UDEV_RULE" echo "=== Installation complete! ===" echo "🔹 Check printer status: captstatusui -P LBP2900" echo "🔹 Test print: lp -d LBP2900 /usr/share/cups/data/testprint"