From d83a3bc97748b5e0cf4503b8447a98fe7edcc6a5 Mon Sep 17 00:00:00 2001 From: yuyx <237899745@qq.com> Date: Sun, 30 Nov 2025 20:44:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E6=8F=90=E4=BA=A4=EF=BC=9A?= =?UTF-8?q?=E4=B8=AD=E5=85=B4B863AV3.2-M=E5=88=B7Armbian=20+=20CUPS?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=9C=8D=E5=8A=A1=E6=95=99=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 包含: - 刷机教程.md - 完整刷机和CUPS配置文档 - setup_cups.sh - 一键安装CUPS脚本(支持换源、多驱动选择、中文界面) - cups-templates-zh_CN/ - CUPS中文界面模板 🤖 Generated with Claude Code --- cups-templates-zh_CN/add-class.tmpl | 37 ++ cups-templates-zh_CN/add-printer.tmpl | 41 ++ cups-templates-zh_CN/admin.tmpl | 63 +++ cups-templates-zh_CN/choose-device.tmpl | 49 ++ cups-templates-zh_CN/choose-make.tmpl | 61 +++ cups-templates-zh_CN/choose-model.tmpl | 58 +++ cups-templates-zh_CN/choose-serial.tmpl | 49 ++ cups-templates-zh_CN/choose-uri.tmpl | 41 ++ cups-templates-zh_CN/class-added.tmpl | 4 + cups-templates-zh_CN/class-confirm.tmpl | 6 + cups-templates-zh_CN/class-deleted.tmpl | 3 + cups-templates-zh_CN/class-jobs-header.tmpl | 1 + cups-templates-zh_CN/class-modified.tmpl | 4 + cups-templates-zh_CN/class.tmpl | 41 ++ cups-templates-zh_CN/classes-header.tmpl | 1 + cups-templates-zh_CN/classes.tmpl | 11 + cups-templates-zh_CN/command.tmpl | 8 + cups-templates-zh_CN/edit-config.tmpl | 20 + cups-templates-zh_CN/error-op.tmpl | 5 + cups-templates-zh_CN/error.tmpl | 5 + cups-templates-zh_CN/header.tmpl | 40 ++ cups-templates-zh_CN/help-header.tmpl | 41 ++ cups-templates-zh_CN/help-printable.tmpl | 9 + cups-templates-zh_CN/help-trailer.tmpl | 0 cups-templates-zh_CN/job-cancel.tmpl | 3 + cups-templates-zh_CN/job-hold.tmpl | 3 + cups-templates-zh_CN/job-move.tmpl | 23 + cups-templates-zh_CN/job-moved.tmpl | 4 + cups-templates-zh_CN/job-release.tmpl | 3 + cups-templates-zh_CN/job-restart.tmpl | 3 + cups-templates-zh_CN/jobs-header.tmpl | 5 + cups-templates-zh_CN/jobs.tmpl | 36 ++ .../list-available-printers.tmpl | 7 + cups-templates-zh_CN/modify-class.tmpl | 31 ++ cups-templates-zh_CN/modify-printer.tmpl | 39 ++ cups-templates-zh_CN/norestart.tmpl | 4 + cups-templates-zh_CN/option-boolean.tmpl | 6 + cups-templates-zh_CN/option-conflict.tmpl | 7 + cups-templates-zh_CN/option-header.tmpl | 5 + cups-templates-zh_CN/option-pickmany.tmpl | 6 + cups-templates-zh_CN/option-pickone.tmpl | 18 + cups-templates-zh_CN/option-trailer.tmpl | 5 + cups-templates-zh_CN/pager.tmpl | 7 + cups-templates-zh_CN/printer-accept.tmpl | 5 + cups-templates-zh_CN/printer-added.tmpl | 15 + cups-templates-zh_CN/printer-cancel-jobs.tmpl | 5 + cups-templates-zh_CN/printer-configured.tmpl | 4 + cups-templates-zh_CN/printer-confirm.tmpl | 6 + cups-templates-zh_CN/printer-default.tmpl | 9 + cups-templates-zh_CN/printer-deleted.tmpl | 3 + cups-templates-zh_CN/printer-jobs-header.tmpl | 1 + cups-templates-zh_CN/printer-modified.tmpl | 4 + cups-templates-zh_CN/printer-reject.tmpl | 5 + cups-templates-zh_CN/printer-start.tmpl | 5 + cups-templates-zh_CN/printer-stop.tmpl | 5 + cups-templates-zh_CN/printer.tmpl | 43 ++ cups-templates-zh_CN/printers-header.tmpl | 1 + cups-templates-zh_CN/printers.tmpl | 11 + cups-templates-zh_CN/restart.tmpl | 4 + cups-templates-zh_CN/search.tmpl | 10 + .../set-printer-options-header.tmpl | 24 + .../set-printer-options-trailer.tmpl | 14 + cups-templates-zh_CN/test-page.tmpl | 4 + cups-templates-zh_CN/trailer.tmpl | 5 + cups-templates-zh_CN/users.tmpl | 27 ++ setup_cups.sh | 439 ++++++++++++++++++ 刷机教程.md | 415 +++++++++++++++++ 67 files changed, 1877 insertions(+) create mode 100644 cups-templates-zh_CN/add-class.tmpl create mode 100644 cups-templates-zh_CN/add-printer.tmpl create mode 100644 cups-templates-zh_CN/admin.tmpl create mode 100644 cups-templates-zh_CN/choose-device.tmpl create mode 100644 cups-templates-zh_CN/choose-make.tmpl create mode 100644 cups-templates-zh_CN/choose-model.tmpl create mode 100644 cups-templates-zh_CN/choose-serial.tmpl create mode 100644 cups-templates-zh_CN/choose-uri.tmpl create mode 100644 cups-templates-zh_CN/class-added.tmpl create mode 100644 cups-templates-zh_CN/class-confirm.tmpl create mode 100644 cups-templates-zh_CN/class-deleted.tmpl create mode 100644 cups-templates-zh_CN/class-jobs-header.tmpl create mode 100644 cups-templates-zh_CN/class-modified.tmpl create mode 100644 cups-templates-zh_CN/class.tmpl create mode 100644 cups-templates-zh_CN/classes-header.tmpl create mode 100644 cups-templates-zh_CN/classes.tmpl create mode 100644 cups-templates-zh_CN/command.tmpl create mode 100644 cups-templates-zh_CN/edit-config.tmpl create mode 100644 cups-templates-zh_CN/error-op.tmpl create mode 100644 cups-templates-zh_CN/error.tmpl create mode 100644 cups-templates-zh_CN/header.tmpl create mode 100644 cups-templates-zh_CN/help-header.tmpl create mode 100644 cups-templates-zh_CN/help-printable.tmpl create mode 100644 cups-templates-zh_CN/help-trailer.tmpl create mode 100644 cups-templates-zh_CN/job-cancel.tmpl create mode 100644 cups-templates-zh_CN/job-hold.tmpl create mode 100644 cups-templates-zh_CN/job-move.tmpl create mode 100644 cups-templates-zh_CN/job-moved.tmpl create mode 100644 cups-templates-zh_CN/job-release.tmpl create mode 100644 cups-templates-zh_CN/job-restart.tmpl create mode 100644 cups-templates-zh_CN/jobs-header.tmpl create mode 100644 cups-templates-zh_CN/jobs.tmpl create mode 100644 cups-templates-zh_CN/list-available-printers.tmpl create mode 100644 cups-templates-zh_CN/modify-class.tmpl create mode 100644 cups-templates-zh_CN/modify-printer.tmpl create mode 100644 cups-templates-zh_CN/norestart.tmpl create mode 100644 cups-templates-zh_CN/option-boolean.tmpl create mode 100644 cups-templates-zh_CN/option-conflict.tmpl create mode 100644 cups-templates-zh_CN/option-header.tmpl create mode 100644 cups-templates-zh_CN/option-pickmany.tmpl create mode 100644 cups-templates-zh_CN/option-pickone.tmpl create mode 100644 cups-templates-zh_CN/option-trailer.tmpl create mode 100644 cups-templates-zh_CN/pager.tmpl create mode 100644 cups-templates-zh_CN/printer-accept.tmpl create mode 100644 cups-templates-zh_CN/printer-added.tmpl create mode 100644 cups-templates-zh_CN/printer-cancel-jobs.tmpl create mode 100644 cups-templates-zh_CN/printer-configured.tmpl create mode 100644 cups-templates-zh_CN/printer-confirm.tmpl create mode 100644 cups-templates-zh_CN/printer-default.tmpl create mode 100644 cups-templates-zh_CN/printer-deleted.tmpl create mode 100644 cups-templates-zh_CN/printer-jobs-header.tmpl create mode 100644 cups-templates-zh_CN/printer-modified.tmpl create mode 100644 cups-templates-zh_CN/printer-reject.tmpl create mode 100644 cups-templates-zh_CN/printer-start.tmpl create mode 100644 cups-templates-zh_CN/printer-stop.tmpl create mode 100644 cups-templates-zh_CN/printer.tmpl create mode 100644 cups-templates-zh_CN/printers-header.tmpl create mode 100644 cups-templates-zh_CN/printers.tmpl create mode 100644 cups-templates-zh_CN/restart.tmpl create mode 100644 cups-templates-zh_CN/search.tmpl create mode 100644 cups-templates-zh_CN/set-printer-options-header.tmpl create mode 100644 cups-templates-zh_CN/set-printer-options-trailer.tmpl create mode 100644 cups-templates-zh_CN/test-page.tmpl create mode 100644 cups-templates-zh_CN/trailer.tmpl create mode 100644 cups-templates-zh_CN/users.tmpl create mode 100755 setup_cups.sh create mode 100644 刷机教程.md diff --git a/cups-templates-zh_CN/add-class.tmpl b/cups-templates-zh_CN/add-class.tmpl new file mode 100644 index 0000000..3deaf26 --- /dev/null +++ b/cups-templates-zh_CN/add-class.tmpl @@ -0,0 +1,37 @@ +

