diff --git a/bin/ZeroWrt b/bin/ZeroWrt index 804a2a1..5372c7f 100644 --- a/bin/ZeroWrt +++ b/bin/ZeroWrt @@ -153,15 +153,73 @@ change_source() { color_output "0. 返回" read -p "请输入您的选择 [0-4]: " source_choice - case "$source_choice" in - 1) base_url="https://mirrors.aliyun.com/openwrt/releases/24.10.0-rc5/packages/x86_64" ;; - 2) base_url="https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/24.10.0-rc5/packages/x86_64" ;; - 3) base_url="https://mirrors.ustc.edu.cn/openwrt/releases/24.10.0-rc5/packages/x86_64" ;; - 4) base_url="https://downloads.openwrt.org/releases/24.10.0-rc5/packages/x86_64" ;; - 0) show_menu ; return ;; - *) color_output "\e[31m无效选项,返回菜单。\e[0m" ; show_menu ; return ;; + # 检测当前设备架构 + arch=$(uname -m) + + # 针对不同架构的设置 + case "$arch" in + "x86_64") + arch_name="x86_64" + ;; + "i386" | "pentium4") + arch_name="i386_pentium4" + ;; + "aarch64") + arch_name="aarch64_generic" + ;; + "armv7l") + arch_name="arm_cortex-a9" + ;; + "armv6l") + arch_name="arm_arm1176jzf-s_vfp" + ;; + "mips64el") + arch_name="mips64el" + ;; + "mipsel") + arch_name="mipsel_24kc" + ;; + "aarch64_cortex-a72") + arch_name="aarch64_cortex-a72" + ;; + "aarch64_cortex-a53") + arch_name="aarch64_cortex-a53" + ;; + "armv5te") + arch_name="arm_cortex-a5_vfpv4" + ;; + "armv8") + arch_name="arm_cortex-a15_neon-vfpv4" + ;; + *) + color_output "\e[31m不支持此架构:$arch,请选择其他源。\e[0m" + return + ;; esac + # 根据选择的源和架构来设置对应的 base_url + case "$source_choice" in + 1) + base_url="https://mirrors.aliyun.com/openwrt/releases/24.10.0-rc5/packages/$arch_name" + ;; + 2) + base_url="https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/24.10.0-rc5/packages/$arch_name" + ;; + 3) + base_url="https://mirrors.ustc.edu.cn/openwrt/releases/24.10.0-rc5/packages/$arch_name" + ;; + 4) + base_url="https://downloads.openwrt.org/releases/24.10.0-rc5/packages/$arch_name" + ;; + 0) show_menu ; return ;; + *) + color_output "\e[31m无效选项,返回菜单。\e[0m" + show_menu + return + ;; + esac + + # 更新软件源 cat < /etc/opkg/distfeeds.conf src/gz openwrt_base $base_url/base src/gz openwrt_luci $base_url/luci @@ -175,6 +233,7 @@ EOF show_menu } + # 6. 一键设置 one_click_setup() { while true; do