From 669ac88b6db6d1e2e0239775f125b4736d91b398 Mon Sep 17 00:00:00 2001 From: wukongdaily <2666180@gmail.com> Date: Thu, 6 Aug 2026 15:54:09 +0800 Subject: [PATCH] refactor(router info): improve router model recognition accuracy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit update get_router_name function to read both GL-iNet原厂硬件信息和OpenWrt系统信息,组合获取更准确的机型名称 --- lib/lib-common.sh | 8 +++++++- main.sh | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/lib-common.sh b/lib/lib-common.sh index 1d04753..074b6dd 100644 --- a/lib/lib-common.sh +++ b/lib/lib-common.sh @@ -23,7 +23,13 @@ third_party_source="https://istore.linkease.com/repo/all/nas_luci" # 路由器信息获取 # ============================================================================ get_router_name() { - model_info=$(cat /tmp/sysinfo/model) + model_info="" + if [ -f /proc/gl-hw-info/model ]; then + model_info=$(cat /proc/gl-hw-info/model) + fi + if [ -f /tmp/sysinfo/model ]; then + model_info="$model_info $(cat /tmp/sysinfo/model)" + fi echo "$model_info" } diff --git a/main.sh b/main.sh index 4934d64..74848b8 100755 --- a/main.sh +++ b/main.sh @@ -15,8 +15,15 @@ HTTP_HOST="https://cafe.cpolar.cn/wkdaily/gl/raw/branch/main" SCRIPT_DIR="/tmp/gl-scripts" ##获取软路由型号信息 +# 同时读取 GL-iNet 原厂硬件信息和 OpenWrt 系统信息,确保机型识别准确 get_router_name() { - model_info=$(cat /tmp/sysinfo/model) + model_info="" + if [ -f /proc/gl-hw-info/model ]; then + model_info=$(cat /proc/gl-hw-info/model) + fi + if [ -f /tmp/sysinfo/model ]; then + model_info="$model_info $(cat /tmp/sysinfo/model)" + fi echo "$model_info" }