From 3b73ab80cba4b2f2564468cd1494c6c448824034 Mon Sep 17 00:00:00 2001 From: juewuy Date: Fri, 28 Apr 2023 19:49:11 +0800 Subject: [PATCH] =?UTF-8?q?v1.7.6b=20~=E5=87=A1=E6=98=AF=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E4=BA=86=E5=B0=8F=E7=B1=B3=E5=A2=9E=E5=BC=BA=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E7=9A=84=E8=AE=BE=E5=A4=87=E7=8E=B0=E5=9C=A8=E5=BC=BA=E5=88=B6?= =?UTF-8?q?=E5=BC=80=E5=90=AF=E8=BD=AF=E5=9B=BA=E5=8C=96=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=20~=E4=BC=98=E5=8C=96=E5=B0=8F=E7=B1=B3=E5=A2=9E=E5=BC=BA?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E9=80=BB=E8=BE=91=EF=BC=8C=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E4=BA=86=E9=BB=98=E8=AE=A4=E5=90=AF=E5=8A=A8=E5=BB=B6=E8=BF=9F?= =?UTF-8?q?=EF=BC=8C=E5=8A=A0=E5=BF=AB=E5=90=AF=E5=8A=A8=E9=80=9F=E5=BA=A6?= =?UTF-8?q?=20~=E4=BF=AE=E5=A4=8D=E5=86=85=E6=B5=8B=E6=BA=90=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=AD=A3=E7=A1=AE=E8=B0=83=E7=94=A8http=E7=AB=AF?= =?UTF-8?q?=E5=8F=A3=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/clash.sh | 28 ++++++++++++---------------- scripts/getdate.sh | 14 +++++++------- scripts/misnap_init.sh | 19 +++++++++---------- scripts/start.sh | 4 ++-- 4 files changed, 30 insertions(+), 35 deletions(-) diff --git a/scripts/clash.sh b/scripts/clash.sh index f60651e..01638bd 100644 --- a/scripts/clash.sh +++ b/scripts/clash.sh @@ -1600,7 +1600,7 @@ tools(){ } #获取设置默认显示 [ -n "$(cat /etc/crontabs/root 2>&1| grep otapredownload)" ] && mi_update=禁用 || mi_update=启用 - [ "$mi_autoSSH" = "已启用" ] && mi_autoSSH_type=32m已启用 || mi_autoSSH_type=31m未启用 + [ "$mi_autoSSH" = "已启用" ] && mi_autoSSH_type=32m已启用 || mi_autoSSH_type=31m未配置 [ -f $clashdir/tun.ko ] && mi_tunfix=32m已启用 || mi_tunfix=31m未启用 # echo ----------------------------------------------- @@ -1666,22 +1666,18 @@ tools(){ tools elif [ "$num" = 6 ]; then - if [ "$mi_autoSSH" = "已启用" ];then - mi_autoSSH=禁用 + if [ "$systype" = "mi_snapshot" ];then + echo ----------------------------------------------- + echo -e "\033[33m本功能使用软件命令进行固化不保证100%成功!\033[0m" + echo -e "\033[33m如有问题请加群反馈:\033[36;4mhttps://t.me/ShellClash\033[0m" + read -p "请输入需要还原的SSH密码(不影响当前密码,回车可跳过) > " mi_autoSSH_pwd + mi_autoSSH=已启用 + cp -f /etc/dropbear/dropbear_rsa_host_key $clashdir/dropbear_rsa_host_key 2>/dev/null + cp -f /etc/dropbear/authorized_keys $clashdir/authorized_keys 2>/dev/null + echo -e "\033[32m设置成功!\033[0m" + sleep 1 else - if [ "$systype" = "mi_snapshot" ];then - echo ----------------------------------------------- - echo -e "\033[33m本功能使用软件命令进行固化不保证100%成功!\033[0m" - echo -e "\033[33m如有问题请加群反馈:\033[36;4mhttps://t.me/ShellClash\033[0m" - read -p "请输入需要还原的SSH密码(不影响当前密码,回车可跳过) > " mi_autoSSH_pwd - mi_autoSSH=已启用 - cp -f /etc/dropbear/dropbear_rsa_host_key $clashdir/dropbear_rsa_host_key 2>/dev/null - cp -f /etc/dropbear/authorized_keys $clashdir/authorized_keys 2>/dev/null - echo -e "\033[32m设置成功!\033[0m" - sleep 1 - else - echo 不支持的设备! - fi + echo 不支持的设备! fi setconfig mi_autoSSH $mi_autoSSH setconfig mi_autoSSH_pwd $mi_autoSSH_pwd diff --git a/scripts/getdate.sh b/scripts/getdate.sh index 4b4f1b9..a24e45e 100644 --- a/scripts/getdate.sh +++ b/scripts/getdate.sh @@ -869,7 +869,7 @@ if [ -z "$release_new" ];then source /tmp/clashversion 2>/dev/null else echo -e "\033[31m检查更新失败!请切换其他安装源!\033[0m" - echo -e "\033[36m如全部安装源都无法使用,请先运行服务后再使用更新!\033[0m" + echo -e "\033[36m如全部安装源都无法使用,请先运行clash服务后再使用更新功能!\033[0m" sleep 1 setserver fi @@ -1082,12 +1082,12 @@ userguide(){ fi fi #小米设备软固化 - if [ "$systype" = "mi_snapshot" ];then - echo ----------------------------------------------- - echo -e "\033[33m检测到为小米路由设备,启用软固化可防止路由升级后丢失SSH\033[0m" - read -p "是否启用软固化功能?(1/0) > " res - [ "$res" = 1 ] && setconfig mi_autoSSH 已启用 - fi + # if [ "$systype" = "mi_snapshot" ];then + # echo ----------------------------------------------- + # echo -e "\033[33m检测到为小米路由设备,启用软固化可防止路由升级后丢失SSH\033[0m" + # read -p "是否启用软固化功能?(1/0) > " res + # [ "$res" = 1 ] && setconfig mi_autoSSH 已启用 + # fi #提示导入订阅或者配置文件 echo ----------------------------------------------- echo -e "\033[32m是否导入配置文件?\033[0m(这是运行前的最后一步)" diff --git a/scripts/misnap_init.sh b/scripts/misnap_init.sh index 7b403f5..9dc00f1 100644 --- a/scripts/misnap_init.sh +++ b/scripts/misnap_init.sh @@ -34,27 +34,26 @@ tunfix(){ ln -s $clashdir/tun.ko ${ko_dir}/tun.ko } init(){ + #等待启动完成 + log_file=$(uci get system.@system[0].log_file) + while [ "$i" -lt 20 ]; do + sleep 3 + [ -z "$(grep 'init complete' $log_file)" ] && i=20 || i=$((i + 1)) + done #初始化环境变量 sed -i "/alias clash/d" $profile sed -i "/export clashdir/d" $profile echo "alias clash=\"$clashdir/clash.sh\"" >>$profile echo "export clashdir=\"$clashdir\"" >>$profile #软固化功能 - [ "$(grep 'mi_autoSSH=' $clashdir/mark | awk -F "=" '{print $2}')" = "已启用" ] && autoSSH + autoSSH #设置init.d服务 cp -f $clashdir/clashservice /etc/init.d/clash chmod 755 /etc/init.d/clash #启动服务 if [ ! -f $clashdir/.dis_startup ]; then - log_file=$(uci get system.@system[0].log_file) - while [ "$i" -lt 10 ]; do - sleep 5 - [ -n "$(grep 'init complete' $log_file)" ] && i=10 || i=$((i + 1)) - done #AX6S/AX6000修复tun功能 - [ -f $clashdir/tun.ko -a ! -f /lib/modules/4.4.198/tun.ko ] && tunfix - #启动延迟 - sleep 60 + [ -f $clashdir/tun.ko ] && tunfix #启动服务 /etc/init.d/clash start /etc/init.d/clash enable @@ -66,7 +65,7 @@ case "$1" in init) init ;; *) if [ -z $(pidof clash) ];then - init + init & else sleep 10 $clashdir/start.sh restart diff --git a/scripts/start.sh b/scripts/start.sh index 40e3350..297d3a0 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1377,7 +1377,7 @@ webget) if [ -n "$(pidof clash)" ];then getconfig [ -n "$authentication" ] && auth="$authentication@" - export https_proxy="http://${auth}127.0.0.1:$mix_port" + export all_proxy="http://${auth}127.0.0.1:$mix_port" url=$(echo $3 | sed 's#https://fastly.jsdelivr.net/gh/juewuy/ShellClash[@|/]#https://raw.githubusercontent.com/juewuy/ShellClash/#' | sed 's#https://gh.jwsc.eu.org/#https://raw.githubusercontent.com/juewuy/ShellClash/#') else url=$(echo $3 | sed 's#https://raw.githubusercontent.com/juewuy/ShellClash/#https://fastly.jsdelivr.net/gh/juewuy/ShellClash@#') @@ -1390,7 +1390,7 @@ webget) [ "$5" = "rediroff" ] && redirect='' || redirect='-L' [ "$6" = "skipceroff" ] && certificate='' || certificate='-k' result=$(curl $agent -w %{http_code} --connect-timeout 3 $progress $redirect $certificate -o "$2" "$url") - [ "$result" != "200" ] && export https_proxy="" && result=$(curl $agent -w %{http_code} --connect-timeout 3 $progress $redirect $certificate -o "$2" "$3") + [ "$result" != "200" ] && export all_proxy="" && result=$(curl $agent -w %{http_code} --connect-timeout 3 $progress $redirect $certificate -o "$2" "$3") else if wget --version > /dev/null 2>&1;then [ "$4" = "echooff" ] && progress='-q' || progress='-q --show-progress'