refactor(router info): improve router model recognition accuracy
update get_router_name function to read both GL-iNet原厂硬件信息和OpenWrt系统信息,组合获取更准确的机型名称
This commit is contained in:
@@ -23,7 +23,13 @@ third_party_source="https://istore.linkease.com/repo/all/nas_luci"
|
|||||||
# 路由器信息获取
|
# 路由器信息获取
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
get_router_name() {
|
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"
|
echo "$model_info"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
9
main.sh
9
main.sh
@@ -15,8 +15,15 @@ HTTP_HOST="https://cafe.cpolar.cn/wkdaily/gl/raw/branch/main"
|
|||||||
SCRIPT_DIR="/tmp/gl-scripts"
|
SCRIPT_DIR="/tmp/gl-scripts"
|
||||||
|
|
||||||
##获取软路由型号信息
|
##获取软路由型号信息
|
||||||
|
# 同时读取 GL-iNet 原厂硬件信息和 OpenWrt 系统信息,确保机型识别准确
|
||||||
get_router_name() {
|
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"
|
echo "$model_info"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user