From 3772593f669318493a153a815c24fe9721a84404 Mon Sep 17 00:00:00 2001 From: juewuy Date: Tue, 6 Jan 2026 14:51:18 +0800 Subject: [PATCH] =?UTF-8?q?~=E6=A3=80=E6=9F=A5=E6=9B=B4=E6=96=B0=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E4=BC=98=E5=8C=96=20~padavan=E8=87=AA=E5=90=AF?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20~=E9=83=A8=E5=88=86=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E4=BC=98=E5=8C=96=20~bug=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/menus/5_task.sh | 6 +++++- scripts/menus/9_upgrade.sh | 15 +++++++++------ scripts/starts/clash_check.sh | 4 ++-- scripts/starts/clash_modify.sh | 23 +++++++++++------------ scripts/starts/general_init.sh | 2 +- scripts/starts/singbox_modify.sh | 3 ++- 6 files changed, 30 insertions(+), 23 deletions(-) diff --git a/scripts/menus/5_task.sh b/scripts/menus/5_task.sh index ebd96070..76b49a93 100644 --- a/scripts/menus/5_task.sh +++ b/scripts/menus/5_task.sh @@ -108,7 +108,8 @@ task_add(){ #任务添加 } task_del(){ #任务删除 #删除定时任务 - croncmd -l > "$TMPDIR"/cron && sed -i "/$1/d" "$TMPDIR"/cron && croncmd "$TMPDIR"/cron + croncmd -l > "$TMPDIR"/cron + sed -i "/$1/d" "$TMPDIR"/cron && croncmd "$TMPDIR"/cron rm -f "$TMPDIR"/cron #删除条件任务 sed -i "/$1/d" "$CRASHDIR"/task/cron 2>/dev/null @@ -125,6 +126,9 @@ task_type(){ #任务条件选择菜单 echo -e " 2 定时任务\033[32m每日执行\033[0m" echo -e " 3 定时任务\033[32m每小时执行\033[0m" echo -e " 4 定时任务\033[32m每分钟执行\033[0m" + echo "-----------------------------------------------" + echo -e "\033[31m注意:\033[0m逻辑水平不及格的请勿使用下方触发条件!" + echo "-----------------------------------------------" echo -e " 5 服务\033[33m启动前执行\033[0m" echo -e " 6 服务\033[33m启动后执行\033[0m" echo -e " 7 服务\033[33m运行时每分钟执行\033[0m" diff --git a/scripts/menus/9_upgrade.sh b/scripts/menus/9_upgrade.sh index 57b88767..7c905781 100644 --- a/scripts/menus/9_upgrade.sh +++ b/scripts/menus/9_upgrade.sh @@ -18,8 +18,7 @@ error_down(){ upgrade() { while true; do echo "-----------------------------------------------" - echo -ne "\033[32m正在检查更新!\033[0m\r" - checkupdate + [ -z "$version_new" ] && checkupdate [ -z "$core_v" ] && core_v=$crashcore core_v_new=$(eval echo \$"$crashcore"_v) echo -e "\033[30;47m欢迎使用更新功能:\033[0m" @@ -107,6 +106,7 @@ upgrade() { #检查更新 checkupdate(){ + echo -ne "\033[32m正在检查更新!\033[0m\r" get_bin "$TMPDIR"/version_new version echooff [ "$?" = "0" ] && { version_new=$(cat "$TMPDIR"/version_new) @@ -641,9 +641,9 @@ setgeo() { echo "-----------------------------------------------" echo -e " 3 Mihomo精简版GeoIP_cn数据库(约0.1mb) \033[33m$cn_mini_v\033[0m" echo -e " 4 Mihomo完整版GeoSite数据库(约5mb) \033[33m$geosite_v\033[0m" - echo -e " 5 Mihomo-mrs数据库常用包(约1mb) \033[33m$mrs_v\033[0m" echo "-----------------------------------------------" - echo -e " 6 Singbox-srs数据库常用包(约0.8mb) \033[33m$srs_v\033[0m" + echo -e " 5 Mihomo-mrs数据库常用包(约1mb,非必要勿用)" + echo -e " 6 Singbox-srs数据库常用包(约0.8mb,非必要勿用)" echo "-----------------------------------------------" echo -e " 8 \033[32m自定义数据库文件\033[0m" echo -e " 9 \033[31m清理数据库文件\033[0m" @@ -917,6 +917,7 @@ saveserver() { setconfig update_url "'$update_url'" setconfig url_id $url_id setconfig release_type $release_type + version_new='' echo "-----------------------------------------------" echo -e "\033[32m源地址切换成功!\033[0m" } @@ -960,11 +961,13 @@ setserver() { elif [ "$url_id_new" -ge 200 ];then update_url=$(grep -E "^1|$release_name" "$CRASHDIR"/configs/servers.list | sed -n ""$num"p" | awk '{print $3}') url_id='' - continue + saveserver + break else url_id=$url_id_new update_url='' - continue + saveserver + break fi unset url_id_new ;; diff --git a/scripts/starts/clash_check.sh b/scripts/starts/clash_check.sh index 03a32832..413aae1c 100644 --- a/scripts/starts/clash_check.sh +++ b/scripts/starts/clash_check.sh @@ -12,9 +12,9 @@ clash_check() { #clash启动前检查 core_exchange meta '当前内核不支持非root用户启用本机代理' check_core #预下载GeoIP数据库并排除存在自定义数据库链接的情况 - [ -n "$(grep -oEi 'geoip:' "$CRASHDIR"/yamls/*.yaml)" ] && [ -z "$(grep -oEi 'geoip:|mmdb:' "$CRASHDIR"/yamls/*.yaml)" ] && check_geo Country.mmdb cn_mini.mmdb + [ -n "$(grep -oEi 'geoip:' "$CRASHDIR"/yamls/config.yaml)" ] && check_geo Country.mmdb cn_mini.mmdb #预下载GeoSite数据库并排除存在自定义数据库链接的情况 - [ -n "$(grep -oEi 'geosite:' "$CRASHDIR"/yamls/*.yaml)" ] && [ -z "$(grep -oEi 'geosite:' "$CRASHDIR"/yamls/*.yaml)" ] && check_geo GeoSite.dat geosite.dat + [ -n "$(grep -oEi 'geosite:' "$CRASHDIR"/yamls/config.yaml)" ] && check_geo GeoSite.dat geosite.dat #预下载cn.mrs数据库 [ "$dns_mod" = "mix" ] || [ "$dns_mod" = "route" ] && ! grep -Eq '^[[:space:]]*cn:' "$CRASHDIR"/yamls/*.yaml && check_geo ruleset/cn.mrs mrs_geosite_cn.mrs return 0 diff --git a/scripts/starts/clash_modify.sh b/scripts/starts/clash_modify.sh index d6a0538b..277b66ee 100644 --- a/scripts/starts/clash_modify.sh +++ b/scripts/starts/clash_modify.sh @@ -89,19 +89,18 @@ hosts: EOF if [ "$crashcore" = "meta" ]; then echo " 'services.googleapis.cn': services.googleapis.com" >>"$TMPDIR"/hosts.yaml - else - #加载本机hosts - sys_hosts=/etc/hosts - [ -f /data/etc/custom_hosts ] && sys_hosts=/data/etc/custom_hosts - while read line; do - [ -n "$(echo "$line" | grep -oE "([0-9]{1,3}[\.]){3}")" ] && - [ -z "$(echo "$line" | grep -oE '^#')" ] && - hosts_ip=$(echo $line | awk '{print $1}') && - hosts_domain=$(echo $line | awk '{print $2}') && - [ -z "$(cat "$TMPDIR"/hosts.yaml | grep -oE "$hosts_domain")" ] && - echo " '$hosts_domain': $hosts_ip" >>"$TMPDIR"/hosts.yaml - done <$sys_hosts fi + #加载本机hosts + sys_hosts=/etc/hosts + [ -f /data/etc/custom_hosts ] && sys_hosts='/etc/hosts /data/etc/custom_hosts' + cat $sys_hosts | while read line; do + [ -n "$(echo "$line" | grep -oE "([0-9]{1,3}[\.]){3}")" ] && + [ -z "$(echo "$line" | grep -oE '^#')" ] && + hosts_ip=$(echo $line | awk '{print $1}') && + hosts_domain=$(echo $line | awk '{print $2}') && + [ -z "$(cat "$TMPDIR"/hosts.yaml | grep -oE "$hosts_domain")" ] && + echo " '$hosts_domain': $hosts_ip" >>"$TMPDIR"/hosts.yaml + done fi #分割配置文件 yaml_char='proxies proxy-groups proxy-providers rules rule-providers sub-rules listeners' diff --git a/scripts/starts/general_init.sh b/scripts/starts/general_init.sh index 321b965a..5f547800 100644 --- a/scripts/starts/general_init.sh +++ b/scripts/starts/general_init.sh @@ -14,7 +14,7 @@ if [ -d "/etc/storage/clash" -o -d "/etc/storage/ShellCrash" ]; then sleep 3 && i=$((i + 1)) done [ -w "$profile" ] || profile=/etc_ro/profile - mount -t tmpfs -o remount,rw,size=45M tmpfs /tmp #增加/tmp空间以适配新的内核压缩方式 + [ "$zip_type" = 'upx' ] || mount -t tmpfs -o remount,rw,size=45M tmpfs /tmp #增加/tmp空间以适配新的内核压缩方式 sed -i '' "$profile" #将软链接转化为一般文件 elif [ -d "/jffs" ]; then sleep 60 diff --git a/scripts/starts/singbox_modify.sh b/scripts/starts/singbox_modify.sh index 8f10e6c0..06655714 100644 --- a/scripts/starts/singbox_modify.sh +++ b/scripts/starts/singbox_modify.sh @@ -99,7 +99,8 @@ EOF #生成dns.json [ "$ipv6_dns" != "未开启" ] && strategy='prefer_ipv4' || strategy='ipv4_only' #获取detour出口 - auto_detour=$(grep -E '"type": "urltest"' -A 1 "$TMPDIR"/jsons/outbounds.json | grep '"tag":' | head -n 1 | sed 's/^[[:space:]]*"tag": //;s/,$//') + auto_detour=$(grep -E '"type": "urltest"' -A 1 "$TMPDIR"/jsons/outbounds.json | grep '自动' | head -n 1 | sed 's/^[[:space:]]*"tag": //;s/,$//') + [ -z "$auto_detour" ] && auto_detour=$(grep -E '"type": "urltest"' -A 1 "$TMPDIR"/jsons/outbounds.json | grep '"tag":' | head -n 1 | sed 's/^[[:space:]]*"tag": //;s/,$//') [ -z "$auto_detour" ] && auto_detour=$(grep -E '"type": "selector"' -A 1 "$TMPDIR"/jsons/outbounds.json | grep '"tag":' | head -n 1 | sed 's/^[[:space:]]*"tag": //;s/,$//') [ -z "$auto_detour" ] && auto_detour='"DIRECT"' #根据dns模式生成