From 475b3b32e80ca3360a69228bc1f4cf20dc180a93 Mon Sep 17 00:00:00 2001 From: juewuy Date: Thu, 11 Jan 2024 15:04:51 +0800 Subject: [PATCH] =?UTF-8?q?v1.8.5e=20~=E4=BF=AE=E5=A4=8D=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=97=A0=E6=B3=95=E7=94=9F=E6=95=88=E7=9A=84?= =?UTF-8?q?bug=20~=E4=BF=AE=E5=A4=8D=E6=9C=AC=E5=9C=B0/tmp=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E5=86=85=E6=A0=B8=E6=97=B6=E4=B8=8D=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7=E7=9A=84bug=20~=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E5=90=8E=E5=86=85=E6=A0=B8=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7=E4=B8=A2=E5=A4=B1=E7=9A=84bug=20~=E8=B0=83=E6=95=B4si?= =?UTF-8?q?ngbox=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E7=AD=96=E7=95=A5=EF=BC=8C=E7=8E=B0=E5=9C=A8?= =?UTF-8?q?=E5=8F=AA=E4=BC=9A=E5=AF=BC=E5=85=A5config.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/getdate.sh | 2 +- scripts/init.sh | 3 ++- scripts/menu.sh | 8 +++++--- scripts/task.sh | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/getdate.sh b/scripts/getdate.sh index 8170121..8a3b166 100644 --- a/scripts/getdate.sh +++ b/scripts/getdate.sh @@ -1552,7 +1552,7 @@ update(){ echo ----------------------------------------------- echo -ne "\033[32m正在检查更新!\033[0m\r" checkupdate - [ -z "$core_v" ] && core_v=unknow + [ -z "$core_v" ] && core_v=$crashcore core_v_new=$(eval echo \$${crashcore}_v) echo -e "\033[30;47m欢迎使用更新功能:\033[0m" echo ----------------------------------------------- diff --git a/scripts/init.sh b/scripts/init.sh index f4d078c..8f6ab31 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -279,11 +279,12 @@ for file in log shellcrash.service mark? mark.bak;do done #旧版变量改名 sed -i "s/clashcore/crashcore/g" $configpath +sed -i "s/clash_v/core_v/g" $configpath sed -i "s/clash.meta/meta/g" $configpath sed -i "s/ShellClash/ShellCrash/g" $configpath #旧版任务清理 ${CRASHDIR}/start.sh cronset "clash服务" 2>/dev/null ${CRASHDIR}/start.sh cronset "订阅链接" 2>/dev/null ${CRASHDIR}/start.sh cronset "ShellCrash初始化" 2>/dev/null -sleep 1 + echo -e "\033[32m脚本初始化完成,请输入\033[30;47m crash \033[0;33m命令开始使用!\033[0m" diff --git a/scripts/menu.sh b/scripts/menu.sh index 555cc3e..ed2b0d4 100644 --- a/scripts/menu.sh +++ b/scripts/menu.sh @@ -108,12 +108,14 @@ ckstatus(){ read -p "是否加载(会停止当前服务)?(1/0) > " res [ "$res" = 1 ] && { ${CRASHDIR}/start.sh stop - $file -v &>/dev/null || $file version &>/dev/null - if [ "$?" = 0 ];then + core_v=$($file -v &>/dev/null) + [ -z "$core_v" ] && $($file version &>/dev/null) + if [ -n "$core_v" ];then source ${CRASHDIR}/getdate.sh && setcoretype && \ mv -f $file ${CRASHDIR}/CrashCore && \ echo -e "\033[32m内核加载完成!\033[0m " && \ setconfig crashcore $crashcore && \ + setconfig core_v $core_v && \ switch_core sleep 1 else @@ -127,7 +129,7 @@ ckstatus(){ done #检查/tmp配置文件 [ -x ${BINDIR}/CrashCore ] && \ - for file in `ls -F /tmp | grep -v [/\$] | grep -v '\ ' | grep -iE '.yaml$|.yml$|.json$'` ; do + for file in `ls -F /tmp | grep -v [/\$] | grep -v '\ ' | grep -iE '.yaml$|.yml$|config.json$'` ; do file=/tmp/$file echo -e "发现内核配置文件: \033[36m$file\033[0m " read -p "是否加载为$crashcore的配置文件?(1/0) > " res diff --git a/scripts/task.sh b/scripts/task.sh index a694014..efebda6 100644 --- a/scripts/task.sh +++ b/scripts/task.sh @@ -2,7 +2,7 @@ # Copyright (C) Juewuy #加载全局变量 -CRASHDIR=$(cd $(dirname $0);pwd) +CRASHDIR=$(cd "$(dirname "$(dirname "$0")")"; pwd) [ -z "$BINDIR" ] && BINDIR=${CRASHDIR} CFG_PATH=${CRASHDIR}/configs/ShellCrash.cfg TMPDIR=/tmp/ShellCrash && [ ! -f ${TMPDIR} ] && mkdir -p ${TMPDIR}