v1.7.6b
~凡是使用了小米增强启动的设备现在强制开启软固化功能 ~优化小米增强启动逻辑,移除了默认启动延迟,加快启动速度 ~修复内测源无法正确调用http端口的bug
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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(这是运行前的最后一步)"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user