~工具菜单新增AX6S等设备的tun模块修复功能 ~小闪存模式增加自定义目录功能 ~优化重写本机代理菜单 ~将172.16/12网段默认加入透明路由 ~将10.0/8默认路由网段改为10.0/12 ~优化一键设置加密DNS功能,修改根证书安装更新时的描述 ~修复部分网络环境下在线生成配置文件反复失败的问题 ~修复部分场景下tar解压失败的问题 ~修复部分情况下修改默认端口失败的问题 ~修复因Tun模块修复功能导致的WiFi信号减弱的问题 ~修复"cannot find device utun"报错问题 ~修复ntp服务在前台同步时导致clash无法正常启动的问题
53 lines
1.3 KiB
Bash
53 lines
1.3 KiB
Bash
#!/bin/sh
|
|
# Copyright (C) Juewuy
|
|
|
|
clashdir=/data/clash
|
|
profile=/etc/profile
|
|
|
|
tunfix(){
|
|
#在/tmp创建并挂载overlay
|
|
mkdir -p /tmp/overlay
|
|
mkdir -p /tmp/overlay/upper
|
|
mkdir -p /tmp/overlay/work
|
|
mount -o noatime,lowerdir=/lib/modules/4.4.198,upperdir=/tmp/overlay/upper,workdir=/tmp/overlay/work -t overlay "overlay_mods_only" /lib/modules/4.4.198
|
|
#将tun.ko链接到lib
|
|
ln -s $clashdir/tun.ko /lib/modules/4.4.198/tun.ko
|
|
}
|
|
init(){
|
|
#初始化环境变量
|
|
sed -i "/alias clash/d" $profile
|
|
sed -i "/export clashdir/d" $profile
|
|
echo "alias clash=\"$clashdir/clash.sh\"" >>$profile
|
|
echo "export clashdir=\"$clashdir\"" >>$profile
|
|
#设置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 10
|
|
#
|
|
/etc/init.d/clash start
|
|
/etc/init.d/clash enable
|
|
fi
|
|
}
|
|
|
|
case "$1" in
|
|
tunfix) tunfix ;;
|
|
init) init ;;
|
|
*)
|
|
if [ -z $(pidof clash) ];then
|
|
init
|
|
else
|
|
sleep 10
|
|
$clashdir/start.sh restart
|
|
fi
|
|
;;
|
|
esac
|
|
|