From fea5673384190d1483462e733321cbec11eade91 Mon Sep 17 00:00:00 2001 From: juewuy Date: Fri, 18 Dec 2020 12:58:41 +0800 Subject: [PATCH] =?UTF-8?q?v1.0.0beta18.1=20~=E4=B8=8B=E8=BD=BD=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E6=A0=B9=E8=AF=81=E4=B9=A6=E5=8A=9F=E8=83=BD=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=87=AA=E5=8A=A8=E6=A3=80=E6=B5=8B=E8=AF=81=E4=B9=A6?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E9=80=BB=E8=BE=91=20~=E7=8E=B0=E5=9C=A8?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=8C=85=E5=90=AB=E9=AB=98=E7=BA=A7=E7=89=88?= =?UTF-8?q?=E8=A7=84=E5=88=99=E7=9A=84=E9=85=8D=E7=BD=AE=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E4=BC=9A=E8=87=AA=E5=8A=A8=E5=88=87=E6=8D=A2=E5=88=B0=E9=AB=98?= =?UTF-8?q?=E7=BA=A7=E7=89=88=E6=A0=B8=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/getdate.sh | 37 +++++++++++++++++++------------------ scripts/start.sh | 8 ++++++++ 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/scripts/getdate.sh b/scripts/getdate.sh index 7a26629..8af8d0f 100644 --- a/scripts/getdate.sh +++ b/scripts/getdate.sh @@ -646,29 +646,30 @@ getcrt(){ fi } setcrt(){ - crtdir='/etc/ssl/certs/ca-certificates.crt' - echo ----------------------------------------------- - echo -e "\033[36m安装/更新本地根证书文件(ca-certificates.crt)\033[0m" - echo -e "\033[33m用于解决证书校验错误,x509报错等问题\033[0m" - echo -e "\033[31m无上述问题的设备无需使用本功能!\033[0m" - [ -f "$crtdir" ] && echo -e "\033[32m当前设备已经安装根证书文件了!\033[0m" - echo ----------------------------------------------- - read -p "确认安装?(1/0) > " res + openssldir=$(openssl version -a 2>&1 | grep OPENSSLDIR | awk -F "\"" '{print $2}') + if [ -n "$openssldir" ];then + crtdir="$openssldir/certs/ca-certificates.crt" + echo ----------------------------------------------- + echo -e "\033[36m安装/更新本地根证书文件(ca-certificates.crt)\033[0m" + echo -e "\033[33m用于解决证书校验错误,x509报错等问题\033[0m" + echo -e "\033[31m无上述问题的设备无需使用本功能!\033[0m" + [ -f "$crtdir" ] && echo -e "\033[32m当前设备已经安装根证书文件了!\033[0m" + echo ----------------------------------------------- + read -p "确认安装?(1/0) > " res - if [ -z "$res" ];then - errornum - elif [ "$res" = '0' ]; then - i= - elif [ "$res" = '1' ]; then - if [ -d /etc/ssl/certs ];then + if [ -z "$res" ];then + errornum + elif [ "$res" = '0' ]; then + i= + elif [ "$res" = '1' ]; then getcrt else - echo ----------------------------------------------- - echo -e "\033[33m设备可能未安装openssl或者证书文件目录不是/etc/ssl/certs,无法安装!\033[0m" - sleep 1 + errornum fi else - errornum + echo ----------------------------------------------- + echo -e "\033[33m设备可能尚未安装openssl,无法安装证书文件!\033[0m" + sleep 1 fi } setserver(){ diff --git a/scripts/start.sh b/scripts/start.sh index c224e45..e5aed2b 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -185,6 +185,14 @@ EOF` echo ----------------------------------------------- exit 1 fi + #检测是否存在高级版规则 + if [ "$clashcore" = "clash" -a -n "$(cat $yamlnew | grep -E '^script:|proxy-providers|rule-providers')" ];then + echo ----------------------------------------------- + logger "检测到高级版核心专属规则!将改为使用premium核心启动!" 33 + rm -rf $bindir/clash + setconfig clashcore clashpre + echo ----------------------------------------------- + fi #使用核心内置test功能检测 if [ -x $bindir/clash ];then $bindir/clash -t -d $bindir -f $yamlnew >/dev/null