From 2fba0f58ed159fb9878bab186f261b4777b38478 Mon Sep 17 00:00:00 2001 From: juewuy Date: Sat, 17 Feb 2024 19:06:42 +0800 Subject: [PATCH] =?UTF-8?q?~=E4=B8=BAmeta=E5=86=85=E6=A0=B8=E7=9A=84provid?= =?UTF-8?q?ers=E6=9C=AC=E5=9C=B0=E7=94=9F=E6=88=90=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E8=87=AA=E5=8A=A8=E8=B7=B3=E8=BF=87?= =?UTF-8?q?=E8=AF=81=E4=B9=A6=E9=AA=8C=E8=AF=81=E5=8A=9F=E8=83=BD=20~?= =?UTF-8?q?=E4=BC=98=E5=8C=96singbox=E5=86=85=E6=A0=B8providers=E7=94=9F?= =?UTF-8?q?=E6=88=90=E6=97=B6=E7=9A=84ua=E6=A0=87=E8=AF=86=20~=E4=BD=BF?= =?UTF-8?q?=E7=94=A8systemd=E5=90=AF=E5=8A=A8=E6=97=B6=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=90=AF=E5=8A=A8=E5=89=8D=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8A=A5=E9=94=99=E4=BF=A1=E6=81=AF=20~?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=86=85=E6=A0=B8=E5=88=87=E6=8D=A2=E6=97=B6?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=88=87=E6=8D=A2dns=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E7=9A=84=E9=80=BB=E8=BE=91=20~=E5=A2=9E=E5=8A=A0=E5=9C=A8?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E6=B2=A1=E6=9C=89=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=90=AF=E5=8A=A8=E6=97=B6=EF=BC=8C=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E4=BD=BF=E7=94=A8providers=E7=94=9F=E6=88=90=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=9A=84=E5=8A=9F=E8=83=BD=20~=E4=BF=AE=E5=A4=8D=E7=83=AD?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AE=A2=E9=98=85=E6=97=B6=E6=89=BE=E4=B8=8D?= =?UTF-8?q?=E5=88=B0=E5=86=85=E6=A0=B8=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/getdate.sh | 14 ++++++++++++-- scripts/menu.sh | 8 ++++++-- scripts/start.sh | 12 ++++++++---- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/scripts/getdate.sh b/scripts/getdate.sh index fc10973..4af97ec 100644 --- a/scripts/getdate.sh +++ b/scripts/getdate.sh @@ -348,7 +348,15 @@ gen_clash_providers(){ #生成clash的providers配置文件 url: "https://www.gstatic.com/generate_204" interval: 600 EOF -} + [ "$crashcore" = 'meta' ] && { + [ "$skip_cert" = "已开启" ] && skip_cert_verify='skip-cert-verify: true' + cat >> $TMPDIR/providers/providers.yaml < " res diff --git a/scripts/menu.sh b/scripts/menu.sh index f5a6b99..f909f81 100644 --- a/scripts/menu.sh +++ b/scripts/menu.sh @@ -175,7 +175,12 @@ start_core(){ core_config=${CRASHDIR}/yamls/config.yaml fi echo ----------------------------------------------- - if [ -s $core_config -o -n "$Url" -o -n "$Https" ];then + if [ ! -s $core_config -a -s $CRASHDIR/configs/providers.cfg ];then + echo -e "\033[33m没有找到${crashcore}配置文件,尝试生成providers配置文件!\033[0m" + [ "$crashcore" = singboxp ] && coretype=singbox + [ "$crashcore" = meta -o "$crashcore" = clashpre ] && coretype=clash + source ${CRASHDIR}/getdate.sh && gen_${coretype}_providers + elif [ -s $core_config -o -n "$Url" -o -n "$Https" ];then ${CRASHDIR}/start.sh start #设置循环检测以判定服务启动是否成功 i=1 @@ -1207,7 +1212,6 @@ normal_set(){ #基础设置 } set_dns_mod(){ - [ "$dns_mod" = mix ] && [ "$crashcore" != singbox -o "$crashcore" != singboxp ] && dns_mod=redir_host echo ----------------------------------------------- echo -e "当前DNS运行模式为:\033[47;30m $dns_mod \033[0m" echo -e "\033[33m切换模式后需要手动重启服务以生效!\033[0m" diff --git a/scripts/start.sh b/scripts/start.sh index ef274f1..98a5841 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1776,8 +1776,10 @@ update_config(){ #更新订阅并重启 hotupdate(){ #热更新订阅 getconfig get_core_config + core_check modify_$format && \ put_save http://127.0.0.1:${db_port}/configs "{\"path\":\"${CRASHDIR}/config.$format\"}" + rm -rf ${TMPDIR}/CrashCore } set_proxy(){ #设置环境变量 getconfig @@ -1807,10 +1809,12 @@ start) elif [ -f /etc/rc.common -a "$(cat /proc/1/comm)" = "procd" ];then /etc/init.d/shellcrash start elif [ "$USER" = "root" -a "$(cat /proc/1/comm)" = "systemd" ];then - FragmentPath=$(systemctl show -p FragmentPath shellcrash | sed 's/FragmentPath=//') - [ -f $FragmentPath ] && setconfig ExecStart "$COMMAND >/dev/null" "$FragmentPath" - systemctl daemon-reload - systemctl start shellcrash.service || start_error + bfstart && { + FragmentPath=$(systemctl show -p FragmentPath shellcrash | sed 's/FragmentPath=//') + [ -f $FragmentPath ] && setconfig ExecStart "$COMMAND >/dev/null" "$FragmentPath" + systemctl daemon-reload + systemctl start shellcrash.service || start_error + } else bfstart && start_old fi