~凡是使用了小米增强启动的设备现在强制开启软固化功能
~优化小米增强启动逻辑,移除了默认启动延迟,加快启动速度
~修复内测源无法正确调用http端口的bug
This commit is contained in:
juewuy
2023-04-28 19:49:11 +08:00
parent f040a0f4b0
commit 3b73ab80cb
4 changed files with 30 additions and 35 deletions

View File

@@ -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