From d10a3fccffae5f0c327a70f090b0e0026fd4216c Mon Sep 17 00:00:00 2001 From: hoshimach1 Date: Fri, 19 Sep 2025 11:49:38 +0000 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20install.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..8e7b944 --- /dev/null +++ b/install.sh @@ -0,0 +1,61 @@ +#!/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" \ No newline at end of file