From 4124a2e458fa89d53c6fa96a50e90cc489954bef Mon Sep 17 00:00:00 2001 From: juewuy Date: Fri, 20 Jan 2023 14:54:46 +0800 Subject: [PATCH] =?UTF-8?q?v1.6.16d=20~=E4=BF=AE=E5=A4=8D=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E5=AE=89=E8=A3=85=E6=8A=A5=E9=94=99=E7=9A=84bug=20~?= =?UTF-8?q?=E6=89=8B=E5=8A=A8=E4=B8=8A=E4=BC=A0=E5=86=85=E6=A0=B8=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=8A=A5=E9=94=99=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/clash.sh | 43 +++++++++++++++++++++++++------------------ scripts/init.sh | 2 +- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/scripts/clash.sh b/scripts/clash.sh index c6e00d1..23c4220 100644 --- a/scripts/clash.sh +++ b/scripts/clash.sh @@ -98,24 +98,31 @@ ckstatus(){ #检查执行权限 [ ! -x $clashdir/start.sh ] && chmod +x $clashdir/start.sh #检查/tmp用户上传 - [ -f /tmp/clash*linux* ] && chmod +x /tmp/clash*linux* && tmp_version=$(/tmp/clash*linux* -v) - [ -n "$tmp_version" ] && { - echo -e "\033[32m发现可用的内核文件\033[0m" - read -p "是否加载?(1/0) > " res - [ "$res" = 1 ] && { - echo -e " 1 Clash内核" - echo -e " 2 Clashpre内核" - echo -e " 3 Clash.Meta内核" - read -p "请手动确定该内核类型 > " num - case "$num" in - 2) clashcore=clashpre ;; - 3) clashcore=clash.meta ;; - *) clashcore=clash ;; - esac - mv -f /tmp/clash*linux* $bindir/clash - setconfig clashcore $clashcore - echo ----------------------------------------------- - } + [ -f /tmp/clash*linux* ] && chmod +x /tmp/clash*linux* && { + tmp_version=$(/tmp/clash*linux* -v) + if [ -n "$tmp_version" ];then + echo -e "\033[32m发现可用的内核文件\033[0m" + read -p "是否加载?(1/0) > " res + [ "$res" = 1 ] && { + echo -e " 1 Clash内核" + echo -e " 2 Clashpre内核" + echo -e " 3 Clash.Meta内核" + read -p "请手动确定该内核类型 > " num + case "$num" in + 2) clashcore=clashpre ;; + 3) clashcore=clash.meta ;; + *) clashcore=clash ;; + esac + mv -f /tmp/clash*linux* $bindir/clash + setconfig clashcore $clashcore + } + else + echo -e "\033[33m检测到不可用的内核文件!可能是文件受损或CPU架构不匹配!\033[0m" + rm -rf /tmp/clash*linux* + echo -e "\033[33m内核文件已移除,请认真检查后重新上传!\033[0m" + sleep 3 + fi + echo ----------------------------------------------- } [ -f /tmp/*.*ml ] && { echo -e "\033[32m发现可用的YAML配置文件\033[0m" diff --git a/scripts/init.sh b/scripts/init.sh index e4b9d3f..685d70c 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -140,7 +140,7 @@ $clashdir/start.sh stop 2>/dev/null #防止进程冲突 } #移动文件 mkdir -p $clashdir -[ -f /tmp/SC_tmp/* ] && mv -f /tmp/SC_tmp/* $clashdir +mv -f /tmp/SC_tmp/* $clashdir 2>/dev/null #初始化 [ -f "$clashdir/mark" ] || echo '#ShellClash配置文件,不明勿动!' > $clashdir/mark