Add Class

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
Name:
+(May contain any printable characters except "/", "#", and space)
Description:
+(Human-readable description such as "HP LaserJet with Duplexer")
Location:
+(Human-readable location such as "Lab 1")
Members: + +
+ +
diff --git a/cups-templates-zh_CN/add-printer.tmpl b/cups-templates-zh_CN/add-printer.tmpl new file mode 100644 index 0000000..22210fd --- /dev/null +++ b/cups-templates-zh_CN/add-printer.tmpl @@ -0,0 +1,41 @@ +

添加打印机

+
+ + + + + + +{?current_make!?:} +{?current_make_and_model!?:} + + + + + + + + + + + + + + + + + + + + + + + + + +
名称:
+(可包含任何可打印字符,除了 "/"、"#" 和空格)
描述:
+(如 "HP 激光打印机")
位置:
+(如 "办公室")
连接:{device_uri}
共享: +
+
diff --git a/cups-templates-zh_CN/admin.tmpl b/cups-templates-zh_CN/admin.tmpl new file mode 100644 index 0000000..ac2d692 --- /dev/null +++ b/cups-templates-zh_CN/admin.tmpl @@ -0,0 +1,63 @@ +
+
+

打印机

+

+

+
+
+

+

打印机类

+

+

+
+

+

打印任务

+

+

+

+
+
+

服务器

+

+

+

+ {SETTINGS_ERROR?

{SETTINGS_MESSAGE}

+
{SETTINGS_ERROR}
: +
+ + {ADVANCEDSETTINGS?

服务器设置:

+

高级
+ + +
+         最大客户端数: +
+         
+         
+
+ {have_gssapi?
:} +
+
+         最大任务数(0为无限制): +
+         保留元数据: +
+         保留文档: +
+
+         最大日志文件大小: +

+ :

服务器设置:

+

高级
+ +
+         
+
+ {have_gssapi?
:} +
+

+ } +

+
} +
+
diff --git a/cups-templates-zh_CN/choose-device.tmpl b/cups-templates-zh_CN/choose-device.tmpl new file mode 100644 index 0000000..1f6fcab --- /dev/null +++ b/cups-templates-zh_CN/choose-device.tmpl @@ -0,0 +1,49 @@ +

{op=modify-printer?修改 {printer_name}:添加打印机}

+ +{CUPS_GET_DEVICES_DONE?
+ + +{printer_name?:} + + +{op=add-printer?: + + +} + + + + + + + + + + + + + + + + + +
当前连接: +
本地打印机: +{[device_uri]{device_class!network? +
+:}} +
已发现的网络打印机: +{[device_uri]{device_class=network?{device_uri~[a-z]+://? +
+:}:}} +
其他网络打印机: +{[device_uri]{device_class=network?{device_uri~[a-z]+://?: +
+}:}} +
+ +
:

正在搜索打印机...

} diff --git a/cups-templates-zh_CN/choose-make.tmpl b/cups-templates-zh_CN/choose-make.tmpl new file mode 100644 index 0000000..75d254f --- /dev/null +++ b/cups-templates-zh_CN/choose-make.tmpl @@ -0,0 +1,61 @@ +

{op=modify-printer?修改 {printer_name}:添加打印机}

