Skip to content

Commit

Permalink
v0.9.4
Browse files Browse the repository at this point in the history
~调整安装初始化流程
~优化下载更新流程
~修复下载更新相关bug
  • Loading branch information
juewuy committed Aug 15, 2020
1 parent be13387 commit 5cabf65
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 30 deletions.
Binary file modified bin/clashfm.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion bin/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
versionsh=0.9.3
versionsh=0.9.4
36 changes: 20 additions & 16 deletions scripts/clash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
getconfig(){
#服务器地址
if [ -z "$update_url" ]; then
update_url=https://cdn.jsdelivr.net/gh/juewuy/clash-for-Miwifi/
update_url=https://cdn.jsdelivr.net/gh/juewuy/clash-for-Miwifi
fi
#文件路径
if [ -z "$clashdir" ];then
Expand Down Expand Up @@ -79,23 +79,35 @@ if [ ! -f $clashdir/Country.mmdb ];then
echo -e "\033[31m没有找到GeoIP数据库文件,请先下载数据库!\033[0m"
source $clashdir/getdate.sh
getgeo
clashstart
fi
}
clashstart(){

/etc/init.d/clash start
sleep 1
status=`ps |grep -w 'clash -d'|grep -v grep|wc -l`
if [ ! -f "$yaml" ];then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m没有找到配置文件,请先导入节点/订阅链接!\033[0m"
clashlink
fi
if [ $status -gt 0 ];then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/etc/init.d/clash stop > /dev/null 2>&1
echo -e "\033[31mClash服务已停止!\033[0m"
fi
/etc/init.d/clash start
sleep 1
status=`ps |grep -w 'clash -d'|grep -v grep|wc -l`
if [[ $status -gt 0 ]];then
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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[32mclash服务已启动!\033[0m"
echo -e "可以使用\033[30;47m http://clash.razord.top \033[0m管理内置规则"
echo -e "Host地址:\033[36m $host \033[0m 端口:\033[36m 9999 \033[0m"
echo -e "也可前往更新菜单安装本地Dashboard面板,连接更稳定!\033[0m"
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
else
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31mclash服务启动失败!请检查配置文件!\033[0m"
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fi
}
clashlink(){
Expand Down Expand Up @@ -566,6 +578,7 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
elif [[ $num == 3 ]]; then
source $clashdir/getdate.sh
getgeo
update

elif [[ $num == 4 ]]; then
source $clashdir/getdate.sh
Expand Down Expand Up @@ -749,18 +762,9 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
exit;

elif [[ $num == 1 ]]; then
if [ ! -f "$yaml" ];then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m没有找到配置文件,请先导入节点/订阅链接!\033[0m"
clashlink
fi
if [ $status -gt 0 ];then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/etc/init.d/clash stop > /dev/null 2>&1
echo -e "\033[31mClash服务已停止!\033[0m"
fi

clashstart
clashsh
exit;

elif [[ $num == 2 ]]; then
clashadv
Expand Down
29 changes: 16 additions & 13 deletions scripts/getdate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_On
EOF`
#如果传来的是Url链接则合成Https链接,否则直接使用Https链接
if [ -z $Https ];then
echo $Url
Https="https://$Server/sub?target=clashr&new_name=true&url=$Url&insert=false&config=$Config"
markhttp=1
fi
Expand Down Expand Up @@ -55,12 +56,13 @@ if [ "$result" != "200" ];then
read -p "是否更换后端地址后重试?[1/0] > " res
if [ "$res" = '1' ]; then
sed -i '/server_link=*/'d $ccfg
if [ "$server_link" = '7' ]; then
if [[ $server_link == 7 ]]; then
server_link=0
fi
server_link=$(($server_link + 1))
#echo $server_link
echo $server_link
sed -i "1i\server_link=$server_link" $ccfg
Https=""
getyaml
fi
#exit;
Expand All @@ -72,30 +74,32 @@ else
mv $yaml $yaml.bak
fi
mv $yamlnew $yaml
echo 配置文件已生成!正在重启clash使其生效
echo 配置文件已生成!正在启动clash使其生效
#重启clash服务
/etc/init.d/clash restart
/etc/init.d/clash stop > /dev/null 2>&1
/etc/init.d/clash start
sleep 1
status=`ps |grep -w 'clash -d'|grep -v grep|wc -l`
if [[ $status -gt 0 ]];then
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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[32mclash服务已启动!\033[0m"
echo -e "可以使用\033[30;47m http://clash.razord.top \033[0m管理clash内置规则"
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
echo -e "可以使用\033[30;47m http://clash.razord.top \033[0m管理内置规则"
echo -e "Host地址:\033[36m $host \033[0m 端口:\033[36m 9999 \033[0m"
echo -e "也可前往更新菜单安装本地Dashboard面板,连接更稳定!\033[0m"
sleep 1
clashsh
else
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if [ -f $yaml.bak ];then
echo -e "\033[31mclash服务启动失败!已还原配置文件并重启clash!\033[0m"
mv $yaml.bak $yaml
/etc/init.d/clash start
sleep 1
clashsh
else
echo -e "\033[31mclash服务启动失败!请利用测试菜单排查问题!\033[0m"
sleep 1
clashsh
fi
fi
Expand Down Expand Up @@ -153,6 +157,7 @@ do
sed -i '/Url=*/'d $ccfg
sed -i '/Https=*/'d $ccfg
sed -i "6i\Url=\'$Url\'" $ccfg
Https=""
#获取在线yaml文件
getyaml
fi
Expand Down Expand Up @@ -278,7 +283,7 @@ 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.*armv.*")" ] && cpucore="armv5"
[ -n "$(echo $cpucore | grep -E "linux.*mips.*")" ] && cpucore="mipsle-softfloat"
[ -n "$(echo $cpucore | grep -E "linux.*x86.*")" ] && cpucore="386"
###
Expand Down Expand Up @@ -398,9 +403,7 @@ read -p "请输入对应数字 > " num
else
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[32mGeoIP数据库文件下载成功!\033[0m"
update
fi
update
}
getdb(){
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}';)
Expand Down

0 comments on commit 5cabf65

Please sign in to comment.