~新增更多设备支持,理论上支持小米全系路由器设备(待测试)
~增加了对设备核心架构的自动检测,适配armv5,armv7,armv8(aarch64),mipsle及x86平台
~增加了一部分acl规则模版
~修复了几处偶尔报错的小bug
This commit is contained in:
juewuy
2020-08-14 16:42:52 +08:00
parent 724968474f
commit e4aa9d702d
4 changed files with 42 additions and 30 deletions

Binary file not shown.

View File

@@ -1 +1 @@
versionsh=0.9.0
versionsh=0.9.1

View File

@@ -3,13 +3,13 @@
getconfig(){
#版本号
versionsh_l=0.9.0
#versionsh_l=0.9.0
#服务器地址
if [ -z $update_url ]; then
if [ -z "$update_url" ]; then
update_url=https://cdn.jsdelivr.net/gh/juewuy/clash-for-Miwifi/
fi
#文件路径
if [ -z $clashdir ];then
if [ -z "$clashdir" ];then
clashdir=$(dirname $(readlink -f "$0"))
echo "export clashdir=\"$clashdir\"" >> /etc/profile
fi
@@ -32,7 +32,7 @@ else
auto1="\033[36m允许\033[0mclash开机启动"
fi
#获取运行模式
if [ ! -n "$redir_mod" ]; then
if [ -z "$redir_mod" ]; then
sed -i "2i\redir_mod=Redir模式" $ccfg
redir_mod=Redir模式
fi
@@ -91,8 +91,8 @@ status=`ps |grep -w 'clash -d'|grep -v grep|wc -l`
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[32mclash服务已启动\033[0m"
echo -e "可以使用\033[30;47m http://clash.razord.top \033[0m管理内置规则"
echo -e "也可以前往更新菜单安装本地Dashboard面板连接更稳定"
echo -e "Host地址:\033[36m $host \033[0m 端口:\033[36m 9999 \033[0m"
echo -e "Host地址:\036[33m $host \033[0m 端口:\033[36m 9999 \033[0m"
echo -e "也可前往更新菜单安装本地Dashboard面板连接更稳定\033[0m"
else
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31mclash服务启动失败请检查配置文件\033[0m"
@@ -100,13 +100,13 @@ status=`ps |grep -w 'clash -d'|grep -v grep|wc -l`
}
clashlink(){
#获取订阅规则
if [ ! -n "$rule_link" ]; then
if [ -z "$rule_link" ]; then
sed -i '/rule_link=*/'d $ccfg
sed -i "4i\rule_link=1" $ccfg
rule_link=1
fi
#获取后端服务器地址
if [ ! -n "$server_link" ]; then
if [ -z "$server_link" ]; then
sed -i '/server_link=*/'d $ccfg
sed -i "5i\server_link=1" $ccfg
server_link=1
@@ -122,7 +122,7 @@ echo -e " 5 \033[36m还原\033[0m配置文件"
echo -e " 6 \033[32m手动更新\033[0m订阅"
echo -e " 0 返回上级菜单"
read -p "请输入对应数字 > " num
if [ -z $num ];then
if [ -z "$num" ];then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m"
clashsh
@@ -166,9 +166,12 @@ elif [[ $num == 3 ]];then
echo 3 ACL4SSR通用版去广告加强
echo 4 ACL4SSR精简版去广告加强
echo 5 ACL4SSR通用版无去广告
echo 6 ACL4SSR通用版无自动测速
echo 7 ACL4SSR精简版无自动测速
echo 8 ACL4SSR超重度奈飞全量
echo 0 返回上级菜单
read -p "请输入对应数字 > " num
if [ -z $num ];then
if [ -z "$num" ];then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m"
clashlink
@@ -194,7 +197,7 @@ elif [[ $num == 4 ]];then
echo 7 subconvert.dreamcloud.pw
echo 0 返回上级菜单
read -p "请输入对应数字 > " num
if [ -z $num ];then
if [ -z "$num" ];then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m"
clashlink
@@ -230,7 +233,7 @@ elif [[ $num == 5 ]];then
fi
clashsh
elif [[ $num == 6 ]];then
if [ ! -n "$Url" ];then
if [ -z "$Url" ];then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo 没有找到你的订阅链接!请先输入链接!
clashlink
@@ -257,19 +260,19 @@ fi
}
clashadv(){
#获取设置默认显示
if [ ! -n "$skip_cert" ]; then
if [ -z "$skip_cert" ]; then
skip_cert=已开启
fi
if [ ! -n "$common_ports" ]; then
if [ -z "$common_ports" ]; then
common_ports=未开启
fi
if [ ! -n "$dns_mod" ]; then
if [ -z "$dns_mod" ]; then
dns_mod=redir_host
fi
if [ ! -n "$modify_yaml" ]; then
if [ -z "$modify_yaml" ]; then
modify_yaml=未开启
fi
if [ ! -n "$ipv6_support" ]; then
if [ -z "$ipv6_support" ]; then
ipv6_support=未开启
fi
#
@@ -306,7 +309,7 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
echo " 不推荐使用redir-host"
echo " 0 返回上级菜单"
read -p "请输入对应数字 > " num
if [ -z $num ]; then
if [ -z "$num" ]; then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m"
clashadv
@@ -353,7 +356,7 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
echo " 不支持Tun模式"
echo " 0 返回上级菜单"
read -p "请输入对应数字 > " num
if [ -z $num ]; then
if [ -z "$num" ]; then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m"
clashadv
@@ -535,7 +538,7 @@ clashcron(){
echo -e " 输入 9 \033[31m删除定时任务\033[0m"
echo -e " 输入 0 返回上级菜单"
read -p "请输入对应数字 > " num
if [ -z $num ]; then
if [ -z "$num" ]; then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m"
clashcron
@@ -558,7 +561,7 @@ clashcron(){
#设置具体时间
echo -----------------------------------------------
read -p "请输入小时0-23 > " num
if [ -z $num ]; then
if [ -z "$num" ]; then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m"
setcron
@@ -571,7 +574,7 @@ clashcron(){
fi
echo -----------------------------------------------
read -p "请输入分钟0-60 > " num
if [ -z $num ]; then
if [ -z "$num" ]; then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m"
setcron
@@ -622,7 +625,7 @@ echo -e " 3 设置\033[32m定时开启\033[0mclash服务"
echo -e " 4 设置\033[33m定时更新\033[0m订阅链接(实验性,可能不稳定)"
echo -e " 0 返回上级菜单"
read -p "请输入对应数字 > " num
if [ -z $num ]; then
if [ -z "$num" ]; then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m"
clashsh
@@ -726,7 +729,7 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
echo " 6 测试代理服务器连通性google.tw)"
echo " 0 返回上级目录!"
read -p "请输入对应数字 > " num
if [ -z $num ]; then
if [ -z "$num" ]; then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m"
clashsh

View File

@@ -20,6 +20,9 @@ https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_On
https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_AdblockPlus.ini
https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini_AdblockPlus.ini
https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_NoReject.ini
https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_NoAuto.ini
https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini_NoAuto.ini
https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Full_Netflix.ini
EOF`
#如果传来的是Url链接则合成Https链接否则直接使用Https链接
if [ -z $Https ];then
@@ -81,8 +84,8 @@ else
host=$(ubus call network.interface.lan status | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}';)
echo -e "Host地址:\033[30;46m $host \033[0m;端口:\033[30;46m 9999 \033[0m"
#将用户链接写入mark
sed -i '/Https=*/'d $ccfg
sed -i "7i\Https=\'$Https\'" $ccfg
#sed -i '/Https=*/'d $ccfg
#sed -i "7i\Https=\'$Https\'" $ccfg
clashsh
else
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -269,9 +272,15 @@ if [ ! -f $clashdir/clash ]; then
clashcore=没有安装核心!
clashv=''
fi
cpucore=armv7
clashcore_n=$clashcore
#获取设备处理器架构
cpucore=$(uname -ms | tr ' ' '_' | tr '[A-Z]' '[a-z]')
[ -n "$(echo $cpucore | grep -E "linux.*aarch64.*")" ] && cpucore="armv8"
[ -n "$(echo $cpucore | grep -E "linux.*armv7.*")" ] && cpucore="armv7"
[ -n "$(echo $cpucore | grep -E "linux.*armv5.*")" ] && cpucore="armv5"
[ -n "$(echo $cpucore | grep -E "linux.*mips.*")" ] && cpucore="mipsle-softfloat"
[ -n "$(echo $cpucore | grep -E "linux.*x86.*")" ] && cpucore="386"
###
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "当前clash核心\033[47;30m $clashcore \033[46;30m$clashv\033[0m"
echo -e "\033[32m请选择需要下载的核心版本\033[0m"
@@ -445,7 +454,7 @@ echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[30;47m您可以在此处切换在线更新时使用的资源地址\033[0m"
echo -e "当前源:\033[4;32m$update_url\033[0m"
echo -----------------------------------------------
echo -e " 1 CDN源(感谢\033[4;32mwww.jsdelivr.com\033[0m推荐)"
echo -e " 1 CDN源(可能有一定的同步延迟)"
echo -e " 2 Github源(不稳定,不推荐)"
echo -e " 3 Github源+clash代理(需开启clash服务推荐)"
echo -e " 4 自定义输入(请务必确保路径正确)"