From 40a01428a514325a443a96753370dce4dc4b6b84 Mon Sep 17 00:00:00 2001 From: juewuy Date: Fri, 2 Jan 2026 11:28:27 +0800 Subject: [PATCH] =?UTF-8?q?~=E8=B0=83=E6=95=B4=E5=86=85=E6=A0=B8=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E5=8A=9F=E8=83=BD=20~bug=E4=BF=AE=E5=A4=8D=20~?= =?UTF-8?q?=E6=89=BE=E5=9B=9E=E8=AF=AF=E5=88=A0=E7=9A=84=E9=98=B2=E6=AD=A2?= =?UTF-8?q?dnsmasq=E9=87=8D=E5=AE=9A=E5=90=91=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/init.sh | 4 +-- scripts/libs/get_config.sh | 2 +- scripts/menus/6_core_config.sh | 9 ++++-- scripts/menus/9_upgrade.sh | 59 +++++++++++----------------------- scripts/starts/fw_start.sh | 5 +++ 5 files changed, 33 insertions(+), 46 deletions(-) diff --git a/scripts/init.sh b/scripts/init.sh index b3f74147..3f3a9ae7 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -213,8 +213,8 @@ sed -i '/shellclash/d' /etc/group rm -rf /etc/init.d/clash rm -rf "$CRASHDIR"/rules [ "$systype" = "mi_snapshot" -a "$CRASHDIR" != '/data/clash' ] && rm -rf /data/clash -for file in tools webget.sh misnap_init.sh core.new; do - rm -rf "$CRASHDIR/$file" +for file in webget.sh misnap_init.sh core.new; do + rm -f "$CRASHDIR/$file" done #旧版变量改名 sed -i "s/clashcore/crashcore/g" "$CFG_PATH" diff --git a/scripts/libs/get_config.sh b/scripts/libs/get_config.sh index 4f201a06..e883e864 100644 --- a/scripts/libs/get_config.sh +++ b/scripts/libs/get_config.sh @@ -17,5 +17,5 @@ routing_mark=$((fwmark + 2)) [ -z "$dns_fallback" ] && dns_fallback="1.1.1.1, 8.8.8.8" [ -z "$dns_resolver" ] && { dns_resolver="223.5.5.5, 2400:3200::1" - cat /proc/net/udp | grep -q '0035' && dns_resolver='127.0.0.1, ::1' + cat /proc/net/udp | grep -q '0035' && dns_resolver='127.0.0.1' } \ No newline at end of file diff --git a/scripts/menus/6_core_config.sh b/scripts/menus/6_core_config.sh index 69a9beef..873c0c1a 100644 --- a/scripts/menus/6_core_config.sh +++ b/scripts/menus/6_core_config.sh @@ -952,8 +952,10 @@ gen_core_config_link(){ #在线生成工具 if [ -n "$Url_link" ];then i=100 #将用户链接写入配置 + Url="$Url_link" + Https='' setconfig Https - setconfig Url "'$Url_link'" + setconfig Url "'$Url'" #获取在线yaml文件 jump_core_config else @@ -1006,8 +1008,9 @@ set_core_config_link(){ #直接导入配置 read -p "确认导入配置文件?原配置文件将被备份![1/0] > " res if [ "$res" = '1' ]; then #将用户链接写入配置 - sed -i '/Url=*/'d $CFG_PATH - setconfig Https "'$link'" + Url='' + Https="$link" + setconfig Https "'$Https'" setconfig Url #获取在线yaml文件 jump_core_config diff --git a/scripts/menus/9_upgrade.sh b/scripts/menus/9_upgrade.sh index 29840b38..f8ecdaa4 100644 --- a/scripts/menus/9_upgrade.sh +++ b/scripts/menus/9_upgrade.sh @@ -320,14 +320,12 @@ setcustcore(){ #自定义内核 echo "-----------------------------------------------" echo -e "\033[33m请选择需要使用的核心!\033[0m" echo -e "1 \033[36mMetaCubeX/mihomo\033[32m@release\033[0m版本官方内核" - echo -e "2 \033[36mMetaCubeX/mihomo\033[32m@alpha\033[0m版本官方内核" - echo -e "3 \033[36mvernesong/mihomo\033[32m@alpha\033[0m版本内核(支持Smart策略)" - echo -e "4 \033[36mSagerNet/sing-box\033[32m@release\033[0m版本官方内核" - echo -e "5 \033[36mreF1nd/sing-box\033[32m@release\033[0m版本内核(完整编译)" - echo -e "6 \033[36mreF1nd/sing-box\033[32m@dev\033[0m版本内核(完整编译)" - echo -e "7 Premium-2023.08.17内核(已停止维护)" - echo -e "a \033[33m自定义内核链接 \033[0m" + echo -e "2 \033[36mvernesong/mihomo\033[32m@alpha\033[0m版本内核(支持Smart策略)" + echo -e "3 \033[36mSagerNet/sing-box\033[32m@release\033[0m版本官方内核" + echo -e "4 Premium-2023.08.17内核(已停止维护)" + echo -e "9 \033[33m自定义内核链接 \033[0m" echo "-----------------------------------------------" + echo -e " 0 返回上级菜单" read -p "请输入对应数字 > " num case "$num" in 1) @@ -337,49 +335,30 @@ setcustcore(){ #自定义内核 checkcustcore ;; 2) - project=MetaCubeX/mihomo - api_tag=Prerelease-Alpha - crashcore=meta - checkcustcore - ;; - 3) project=vernesong/mihomo api_tag=Prerelease-Alpha crashcore=meta checkcustcore ;; - 4) + 3) project=SagerNet/sing-box api_tag=latest crashcore=singbox checkcustcore ;; - 5) - project=juewuy/ShellCrash - api_tag=singbox_core_reF1nd - crashcore=singboxr - checkcustcore - ;; - 6) - project=juewuy/ShellCrash - api_tag=singbox_core_dev_reF1nd - crashcore=singboxr - checkcustcore - ;; - 7) + 4) project=juewuy/ShellCrash api_tag=clash.premium.latest crashcore=clashpre checkcustcore ;; - a) + 9) read -p "请输入自定义内核的链接地址(必须是以.tar.gz或.gz结尾的压缩文件) > " link [ -n "$link" ] && custcorelink="$link" setcoretype getcore ;; *) - errornum ;; esac } @@ -387,23 +366,23 @@ setziptype(){ echo "-----------------------------------------------" echo -e "请选择内核内核分支及压缩方式:\033[0m" echo "-----------------------------------------------" - echo -e " 1 \033[32m标准编译release版本,gz压缩\033[0m-完整支持脚本全部内置功能" - echo -e " 2 \033[36m最简编译release版本,upx压缩\033[0m-不支持Gvisor,Tailscale,Wireguard,NaiveProxy" - #echo -e " 3 \033[33m完整编译dev版本,tar.gz压缩\033[0m-占用可能略高,稳定性自测" + echo -e " 1 \033[36m最简编译release版本,upx压缩\033[0m-不支持Gvisor,Tailscale,Wireguard,NaiveProxy" + echo -e " 2 \033[32m标准编译release版本,tar.gz压缩\033[0m-完整支持脚本全部内置功能" + echo -e " 3 \033[33m完整编译alpha版本,gz压缩\033[0m-占用可能略高,稳定性自测" echo "-----------------------------------------------" echo " 0 返回上级菜单" read -p "请输入对应数字 > " num case "$num" in 0) ;; 1) - zip_type='gz' - ;; - 2) zip_type='upx' ;; - 3) + 2) zip_type='tar.gz' ;; + 3) + zip_type='gz' + ;; *) errornum ;; @@ -413,7 +392,7 @@ setziptype(){ setcore(){ #内核选择菜单 #获取核心及版本信息 [ -z "$crashcore" ] && crashcore="unknow" - [ -z "$zip_type" ] && zip_type="gz" + [ -z "$zip_type" ] && zip_type="tar.gz" echo "$crashcore" | grep -q 'singbox' && core_old=singbox || core_old=clash [ -n "$custcorelink" ] && custcore="$(echo $custcorelink | sed 's#.*github.com##; s#/releases/download/#@#; s#-linux.*$##')" ### @@ -422,7 +401,7 @@ setcore(){ #内核选择菜单 echo -e "当前内核:\033[42;30m $crashcore \033[47;30m$core_v\033[0m" echo -e "当前系统处理器架构:\033[32m $cpucore \033[0m" echo -e "\033[33m请选择需要使用的核心版本!\033[0m" - echo -e "\033[36m如需本地上传,请将二进制文件上传至 /tmp 目录后重新运行crash命令\033[0m" + echo -e "\033[36m如需本地上传,请将.upx .gz .tar.gz文件上传至 /tmp 目录后重新运行crash命令\033[0m" echo "-----------------------------------------------" echo -e "1 \033[43;30m Mihomo \033[0m: \033[32m(原meta内核)支持全面\033[0m" echo -e " >>\033[32m$meta_v \033[33m占用略高\033[0m" @@ -441,8 +420,8 @@ setcore(){ #内核选择菜单 echo -e " 说明文档: \033[36;4mhttps://lancellc.gitbook.io\033[0m" } echo "-----------------------------------------------" - echo -e "5 切换内核分支及压缩方式: \033[32m$zip_type\033[0m" - echo -e "6 \033[36m自定义内核\033[0m $custcore" + echo -e "5 切换版本分支及压缩方式: \033[32m$zip_type\033[0m" + echo -e "6 \033[36m使用自定义内核\033[0m $custcore" echo -e "7 \033[32m更新当前内核\033[0m" echo "-----------------------------------------------" echo "9 手动指定处理器架构" diff --git a/scripts/starts/fw_start.sh b/scripts/starts/fw_start.sh index d0d34cae..5e2c332e 100644 --- a/scripts/starts/fw_start.sh +++ b/scripts/starts/fw_start.sh @@ -47,3 +47,8 @@ line=$(grep -n 'nameserver' /etc/resolv.conf | awk -F: 'FNR==1{print $1}') sed -i "$line i\nameserver 127.0.0.1 #shellcrash-dns-repair" /etc/resolv.conf >/dev/null 2>&1 } +#移除openwrt-dnsmasq的DNS重定向 +[ "$(uci get dhcp.@dnsmasq[0].dns_redirect 2>/dev/null)" = 1 ] && { + uci del dhcp.@dnsmasq[0].dns_redirect + uci commit dhcp.@dnsmasq[0] +}