+ +
+ + +{printer_name?:} + + + + + + +{op=modify-printer?: + + +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
名称:{printer_name}
描述:{printer_info}
位置:{printer_location}
连接:{device_uri}
共享: +{?printer_is_shared=?不:{?printer_is_shared=0?不:}}共享此打印机
品牌: + +
 
或提供 PPD 文件:
+ +
diff --git a/cups-templates-zh_CN/choose-model.tmpl b/cups-templates-zh_CN/choose-model.tmpl new file mode 100644 index 0000000..ffab7ed --- /dev/null +++ b/cups-templates-zh_CN/choose-model.tmpl @@ -0,0 +1,58 @@ +

{op=modify-printer?修改 {printer_name}:添加打印机}

+ +
+ + +{printer_name?:} + + + + + +{op=modify-printer?: + + +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
名称:{printer_name}
描述:{printer_info}
位置:{printer_location}
连接:{device_uri}
共享: +{?printer_is_shared=?不:{?printer_is_shared=0?不:}}共享此打印机
品牌:{PPD_MAKE}
型号: + +
或提供 PPD 文件:
+ +
diff --git a/cups-templates-zh_CN/choose-serial.tmpl b/cups-templates-zh_CN/choose-serial.tmpl new file mode 100644 index 0000000..89a5eaf --- /dev/null +++ b/cups-templates-zh_CN/choose-serial.tmpl @@ -0,0 +1,49 @@ +

{op=modify-printer?Modify {printer_name}:Add Printer}

+ +
+ + +{printer_name?:} + + + + + + + + + + + + + + + + + + + + + + + + + + +
Connection:{device_uri}
Baud Rate:
Parity:
Data Bits:
Flow Control:
+ +
diff --git a/cups-templates-zh_CN/choose-uri.tmpl b/cups-templates-zh_CN/choose-uri.tmpl new file mode 100644 index 0000000..0c7f454 --- /dev/null +++ b/cups-templates-zh_CN/choose-uri.tmpl @@ -0,0 +1,41 @@ +

{op=modify-printer?Modify {printer_name}:Add Printer}

+ +
+ + +{printer_name?:} + + + + + + + + + + + + + + + +
Connection:
Examples: +
+    http://hostname:631/ipp/
+    http://hostname:631/ipp/port1
+
+    ipp://hostname/ipp/
+    ipp://hostname/ipp/port1
+
+    lpd://hostname/queue
+
+    socket://hostname
+    socket://hostname:9100
+
+ +

See "Network +Printers" for the correct URI to use with your printer.

+ +
+ +
diff --git a/cups-templates-zh_CN/class-added.tmpl b/cups-templates-zh_CN/class-added.tmpl new file mode 100644 index 0000000..6afd302 --- /dev/null +++ b/cups-templates-zh_CN/class-added.tmpl @@ -0,0 +1,4 @@ +

Add Class

+ +

Class {printer_name} has been added +successfully. diff --git a/cups-templates-zh_CN/class-confirm.tmpl b/cups-templates-zh_CN/class-confirm.tmpl new file mode 100644 index 0000000..e564379 --- /dev/null +++ b/cups-templates-zh_CN/class-confirm.tmpl @@ -0,0 +1,6 @@ +

Delete Class {printer_name}

+ +

Warning: Are you sure you want to delete class +{printer_name}?

+ +

diff --git a/cups-templates-zh_CN/class-deleted.tmpl b/cups-templates-zh_CN/class-deleted.tmpl new file mode 100644 index 0000000..6c44468 --- /dev/null +++ b/cups-templates-zh_CN/class-deleted.tmpl @@ -0,0 +1,3 @@ +

Delete Class {printer_name}

+ +

Class {printer_name} has been deleted successfully. diff --git a/cups-templates-zh_CN/class-jobs-header.tmpl b/cups-templates-zh_CN/class-jobs-header.tmpl new file mode 100644 index 0000000..61e5151 --- /dev/null +++ b/cups-templates-zh_CN/class-jobs-header.tmpl @@ -0,0 +1 @@ +

Jobs

diff --git a/cups-templates-zh_CN/class-modified.tmpl b/cups-templates-zh_CN/class-modified.tmpl new file mode 100644 index 0000000..02b9895 --- /dev/null +++ b/cups-templates-zh_CN/class-modified.tmpl @@ -0,0 +1,4 @@ +

Modify Class {printer_name}

+ +

Class {printer_name} has been +modified successfully. diff --git a/cups-templates-zh_CN/class.tmpl b/cups-templates-zh_CN/class.tmpl new file mode 100644 index 0000000..630c342 --- /dev/null +++ b/cups-templates-zh_CN/class.tmpl @@ -0,0 +1,41 @@ +

{printer_name} +({printer_state=3?Idle:{printer_state=4?Processing:Paused}}, +{printer_is_accepting_jobs=0?Rejecting Jobs:Accepting Jobs}, +{server_is_sharing_printers=0?Not:{printer_is_shared=0?Not:}} Shared{default_name={printer_name}?, Server Default:})

+ +
+ + + +
+ +
+ + + + + +
+ + + + + + +
Description:{printer_info}
Location:{printer_location}
Members:{?member_uris=?None:{member_uris}}
Defaults:job-sheets={job_sheets_default} +media={media_default?{media_default}:unknown} +{sides_default?sides={sides_default}:}
diff --git a/cups-templates-zh_CN/classes-header.tmpl b/cups-templates-zh_CN/classes-header.tmpl new file mode 100644 index 0000000..0a2d839 --- /dev/null +++ b/cups-templates-zh_CN/classes-header.tmpl @@ -0,0 +1 @@ +

{total=0?没有打印机类:显示 {total} 个打印机类中的 {#printer_name} 个}。

diff --git a/cups-templates-zh_CN/classes.tmpl b/cups-templates-zh_CN/classes.tmpl new file mode 100644 index 0000000..8e76ad9 --- /dev/null +++ b/cups-templates-zh_CN/classes.tmpl @@ -0,0 +1,11 @@ +{#printer_name=0?: + + + + + +{[printer_name] + +} + +
队列名称描述位置成员状态
{printer_name}{printer_info}{printer_location}{?member_uris=?无:{member_uris}}{printer_state=3?空闲:{printer_state=4?处理中:已暂停}}{printer_state_message? - "{printer_state_message}":}
} diff --git a/cups-templates-zh_CN/command.tmpl b/cups-templates-zh_CN/command.tmpl new file mode 100644 index 0000000..a8dc6ff --- /dev/null +++ b/cups-templates-zh_CN/command.tmpl @@ -0,0 +1,8 @@ +

{title} On {printer_name}

+ +

{job_state>5?:Busy Indicator }Printer command job +{job_state=3?pending:{job_state=4?held: +{job_state=5?processing:{job_state=6?stopped: +{job_state=7?canceled:{job_state=8?aborted:completed}}}}}}{job_state=9?:{job_printer_state_message?, +"{job_printer_state_message}":}}

diff --git a/cups-templates-zh_CN/edit-config.tmpl b/cups-templates-zh_CN/edit-config.tmpl new file mode 100644 index 0000000..d8f9bb1 --- /dev/null +++ b/cups-templates-zh_CN/edit-config.tmpl @@ -0,0 +1,20 @@ + + +

Edit Configuration File

+ +
+ + + + + +

+

+ +
diff --git a/cups-templates-zh_CN/error-op.tmpl b/cups-templates-zh_CN/error-op.tmpl new file mode 100644 index 0000000..652537b --- /dev/null +++ b/cups-templates-zh_CN/error-op.tmpl @@ -0,0 +1,5 @@ +

{?title} {?printer_name} Error

+ +

Error:

+ +
Unknown operation "{op}"!
diff --git a/cups-templates-zh_CN/error.tmpl b/cups-templates-zh_CN/error.tmpl new file mode 100644 index 0000000..2ac1b8f --- /dev/null +++ b/cups-templates-zh_CN/error.tmpl @@ -0,0 +1,5 @@ +

{?title} {?printer_name} Error

+ +

{?message?{message}:Error}:

+ +
{error}
diff --git a/cups-templates-zh_CN/header.tmpl b/cups-templates-zh_CN/header.tmpl new file mode 100644 index 0000000..83c078b --- /dev/null +++ b/cups-templates-zh_CN/header.tmpl @@ -0,0 +1,40 @@ + + + + + + + + {refresh_page?:} + + + + + {title} - CUPS 打印管理 + + +
+ +
+
+
+

{title}

diff --git a/cups-templates-zh_CN/help-header.tmpl b/cups-templates-zh_CN/help-header.tmpl new file mode 100644 index 0000000..bda3e45 --- /dev/null +++ b/cups-templates-zh_CN/help-header.tmpl @@ -0,0 +1,41 @@ +
+{TOPIC?:} + +

Search in +{HELPTITLE?{HELPTITLE}:{TOPIC?{TOPIC}:All Documents}}: + +

+ +
+ + + + +{QUERY?

Search Results in {HELPFILE?{HELPTITLE}:{TOPIC?{TOPIC}:All Documents}}\:

+{QTEXT?:} +:

No matches found.

} +
:} +{HELPTITLE?
: + +

Online Help

+ +

This is the CUPS online help interface. Enter search words above or click on any of the documentation links to display online help information.

+ +

If you are new to CUPS, read the "Overview of CUPS" page.

+ +

The CUPS home page also provides many resources including user discussion forums, answers to frequently-asked questions, and a form for submitting bug reports and feature requests.

} diff --git a/cups-templates-zh_CN/help-printable.tmpl b/cups-templates-zh_CN/help-printable.tmpl new file mode 100644 index 0000000..2463c16 --- /dev/null +++ b/cups-templates-zh_CN/help-printable.tmpl @@ -0,0 +1,9 @@ + + + + + {HELPTITLE} + + + + diff --git a/cups-templates-zh_CN/help-trailer.tmpl b/cups-templates-zh_CN/help-trailer.tmpl new file mode 100644 index 0000000..e69de29 diff --git a/cups-templates-zh_CN/job-cancel.tmpl b/cups-templates-zh_CN/job-cancel.tmpl new file mode 100644 index 0000000..0b0106e --- /dev/null +++ b/cups-templates-zh_CN/job-cancel.tmpl @@ -0,0 +1,3 @@ +

Cancel Job {job_id}

+ +

Job {job_id} has been canceled. diff --git a/cups-templates-zh_CN/job-hold.tmpl b/cups-templates-zh_CN/job-hold.tmpl new file mode 100644 index 0000000..3b5cd6a --- /dev/null +++ b/cups-templates-zh_CN/job-hold.tmpl @@ -0,0 +1,3 @@ +

Hold Job {job_id}

+ +

Job {job_id} has been held from printing. diff --git a/cups-templates-zh_CN/job-move.tmpl b/cups-templates-zh_CN/job-move.tmpl new file mode 100644 index 0000000..c2f7046 --- /dev/null +++ b/cups-templates-zh_CN/job-move.tmpl @@ -0,0 +1,23 @@ +

+ + +{job_id?:} + +

{job_id?Move Job {job_id}:Move All Jobs}

+ + + + + + + + + + +
New Destination: + +
+ +
diff --git a/cups-templates-zh_CN/job-moved.tmpl b/cups-templates-zh_CN/job-moved.tmpl new file mode 100644 index 0000000..4893e24 --- /dev/null +++ b/cups-templates-zh_CN/job-moved.tmpl @@ -0,0 +1,4 @@ +

{job_id?Move Job {job_id}:Move All Jobs}

+ +

{job_id?Job {job_id}:All jobs} moved to +{job_printer_name}.

diff --git a/cups-templates-zh_CN/job-release.tmpl b/cups-templates-zh_CN/job-release.tmpl new file mode 100644 index 0000000..fe93793 --- /dev/null +++ b/cups-templates-zh_CN/job-release.tmpl @@ -0,0 +1,3 @@ +

Release Job {job_id}

+ +

Job {job_id} has been released for printing. diff --git a/cups-templates-zh_CN/job-restart.tmpl b/cups-templates-zh_CN/job-restart.tmpl new file mode 100644 index 0000000..b5dfd95 --- /dev/null +++ b/cups-templates-zh_CN/job-restart.tmpl @@ -0,0 +1,3 @@ +

Reprint Job {job_id}

+ +

Job {job_id} has been restarted. diff --git a/cups-templates-zh_CN/jobs-header.tmpl b/cups-templates-zh_CN/jobs-header.tmpl new file mode 100644 index 0000000..b143ba9 --- /dev/null +++ b/cups-templates-zh_CN/jobs-header.tmpl @@ -0,0 +1,5 @@ +{?which_jobs=?:

} +{?which_jobs=completed?:
} +{?which_jobs=all?:
} + +

{?which_jobs=?活动任务按处理顺序排列;挂起任务显示在前面。:{which_jobs=all?任务按顺序排列:已完成任务按完成顺序排列}}

diff --git a/cups-templates-zh_CN/jobs.tmpl b/cups-templates-zh_CN/jobs.tmpl new file mode 100644 index 0000000..ff3ad83 --- /dev/null +++ b/cups-templates-zh_CN/jobs.tmpl @@ -0,0 +1,36 @@ +{#job_id=0?: + + + + + +{[job_id] + + + + + + + + + +} + +
编号名称用户大小页数状态操作
{job_printer_name}-{job_id}{?phone? ({phone}):} {?job_name=?未知:{job_name}} {?job_originating_user_name=?未提供:{job_originating_user_name}} {job_k_octets}k {job_impressions_completed=0?未知:{?job_impressions_completed}} {job_state=3?等待中
{?time_at_creation=?未知:{time_at_creation}}:{job_state=4?已挂起
{?time_at_creation=?未知:{time_at_creation}}: +{job_state=5?处理中
{?time_at_processing=?未知:{time_at_processing}}:{job_state=6?已停止: +{job_state=7?已取消
{?time_at_completed=?未知:{time_at_completed}}:{job_state=8?已中止:已完成
{?time_at_completed=?未知:{time_at_completed}}}}}}}} {job_printer_state_message?
+"{job_printer_state_message}":}
+{job_preserved>0?{job_state>5? +
:}:} +{job_state=4?{job_hold_until=auth-info-required?需要认证: +
+
:}:} +{job_state=3? +
+
:} +{job_state<7? +
+
+
:} + 
+} diff --git a/cups-templates-zh_CN/list-available-printers.tmpl b/cups-templates-zh_CN/list-available-printers.tmpl new file mode 100644 index 0000000..9fe7b12 --- /dev/null +++ b/cups-templates-zh_CN/list-available-printers.tmpl @@ -0,0 +1,7 @@ +

Available Printers

+ +{#device_uri=0?

No printers found.

+:} diff --git a/cups-templates-zh_CN/modify-class.tmpl b/cups-templates-zh_CN/modify-class.tmpl new file mode 100644 index 0000000..1aa4fe6 --- /dev/null +++ b/cups-templates-zh_CN/modify-class.tmpl @@ -0,0 +1,31 @@ +

Modify Class {printer_name}

+ +
+ + + + + + + + + + + + + + + + + + + + + +
Description:
Location:
Members: + +
+ +
diff --git a/cups-templates-zh_CN/modify-printer.tmpl b/cups-templates-zh_CN/modify-printer.tmpl new file mode 100644 index 0000000..1aed9f3 --- /dev/null +++ b/cups-templates-zh_CN/modify-printer.tmpl @@ -0,0 +1,39 @@ +

Modify {printer_name}

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Description:
+(Human-readable description such as "HP LaserJet with Duplexer")
Location:
+(Human-readable location such as "Lab 1")
Connection:{device_uri}
Sharing: +
+ +
diff --git a/cups-templates-zh_CN/norestart.tmpl b/cups-templates-zh_CN/norestart.tmpl new file mode 100644 index 0000000..70bf3d3 --- /dev/null +++ b/cups-templates-zh_CN/norestart.tmpl @@ -0,0 +1,4 @@ +

Change Settings

+ +

The server was not restarted because no changes were made to +the configuration...

diff --git a/cups-templates-zh_CN/option-boolean.tmpl b/cups-templates-zh_CN/option-boolean.tmpl new file mode 100644 index 0000000..ce9b6af --- /dev/null +++ b/cups-templates-zh_CN/option-boolean.tmpl @@ -0,0 +1,6 @@ + +{keytext}: + +{[choices]} + + diff --git a/cups-templates-zh_CN/option-conflict.tmpl b/cups-templates-zh_CN/option-conflict.tmpl new file mode 100644 index 0000000..3772295 --- /dev/null +++ b/cups-templates-zh_CN/option-conflict.tmpl @@ -0,0 +1,7 @@ +

Error: The following options are conflicting:

+ + + +

Please change one or more of the options to resolve the conflicts.

diff --git a/cups-templates-zh_CN/option-header.tmpl b/cups-templates-zh_CN/option-header.tmpl new file mode 100644 index 0000000..464726a --- /dev/null +++ b/cups-templates-zh_CN/option-header.tmpl @@ -0,0 +1,5 @@ +
+ +

{group}

+ + diff --git a/cups-templates-zh_CN/option-pickmany.tmpl b/cups-templates-zh_CN/option-pickmany.tmpl new file mode 100644 index 0000000..0da75e5 --- /dev/null +++ b/cups-templates-zh_CN/option-pickmany.tmpl @@ -0,0 +1,6 @@ + + + + diff --git a/cups-templates-zh_CN/option-pickone.tmpl b/cups-templates-zh_CN/option-pickone.tmpl new file mode 100644 index 0000000..890ef4e --- /dev/null +++ b/cups-templates-zh_CN/option-pickone.tmpl @@ -0,0 +1,18 @@ + + +:} + diff --git a/cups-templates-zh_CN/option-trailer.tmpl b/cups-templates-zh_CN/option-trailer.tmpl new file mode 100644 index 0000000..17c9281 --- /dev/null +++ b/cups-templates-zh_CN/option-trailer.tmpl @@ -0,0 +1,5 @@ +
{keytext}:
{keytext}: +{iscustom=1?{[params] + + +}
{paramtext}:{params=Units?:}
+
+ +

+ +
\ No newline at end of file diff --git a/cups-templates-zh_CN/pager.tmpl b/cups-templates-zh_CN/pager.tmpl new file mode 100644 index 0000000..76e0167 --- /dev/null +++ b/cups-templates-zh_CN/pager.tmpl @@ -0,0 +1,7 @@ + + + + + +
{PREV?{PREV>0?
:}
: }
{NEXT?
: } + {LAST?
:}
diff --git a/cups-templates-zh_CN/printer-accept.tmpl b/cups-templates-zh_CN/printer-accept.tmpl new file mode 100644 index 0000000..db5d8da --- /dev/null +++ b/cups-templates-zh_CN/printer-accept.tmpl @@ -0,0 +1,5 @@ +

Accept Jobs On {is_class?Class:Printer} {printer_name}

+ +

{is_class?Class:Printer} {printer_name} +is now accepting jobs.

diff --git a/cups-templates-zh_CN/printer-added.tmpl b/cups-templates-zh_CN/printer-added.tmpl new file mode 100644 index 0000000..9ebc835 --- /dev/null +++ b/cups-templates-zh_CN/printer-added.tmpl @@ -0,0 +1,15 @@ +

Add Printer {printer_name}

+ +

Printer {printer_name} has been added +successfully. + +

+Note:Printer drivers and raw queues are deprecated and will stop working in a future version of CUPS. +
+ +
+ + + + +
diff --git a/cups-templates-zh_CN/printer-cancel-jobs.tmpl b/cups-templates-zh_CN/printer-cancel-jobs.tmpl new file mode 100644 index 0000000..4376646 --- /dev/null +++ b/cups-templates-zh_CN/printer-cancel-jobs.tmpl @@ -0,0 +1,5 @@ +

Cancel Jobs On {is_class?Class:Printer} {printer_name}

+ +

All jobs on {is_class?class:printer} {printer_name} +have been canceled.

diff --git a/cups-templates-zh_CN/printer-configured.tmpl b/cups-templates-zh_CN/printer-configured.tmpl new file mode 100644 index 0000000..7bce3f9 --- /dev/null +++ b/cups-templates-zh_CN/printer-configured.tmpl @@ -0,0 +1,4 @@ +

Set Default Options for {printer_name}

+ +

{OP=set-class-options?Class :Printer }{printer_name} +default options have been set successfully. diff --git a/cups-templates-zh_CN/printer-confirm.tmpl b/cups-templates-zh_CN/printer-confirm.tmpl new file mode 100644 index 0000000..c1b2b17 --- /dev/null +++ b/cups-templates-zh_CN/printer-confirm.tmpl @@ -0,0 +1,6 @@ +

Delete Printer {printer_name}

+ +

Warning: Are you sure you want to delete printer +{printer_name}?

+ +

diff --git a/cups-templates-zh_CN/printer-default.tmpl b/cups-templates-zh_CN/printer-default.tmpl new file mode 100644 index 0000000..af21dca --- /dev/null +++ b/cups-templates-zh_CN/printer-default.tmpl @@ -0,0 +1,9 @@ +

Set {is_class?Class:Printer} {printer_name} As Default

+ +

{is_class?Class:Printer} {printer_name} +has been made the default printer on the server.

+ +
Note: Any user default that has been set via +the lpoptions command will override this default +setting.
diff --git a/cups-templates-zh_CN/printer-deleted.tmpl b/cups-templates-zh_CN/printer-deleted.tmpl new file mode 100644 index 0000000..ea462ce --- /dev/null +++ b/cups-templates-zh_CN/printer-deleted.tmpl @@ -0,0 +1,3 @@ +

Delete Printer {printer_name}

+ +

Printer {printer_name} has been deleted successfully. diff --git a/cups-templates-zh_CN/printer-jobs-header.tmpl b/cups-templates-zh_CN/printer-jobs-header.tmpl new file mode 100644 index 0000000..61e5151 --- /dev/null +++ b/cups-templates-zh_CN/printer-jobs-header.tmpl @@ -0,0 +1 @@ +

Jobs

diff --git a/cups-templates-zh_CN/printer-modified.tmpl b/cups-templates-zh_CN/printer-modified.tmpl new file mode 100644 index 0000000..1193a48 --- /dev/null +++ b/cups-templates-zh_CN/printer-modified.tmpl @@ -0,0 +1,4 @@ +

Modify Printer {printer_name}

+ +

Printer {printer_name} has been +modified successfully. diff --git a/cups-templates-zh_CN/printer-reject.tmpl b/cups-templates-zh_CN/printer-reject.tmpl new file mode 100644 index 0000000..823c7e5 --- /dev/null +++ b/cups-templates-zh_CN/printer-reject.tmpl @@ -0,0 +1,5 @@ +

Reject Jobs On {is_class?Class:Printer} {printer_name}

+ +

{is_class?Class:Printer} {printer_name} +is no longer accepting jobs.

diff --git a/cups-templates-zh_CN/printer-start.tmpl b/cups-templates-zh_CN/printer-start.tmpl new file mode 100644 index 0000000..76d44ed --- /dev/null +++ b/cups-templates-zh_CN/printer-start.tmpl @@ -0,0 +1,5 @@ +

Resume {is_class?Class:Printer} {printer_name}

+ +

{is_class?Class:Printer} {printer_name} +has been resumed.

diff --git a/cups-templates-zh_CN/printer-stop.tmpl b/cups-templates-zh_CN/printer-stop.tmpl new file mode 100644 index 0000000..8c264b2 --- /dev/null +++ b/cups-templates-zh_CN/printer-stop.tmpl @@ -0,0 +1,5 @@ +

Pause {is_class?Class:Printer} {printer_name}

+ +

{is_class?Class:Printer} {printer_name} +has been paused.

diff --git a/cups-templates-zh_CN/printer.tmpl b/cups-templates-zh_CN/printer.tmpl new file mode 100644 index 0000000..6bfac81 --- /dev/null +++ b/cups-templates-zh_CN/printer.tmpl @@ -0,0 +1,43 @@ +

{printer_name} +({printer_state=3?空闲:{printer_state=4?处理中:已暂停}}, +{printer_is_accepting_jobs=0?拒绝任务:接受任务}, +{server_is_sharing_printers=0?未:{printer_is_shared=0?未:}}共享{default_name={printer_name}?, 服务器默认:})

+ +
+ + + +
+ +
+ + + + +
+ + + + + + +
描述:{printer_info}
位置:{printer_location}
驱动:{printer_make_and_model} ({color_supported=1?彩色:灰度}{sides_supported=one-sided?:, 双面打印})
+
连接:{device_uri}
默认设置:job-sheets={job_sheets_default} +media={media_default?{media_default}:未知} +{sides_default?sides={sides_default}:}
diff --git a/cups-templates-zh_CN/printers-header.tmpl b/cups-templates-zh_CN/printers-header.tmpl new file mode 100644 index 0000000..2392736 --- /dev/null +++ b/cups-templates-zh_CN/printers-header.tmpl @@ -0,0 +1 @@ +

{total=0?没有打印机:显示 {total} 台打印机中的 {#printer_name} 台}。

diff --git a/cups-templates-zh_CN/printers.tmpl b/cups-templates-zh_CN/printers.tmpl new file mode 100644 index 0000000..db9d035 --- /dev/null +++ b/cups-templates-zh_CN/printers.tmpl @@ -0,0 +1,11 @@ +{#printer_name=0?: + + + + + +{[printer_name] + +} + +
队列名称描述位置品牌型号状态
{printer_name}{printer_info}{printer_location}{printer_make_and_model}{printer_state=3?空闲:{printer_state=4?处理中:已暂停}}{printer_state_message? - "{printer_state_message}":}
} diff --git a/cups-templates-zh_CN/restart.tmpl b/cups-templates-zh_CN/restart.tmpl new file mode 100644 index 0000000..47d39d0 --- /dev/null +++ b/cups-templates-zh_CN/restart.tmpl @@ -0,0 +1,4 @@ +

Change Settings

+ +

Please stand by while the server restarts...

diff --git a/cups-templates-zh_CN/search.tmpl b/cups-templates-zh_CN/search.tmpl new file mode 100644 index 0000000..4db967c --- /dev/null +++ b/cups-templates-zh_CN/search.tmpl @@ -0,0 +1,10 @@ +
+{WHICH_JOBS?:} +{ORDER?:} + +

在 +{SEARCH_DEST?{SEARCH_DEST}:{SECTION=classes?打印机类:{SECTION=jobs?任务:打印机}}} 中搜索: +

+ +
diff --git a/cups-templates-zh_CN/set-printer-options-header.tmpl b/cups-templates-zh_CN/set-printer-options-header.tmpl new file mode 100644 index 0000000..91e0981 --- /dev/null +++ b/cups-templates-zh_CN/set-printer-options-header.tmpl @@ -0,0 +1,24 @@ +

Set Default Options for {printer_name}

+ +
+ + + +{HAVE_AUTOCONFIGURE?:} + + + +

{[group_id] +{group}     }

+ +
diff --git a/cups-templates-zh_CN/set-printer-options-trailer.tmpl b/cups-templates-zh_CN/set-printer-options-trailer.tmpl new file mode 100644 index 0000000..b92988a --- /dev/null +++ b/cups-templates-zh_CN/set-printer-options-trailer.tmpl @@ -0,0 +1,14 @@ +
+ + +
diff --git a/cups-templates-zh_CN/test-page.tmpl b/cups-templates-zh_CN/test-page.tmpl new file mode 100644 index 0000000..44a74f2 --- /dev/null +++ b/cups-templates-zh_CN/test-page.tmpl @@ -0,0 +1,4 @@ +

Print Test Page On {printer_name}

+ +

Test page sent; job ID is +{printer_name}-{job_id}.

diff --git a/cups-templates-zh_CN/trailer.tmpl b/cups-templates-zh_CN/trailer.tmpl new file mode 100644 index 0000000..8f2efa8 --- /dev/null +++ b/cups-templates-zh_CN/trailer.tmpl @@ -0,0 +1,5 @@ +
+ + + + diff --git a/cups-templates-zh_CN/users.tmpl b/cups-templates-zh_CN/users.tmpl new file mode 100644 index 0000000..a97b313 --- /dev/null +++ b/cups-templates-zh_CN/users.tmpl @@ -0,0 +1,27 @@ +
+ + + +{IS_CLASS?:} + +

Allowed Users For {printer_name}

+ + + + + + + + + + +
Users: + +
+ + +
+ +
+ +
diff --git a/setup_cups.sh b/setup_cups.sh new file mode 100755 index 0000000..f592dd8 --- /dev/null +++ b/setup_cups.sh @@ -0,0 +1,439 @@ +#!/bin/bash +# +# CUPS 打印服务一键配置脚本 +# 适用于 Armbian / Debian / Ubuntu +# 作者: 自动生成 +# 用法: chmod +x setup_cups.sh && ./setup_cups.sh +# + +set -e + +# 颜色定义 +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +# 打印带颜色的信息 +info() { echo -e "${BLUE}[信息]${NC} $1"; } +success() { echo -e "${GREEN}[成功]${NC} $1"; } +warn() { echo -e "${YELLOW}[警告]${NC} $1"; } +error() { echo -e "${RED}[错误]${NC} $1"; exit 1; } + +# 检查是否为root用户 +check_root() { + if [ "$(id -u)" != "0" ]; then + error "请使用 root 用户运行此脚本,或使用 sudo" + fi +} + +# 检测系统版本和架构 +detect_os() { + if [ -f /etc/os-release ]; then + . /etc/os-release + OS_ID=$ID + OS_VERSION=$VERSION_CODENAME + else + OS_ID="unknown" + OS_VERSION="unknown" + fi + + # 检测CPU架构 + ARCH=$(uname -m) + case $ARCH in + x86_64|amd64) + ARCH_TYPE="amd64" + ;; + aarch64|arm64) + ARCH_TYPE="arm64" + ;; + armv7l|armhf) + ARCH_TYPE="armhf" + ;; + *) + ARCH_TYPE="unknown" + ;; + esac +} + +# 更换为国内源 +change_to_china_mirror() { + info "检测当前软件源..." + + detect_os + + # 检查源是否正确 + local need_change=0 + + if [ "$OS_ID" = "ubuntu" ]; then + if [ "$ARCH_TYPE" = "amd64" ]; then + # x86_64 不应该用 ubuntu-ports + if grep -q "ubuntu-ports" /etc/apt/sources.list 2>/dev/null; then + warn "检测到错误的源配置 (ubuntu-ports 用于 ARM,当前是 x86_64)" + need_change=1 + elif grep -q "mirrors.tuna.tsinghua.edu.cn/ubuntu\|mirrors.aliyun.com/ubuntu\|mirrors.ustc.edu.cn/ubuntu" /etc/apt/sources.list 2>/dev/null; then + success "当前已是正确的国内源,跳过换源" + return 0 + else + need_change=1 + fi + else + # ARM 应该用 ubuntu-ports + if grep -q "mirrors.tuna.tsinghua.edu.cn/ubuntu-ports\|mirrors.aliyun.com/ubuntu-ports" /etc/apt/sources.list 2>/dev/null; then + success "当前已是正确的国内源,跳过换源" + return 0 + else + need_change=1 + fi + fi + elif [ "$OS_ID" = "debian" ]; then + if grep -q "mirrors.tuna.tsinghua.edu.cn/debian\|mirrors.aliyun.com/debian\|mirrors.ustc.edu.cn/debian" /etc/apt/sources.list 2>/dev/null; then + success "当前已是正确的国内源,跳过换源" + return 0 + else + need_change=1 + fi + else + need_change=1 + fi + + if [ "$need_change" = "0" ]; then + return 0 + fi + + # 备份原有源 + if [ -f /etc/apt/sources.list ]; then + cp /etc/apt/sources.list /etc/apt/sources.list.bak + info "已备份原有源到 /etc/apt/sources.list.bak" + fi + + # 根据系统类型选择源 + case $OS_ID in + debian) + info "检测到 Debian 系统 ($OS_VERSION),更换为清华源..." + cat > /etc/apt/sources.list << EOF +# 清华大学 Debian 镜像源 +deb https://mirrors.tuna.tsinghua.edu.cn/debian/ $OS_VERSION main contrib non-free non-free-firmware +deb https://mirrors.tuna.tsinghua.edu.cn/debian/ $OS_VERSION-updates main contrib non-free non-free-firmware +deb https://mirrors.tuna.tsinghua.edu.cn/debian/ $OS_VERSION-backports main contrib non-free non-free-firmware +deb https://mirrors.tuna.tsinghua.edu.cn/debian-security $OS_VERSION-security main contrib non-free non-free-firmware +EOF + ;; + ubuntu) + # 根据架构选择正确的源 + if [ "$ARCH_TYPE" = "amd64" ]; then + UBUNTU_MIRROR="mirrors.tuna.tsinghua.edu.cn/ubuntu" + info "检测到 Ubuntu 系统 ($OS_VERSION) [x86_64],更换为清华源..." + else + UBUNTU_MIRROR="mirrors.tuna.tsinghua.edu.cn/ubuntu-ports" + info "检测到 Ubuntu 系统 ($OS_VERSION) [ARM],更换为清华源..." + fi + cat > /etc/apt/sources.list << EOF +# 清华大学 Ubuntu 镜像源 +deb https://$UBUNTU_MIRROR/ $OS_VERSION main restricted universe multiverse +deb https://$UBUNTU_MIRROR/ $OS_VERSION-updates main restricted universe multiverse +deb https://$UBUNTU_MIRROR/ $OS_VERSION-backports main restricted universe multiverse +deb https://$UBUNTU_MIRROR/ $OS_VERSION-security main restricted universe multiverse +EOF + ;; + *) + warn "未识别的系统类型: $OS_ID,跳过换源" + return 1 + ;; + esac + + # 处理 Armbian 源 + if [ -f /etc/apt/sources.list.d/armbian.list ]; then + if ! grep -q "mirrors.tuna.tsinghua.edu.cn" /etc/apt/sources.list.d/armbian.list; then + cp /etc/apt/sources.list.d/armbian.list /etc/apt/sources.list.d/armbian.list.bak + sed -i 's|apt.armbian.com|mirrors.tuna.tsinghua.edu.cn/armbian|g' /etc/apt/sources.list.d/armbian.list + info "Armbian 源已更换为清华镜像" + fi + fi + + success "软件源已更换为国内镜像(清华大学)" +} + +# 获取本机IP地址 +get_ip() { + ip addr show | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | grep -v '127.0.0.1' | head -n1 +} + +# 显示欢迎信息 +show_banner() { + clear + echo -e "${GREEN}" + echo "╔══════════════════════════════════════════════════════════╗" + echo "║ CUPS 打印服务一键配置脚本 ║" + echo "║ 适用于 Armbian / Debian / Ubuntu ║" + echo "╚══════════════════════════════════════════════════════════╝" + echo -e "${NC}" + echo "" +} + +# 选择打印机驱动 +select_drivers() { + echo -e "${YELLOW}请选择要安装的打印机驱动 (可多选,用空格或逗号分隔):${NC}" + echo "" + echo " 1) 通用驱动 (推荐,支持大多数打印机)" + echo " 2) HP 打印机 (hplip)" + echo " 3) 爱普生 (gutenprint)" + echo " 4) 兄弟 (brlaser)" + echo " 5) 全部安装" + echo " 0) 仅安装CUPS (不安装额外驱动)" + echo "" + echo -e " ${BLUE}示例: 1 2 或 1,2 表示同时安装通用驱动和HP驱动${NC}" + echo "" + read -p "请输入选项 (默认: 1): " driver_choice + driver_choice=${driver_choice:-1} + # 统一分隔符 + driver_choice=$(echo "$driver_choice" | tr ',' ' ') +} + +# 安装驱动 +install_drivers() { + local packages="" + + for choice in $driver_choice; do + case $choice in + 1) + info "添加通用驱动..." + packages="$packages printer-driver-all" + ;; + 2) + info "添加 HP 驱动..." + packages="$packages hplip" + ;; + 3) + info "添加爱普生驱动..." + packages="$packages printer-driver-gutenprint" + ;; + 4) + info "添加兄弟驱动..." + packages="$packages printer-driver-brlaser" + ;; + 5) + info "添加全部驱动..." + packages="printer-driver-all hplip printer-driver-gutenprint printer-driver-brlaser" + break + ;; + 0) + info "跳过驱动安装" + return 0 + ;; + esac + done + + if [ -n "$packages" ]; then + info "正在安装驱动: $packages" + apt install -y $packages + fi +} + +# 配置CUPS +configure_cups() { + info "配置 CUPS 允许远程访问..." + + # 备份原配置 + cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.bak + + # 修改监听地址 + sed -i 's/^Listen localhost:631$/Listen 0.0.0.0:631/' /etc/cups/cupsd.conf + + # 如果没有找到 Listen localhost:631,则添加 + if ! grep -q "Listen 0.0.0.0:631" /etc/cups/cupsd.conf; then + sed -i '/^Listen/d' /etc/cups/cupsd.conf + sed -i '1a Listen 0.0.0.0:631\nListen /run/cups/cups.sock' /etc/cups/cupsd.conf + fi + + # 启用网络浏览 + if grep -q "^Browsing" /etc/cups/cupsd.conf; then + sed -i 's/^Browsing.*/Browsing Yes/' /etc/cups/cupsd.conf + else + echo "Browsing Yes" >> /etc/cups/cupsd.conf + fi + + # 配置访问权限 - 允许所有网络访问 + # 先删除现有的 Location 块,然后重新添加 + cat > /tmp/cups_locations.conf << 'EOF' + +# 允许所有网络访问(内网环境使用) + + Order allow,deny + Allow all + + + + Order allow,deny + Allow all + + + + AuthType Default + Require user @SYSTEM + Order allow,deny + Allow all + +EOF + + # 移除旧的 Location 块 + sed -i '//d' /etc/cups/cupsd.conf + + # 添加新的 Location 配置 + cat /tmp/cups_locations.conf >> /etc/cups/cupsd.conf + rm /tmp/cups_locations.conf + + success "CUPS 配置完成" +} + +# 主函数 +main() { + show_banner + check_root + + LOCAL_IP=$(get_ip) + info "检测到本机IP: ${LOCAL_IP}" + echo "" + + # 选择驱动 + select_drivers + echo "" + + # 询问是否换源 + echo -e "${YELLOW}是否将软件源更换为国内镜像(清华大学)?${NC}" + echo " 推荐:国内用户选择 Y,可大幅加快下载速度" + echo "" + read -p "更换国内源? [Y/n]: " change_mirror + change_mirror=${change_mirror:-Y} + echo "" + + # 确认安装 + echo -e "${YELLOW}即将执行以下操作:${NC}" + if [[ "$change_mirror" =~ ^[Yy]$ ]]; then + echo " 1. 更换为国内软件源(清华大学)" + echo " 2. 更新系统软件源" + else + echo " 1. 更新系统软件源" + fi + echo " 3. 安装 CUPS 和 Avahi" + echo " 4. 安装打印机驱动" + echo " 5. 配置 CUPS 允许局域网访问" + echo " 6. 将当前用户添加到 lpadmin 组" + echo " 7. 启动并设置开机自启" + echo "" + read -p "是否继续? [Y/n]: " confirm + confirm=${confirm:-Y} + + if [[ ! "$confirm" =~ ^[Yy]$ ]]; then + echo "已取消" + exit 0 + fi + + echo "" + info "开始安装..." + echo "" + + # 1. 换源(如果选择) + if [[ "$change_mirror" =~ ^[Yy]$ ]]; then + change_to_china_mirror + fi + + # 2. 更新系统 + info "更新软件源..." + apt update + success "软件源更新完成" + + # 2. 安装 CUPS 和 Avahi + info "安装 CUPS 和 Avahi..." + apt install -y cups avahi-daemon + success "CUPS 和 Avahi 安装完成" + + # 3. 安装中文语言包(CUPS汉化) + info "安装中文语言包..." + apt install -y locales language-pack-zh-hans 2>/dev/null || apt install -y locales 2>/dev/null + # 生成中文 locale + sed -i 's/# zh_CN.UTF-8 UTF-8/zh_CN.UTF-8 UTF-8/' /etc/locale.gen 2>/dev/null + locale-gen zh_CN.UTF-8 2>/dev/null + # 设置 CUPS 默认语言为中文 + if ! grep -q "DefaultLanguage" /etc/cups/cupsd.conf 2>/dev/null; then + echo 'DefaultLanguage zh_CN.UTF-8' >> /etc/cups/cupsd.conf + fi + + # 安装中文 Web 界面模板 + SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" + if [ -d "$SCRIPT_DIR/cups-templates-zh_CN" ]; then + info "安装 CUPS 中文界面模板..." + mkdir -p /usr/share/cups/templates-zh_CN + cp -f "$SCRIPT_DIR/cups-templates-zh_CN/"*.tmpl /usr/share/cups/templates-zh_CN/ + success "中文界面模板安装完成" + else + warn "未找到中文模板目录 (cups-templates-zh_CN),跳过界面汉化" + fi + success "中文语言包安装完成" + + # 3. 安装驱动 + install_drivers + success "驱动安装完成" + + # 4. 配置 CUPS + configure_cups + + # 5. 添加用户到 lpadmin 组 + info "将 root 用户添加到 lpadmin 组..." + usermod -aG lpadmin root + + # 如果有其他用户,也添加 + CURRENT_USER=$(logname 2>/dev/null || echo "") + if [ -n "$CURRENT_USER" ] && [ "$CURRENT_USER" != "root" ]; then + usermod -aG lpadmin "$CURRENT_USER" + info "将 $CURRENT_USER 用户添加到 lpadmin 组" + fi + success "用户组配置完成" + + # 6. 启动服务 + info "启动 CUPS 服务..." + systemctl restart cups + systemctl enable cups + success "CUPS 服务已启动并设置开机自启" + + info "启动 Avahi 服务..." + systemctl restart avahi-daemon + systemctl enable avahi-daemon + success "Avahi 服务已启动并设置开机自启" + + # 完成提示 + echo "" + echo -e "${GREEN}╔══════════════════════════════════════════════════════════╗${NC}" + echo -e "${GREEN}║ 安装完成! ║${NC}" + echo -e "${GREEN}╚══════════════════════════════════════════════════════════╝${NC}" + echo "" + echo -e " ${BLUE}CUPS 管理界面:${NC} https://${LOCAL_IP}:631" + echo -e " ${BLUE}用户名:${NC} root" + echo -e " ${BLUE}密码:${NC} 你的 SSH 密码" + echo "" + echo -e " ${YELLOW}下一步:${NC}" + echo " 1. 用浏览器打开上面的地址" + echo " 2. 点击 Administration → Add Printer" + echo " 3. 选择你的 USB 打印机" + echo " 4. 勾选 Share This Printer" + echo "" + echo -e " ${YELLOW}客户端连接:${NC}" + echo " - Windows: 设置 → 打印机 → 添加打印机" + echo " - macOS/iOS: 自动通过 AirPrint 发现" + echo " - Android: 安装 Mopria Print Service" + echo "" + + # 检查打印机 + echo -e "${BLUE}[检测]${NC} 正在检测 USB 打印机..." + if lsusb | grep -i -E "printer|print" > /dev/null 2>&1; then + success "检测到 USB 打印机:" + lsusb | grep -i -E "printer|print" + else + warn "未检测到 USB 打印机,请确认打印机已连接" + fi + echo "" +} + +# 运行主函数 +main diff --git a/刷机教程.md b/刷机教程.md new file mode 100644 index 0000000..1dcaaa1 --- /dev/null +++ b/刷机教程.md @@ -0,0 +1,415 @@ +# 中兴B863AV3.2-M 刷 Armbian + CUPS打印服务 完整教程 + +## 风险警告 + +> **刷机前请务必阅读** +> - 刷机会**清除原有系统**,无法恢复运营商IPTV功能 +> - 操作失败可能导致**变砖**,需要TTL救砖 +> - 建议有一定Linux基础再操作 +> - 请确保有备用设备,刷机过程中断电可能导致不可逆损坏 + +--- + +## 目录 + +1. [设备信息](#设备信息) +2. [第一部分:刷机准备](#第一部分刷机准备) +3. [第二部分:刷机步骤](#第二部分刷机步骤) +4. [第三部分:系统初始化](#第三部分系统初始化) +5. [第四部分:安装CUPS打印服务](#第四部分安装cups打印服务) +6. [第五部分:客户端连接](#第五部分客户端连接) +7. [常见问题排查](#常见问题排查) +8. [参考资料](#参考资料) + +--- + +## 设备信息 + +| 项目 | 信息 | +|------|------| +| 型号 | 中兴 B863AV3.2-M | +| 芯片 | 晶晨 S905L3A | +| 设备树 | `meson-g12a-s905l3a-m401a.dtb` (编号306) | + +> **注意**: B863AV3.2-M有两种主控版本,本教程仅适用于**S905L3A**版本。刷机前请确认芯片型号。 + +--- + +## 第一部分:刷机准备 + +### 1.1 所需工具 + +| 工具 | 说明 | +|------|------| +| 公对公USB线 | 连接盒子与电脑 | +| U盘 x2 | 8G以上,建议有一个USB2.0的 | +| HDMI短接器(可选) | 替代手动短接 | +| 镊子/导线 | 用于短接 | +| 刷机软件 | USB Burning Tool v2.2.0 | +| 写盘工具 | Rufus 或 balenaEtcher | + +### 1.2 下载资源 + +**1. Armbian镜像** + +从 https://github.com/ophub/amlogic-s9xxx-armbian/releases 下载 +- 选择带 `s905l3a` 或 `s905l3-cm211` 字样的镜像 +- 推荐 Debian Bookworm server 版本 + +**2. 安卓底包**(可选) + +用于恢复或开启ADB,建议从网盘或论坛获取对应型号的底包 + +--- + +## 第二部分:刷机步骤 + +### 2.1 拆机找短接点 + +1. 拧开机器背面两颗螺丝(在防滑垫下) +2. 用拆机片从后面划开取出主板 +3. 找到短接点 **C79A8** + +> **提示**: 如果有HDMI短接神器,可以跳过拆机,直接插HDMI口 + + + +### 2.2 线刷安卓底包(可选但推荐) + +1. 打开 USB Burning Tool +2. 导入安卓刷机包 +3. 勾选「擦除Flash」和「擦除Bootloader」 +4. **用镊子短接 C79A8,不要松手** +5. 插入双公头USB线到盒子**靠近网口**的USB口 +6. 接通盒子电源 +7. 软件显示连接成功后松开短接 +8. 等待刷机完成(约3-5分钟) + +### 2.3 开启ADB + +刷入安卓底包后,需要开启ADB才能从U盘启动Armbian。 + +**方式一:二维码验证** + +1. 进入 设置 → 关于 → 连续点击「版本号」7次 +2. 返回设置,进入「开发者选项」 +3. 出现二维码验证,使用「中兴STB工具」扫描 +4. 输入工具返回的验证码 +5. 开启「USB调试」和「网络ADB调试」 + +**方式二:随机码验证** + +1. 进入 设置 → 高级设置 +2. 记录屏幕上显示的随机码 +3. 使用「算号器」计算开发者密码 +4. 输入密码进入开发者选项 +5. 开启「USB调试」和「网络ADB调试」 + +> **验证ADB是否开启**: 在同一局域网的电脑上执行 `adb connect 盒子IP`,返回 `connected` 表示成功 + +### 2.4 制作Armbian启动U盘 + +1. 使用 Rufus 将 Armbian 镜像写入U盘(选择DD模式) +2. 写入完成后,打开U盘根目录 +3. 编辑 `uEnv.txt` 文件 +4. 找到 `FDT=` 行,修改为: + ``` + FDT=/dtb/amlogic/meson-g12a-s905l3a-m401a.dtb + ``` +5. 保存并安全弹出U盘 + +### 2.5 从U盘启动Armbian + +将U盘插入盒子**靠近网口**的USB接口,然后在电脑上执行: + +```bash +adb connect 192.168.x.x # 替换为盒子IP +adb shell reboot update # 重启进入U盘系统 +``` + +> **提示**: 如果无法启动,尝试换一个USB2.0的U盘 + +### 2.6 写入eMMC + +成功从U盘启动后,通过SSH登录Armbian: + +- 默认用户: `root` +- 默认密码: `1234` + +执行安装命令: + +```bash +armbian-install +``` + +按提示操作: +1. 选择 **306: M401A,UNT403A,B863AV3.2-M** +2. 文件系统选择 **ext4** +3. 等待写入完成,根据提示拔掉U盘并重启 + +**如果写入失败**,尝试以下步骤: + +```bash +# 清除分区表 +dd if=/dev/zero of=/dev/mmcblk2 bs=4096 count=4 + +# 重新安装 +armbian-install -m yes +``` + +--- + +## 第三部分:系统初始化 + +### 3.1 首次登录设置 + +从eMMC启动后,首次登录会提示: +1. 修改root密码 +2. 创建普通用户(可跳过) +3. 选择默认Shell + +### 3.2 网络配置 + +**设置静态IP(推荐用于服务器场景)** + +```bash +# 使用图形界面配置 +nmtui +``` + +或手动编辑配置: + +```bash +nano /etc/network/interfaces +``` + +### 3.3 基础优化 + +```bash +# 设置时区 +timedatectl set-timezone Asia/Shanghai + +# 更新系统 +apt update && apt upgrade -y + +# 减少swap使用,延长eMMC寿命 +echo 'vm.swappiness=10' >> /etc/sysctl.conf +sysctl -p +``` + +--- + +## 第四部分:安装CUPS打印服务 + +### 一键安装(推荐) + +提供一键脚本,自动完成 CUPS 安装和配置: + +```bash +# 下载并运行一键脚本 +wget -O setup_cups.sh https://你的地址/setup_cups.sh +chmod +x setup_cups.sh +./setup_cups.sh +``` + +或者如果脚本已在本地: + +```bash +chmod +x setup_cups.sh +./setup_cups.sh +``` + +脚本功能: +- 自动安装 CUPS 和 Avahi +- 交互式选择打印机驱动 +- 自动配置局域网访问权限 +- 自动启动服务并设置开机自启 +- 检测 USB 打印机连接状态 + +> 如果想手动安装,请继续阅读以下步骤。 + +--- + +### 4.1 安装CUPS和依赖(手动) + +```bash +apt update && apt upgrade -y +apt install cups avahi-daemon -y +``` + +### 4.2 安装打印机驱动 + +根据打印机品牌选择安装: + +```bash +# HP打印机 +apt install hplip -y + +# 爱普生 +apt install printer-driver-gutenprint -y + +# 兄弟 +apt install printer-driver-brlaser -y + +# 通用驱动(推荐都装) +apt install printer-driver-all -y +``` + +### 4.3 配置CUPS允许远程访问 + +```bash +nano /etc/cups/cupsd.conf +``` + +修改以下内容: + +```conf +# 修改监听地址(允许所有IP访问) +Listen 0.0.0.0:631 +Listen /run/cups/cups.sock + +# 启用网络浏览 +Browsing Yes +BrowseLocalProtocols dnssd + +# 修改访问权限(允许所有网络) + + Order allow,deny + Allow all + + + + Order allow,deny + Allow all + + + + AuthType Default + Require user @SYSTEM + Order allow,deny + Allow all + +``` + +> **说明**: 内网环境无公网IP,可直接使用 `Allow all`。如需限制访问,可改为 `Allow from 192.168.*.*` 等。 + +### 4.4 将用户添加到打印组 + +```bash +usermod -aG lpadmin root +``` + +### 4.5 启动服务 + +```bash +systemctl restart cups +systemctl enable cups +systemctl restart avahi-daemon +systemctl enable avahi-daemon +``` + +### 4.6 访问Web管理界面 + +``` +浏览器打开: https://盒子IP:631 +用户名: root +密码: 你的SSH密码 +``` + +> **注意**: CUPS默认使用HTTPS,浏览器可能提示证书不安全,选择继续访问即可 + +### 4.7 添加打印机 + +1. 点击 **Administration** → **Add Printer** +2. 选择你的USB打印机(Local Printers下) +3. 填写打印机名称和描述 +4. 勾选 **Share This Printer** +5. 选择对应的驱动型号 + +--- + +## 第五部分:客户端连接 + +### Windows + +``` +设置 → 蓝牙和其他设备 → 打印机和扫描仪 → 添加打印机 +``` + +如果自动发现不到,手动添加: +``` +http://盒子IP:631/printers/打印机名称 +``` + +### macOS / iOS + +自动通过AirPrint发现(需要avahi-daemon正常运行) + +### Linux + +```bash +# 使用 IPP 协议添加 +lpadmin -p 打印机名 -E -v ipp://盒子IP:631/printers/打印机名 +``` + +### Android + +安装「Mopria Print Service」或「CUPS Printing」应用,可自动发现打印机 + +--- + +## 常见问题排查 + +| 问题 | 可能原因 | 解决方案 | +|------|----------|----------| +| USB Burning Tool 识别不到设备 | 驱动未安装/短接失败 | 1.安装LibUSB驱动 2.换USB口 3.确认短接成功 | +| U盘启动后黑屏 | 设备树错误/U盘兼容性 | 1.检查uEnv.txt配置 2.换USB2.0 U盘 3.TTL查看日志 | +| armbian-install 选项没有306 | 脚本版本过旧 | 运行 `armbian-update` 更新脚本 | +| eMMC写入失败 | 分区表损坏 | 执行 `dd if=/dev/zero of=/dev/mmcblk2 bs=4096 count=4` | +| CUPS打印机不显示 | USB未识别 | 运行 `lsusb` 确认识别,检查USB线 | +| Windows找不到打印机 | 防火墙/网络问题 | 1.关闭防火墙测试 2.手动输入IPP地址 | +| macOS无法发现AirPrint | avahi服务问题 | 运行 `systemctl status avahi-daemon` 检查状态 | +| 打印乱码 | 驱动不匹配 | 在CUPS中更换其他驱动测试 | + +### TTL调试接线 + +如遇启动问题,建议连接TTL查看日志: + +| TTL线 | 盒子 | +|-------|------| +| GND | GND | +| RX | TX | +| TX | RX | + +波特率: **115200** + +--- + +## 注意事项 + +1. **刷机有风险**,建议先备份原系统 +2. 如果U盘无法识别,换一个**USB2.0**的U盘 +3. 建议连接**TTL调试**观察启动日志排查问题 +4. CUPS驱动建议用apt安装,**不要从厂商网站下载** +5. B863AV3.2-M有两种主控版本,确认是S905L3A +6. 首次启动Armbian可能较慢,请耐心等待 + +--- + +## 测试环境 + +| 项目 | 版本 | +|------|------| +| Armbian | Debian Bookworm (建议使用最新Release) | +| 内核 | 6.1.x LTS | +| 测试日期 | 2024年 | + +--- + +## 参考资料 + +- [ophub/amlogic-s9xxx-armbian #741](https://github.com/ophub/amlogic-s9xxx-armbian/issues/741) +- [ophub/amlogic-s9xxx-armbian #313](https://github.com/ophub/amlogic-s9xxx-armbian/issues/313) +- [ophub/amlogic-s9xxx-armbian #2587](https://github.com/ophub/amlogic-s9xxx-armbian/issues/2587) +- [中兴盒子刷机教程 - 博客园](https://www.cnblogs.com/imagecc/p/17904264.html) +- [S905L3A刷Armbian - 博客园](https://www.cnblogs.com/modys/p/17701772.html)