v1.0.0beta14fix4

~修复部分ssr节点不可用的bug
~mac过滤功能增加移除单个设备以及添加全部设备功能
~修复设置本机代理时直接跳出的bug
~优化安装脚本,增加root用户检测
~优化ipv6dns拦截方式
~修复部分设备开机启动显示不正常的bug
~修复部分设备时间显示不正常的bug
This commit is contained in:
juewuy
2020-10-12 17:17:30 +08:00
parent 94c0ed99ef
commit fc5dc18348
3 changed files with 13 additions and 12 deletions

View File

@@ -22,7 +22,7 @@ source $ccfg
[ ! -f $clashdir/mac ] && touch $clashdir/mac [ ! -f $clashdir/mac ] && touch $clashdir/mac
#开机自启相关 #开机自启相关
if [ -f /etc/rc.common ];then if [ -f /etc/rc.common ];then
if [ -f /etc/rc.d/*clash ];then if [ -n "$(find /etc/rc.d -name '*clash')" ];then
autostart=enable_rc autostart=enable_rc
else else
autostart=disable_rc autostart=disable_rc
@@ -62,12 +62,13 @@ if [ -n "$PID" ];then
VmRSS=`cat /proc/$PID/status|grep -w VmRSS|awk '{print $2,$3}'` VmRSS=`cat /proc/$PID/status|grep -w VmRSS|awk '{print $2,$3}'`
#获取运行时长 #获取运行时长
if [ -n "$start_time" ]; then if [ -n "$start_time" ]; then
time=$((`date +%s`-$start_time)) time=$(expr `date +%s` - $start_time)
day=$(($time/86400)) #day=$(($time/86400))
if [[ $day != 0 ]]; then day=$(expr $time / 86400)
day=$day天 if [ "$day" = "0" ]; then
else
day="" day=""
else
day="$day""天"
fi fi
time=`date -u -d @${time} +%H小时%M分%S秒` time=`date -u -d @${time} +%H小时%M分%S秒`
fi fi

View File

@@ -24,7 +24,7 @@ read -p "请输入对应数字 > " num
if [ -z "$num" ] || [[ $num -gt 13 ]];then if [ -z "$num" ] || [[ $num -gt 13 ]];then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m" echo -e "\033[31m请输入正确的数字\033[0m"
elif [[ "$num" = 0 ]];then elif [[ "$num" = "0" ]];then
echo echo
elif [[ $num -le 13 ]];then elif [[ $num -le 13 ]];then
#将对应标记值写入mark #将对应标记值写入mark
@@ -161,7 +161,7 @@ do
echo -e " 0 \033[31m撤销输入\033[0m" echo -e " 0 \033[31m撤销输入\033[0m"
echo -e "回车 \033[32m完成输入\033[0m并\033[33m开始导入\033[0m配置文件" echo -e "回车 \033[32m完成输入\033[0m并\033[33m开始导入\033[0m配置文件"
echo ----------------------------------------------- echo -----------------------------------------------
read -p "请输入第"$i"个链接 > " url read -p "请输入第${i}个链接 > " url
test=$(echo $url | grep "://") test=$(echo $url | grep "://")
url=`echo ${url/\ \(*\)/''}` #删除恶心的超链接内容 url=`echo ${url/\ \(*\)/''}` #删除恶心的超链接内容
url=`echo ${url/*\&url\=/""}` #将clash完整链接还原成单一链接 url=`echo ${url/*\&url\=/""}` #将clash完整链接还原成单一链接
@@ -173,7 +173,7 @@ do
else else
Url="$Url"\|"$url" Url="$Url"\|"$url"
fi fi
i=$(($i+1)) i=$(expr $i + 1)
elif [ -z "$url" ];then elif [ -z "$url" ];then
[ -n "$Url" ] && linkset [ -n "$Url" ] && linkset
elif [[ $url == 0 ]];then elif [[ $url == 0 ]];then

View File

@@ -82,14 +82,14 @@ if [ "$result" != "200" ];then
echo -e "\033[32m无法获取配置文件请检查链接格式以及网络连接状态\033[0m" echo -e "\033[32m无法获取配置文件请检查链接格式以及网络连接状态\033[0m"
exit 1 exit 1
else else
retry=$(($retry + 1)) retry=$(expr $retry + 1)
echo -e "\033[32m尝试使用其他服务器获取配置\033[0m" echo -e "\033[32m尝试使用其他服务器获取配置\033[0m"
echo -e "\033[33m正在尝试第$retry次/共5次\033[0m" echo -e "\033[33m正在尝试第$retry次/共5次\033[0m"
sed -i '/server_link=*/'d $ccfg sed -i '/server_link=*/'d $ccfg
if [ "$server_link" -ge 5 ]; then if [ "$server_link" -ge 5 ]; then
server_link=0 server_link=0
fi fi
server_link=$(($server_link + 1)) server_link=$(expr $server_link + 1)
sed -i "1i\server_link=$server_link" $ccfg sed -i "1i\server_link=$server_link" $ccfg
Https="" Https=""
getyaml getyaml
@@ -172,7 +172,7 @@ fi
yaml=$clashdir/config.yaml yaml=$clashdir/config.yaml
#预删除需要添加的项目 #预删除需要添加的项目
i=$(grep -n "^proxies:" $clashdir/config.yaml | head -1 | cut -d ":" -f 1) i=$(grep -n "^proxies:" $clashdir/config.yaml | head -1 | cut -d ":" -f 1)
i=$(($i-1)) i=$(expr $i - 1)
sed -i "1,${i}d" $yaml sed -i "1,${i}d" $yaml
#添加配置 #添加配置
sed -i "1imixed-port:\ $mix_port" $yaml sed -i "1imixed-port:\ $mix_port" $yaml