v1.0.0beta16.1

~适配支持wget
~增加脚本日志以及查看日志功能
~新增自定义http/sock5代理认证功能
~新增支持安装内置yacd面板
~增加自定义DNS配置功能
~Redir模式增加基于tproxy的udp代理
~增加Gnome以及KDE桌面的自动设置本机代理功能

~同步GeoIP数据库及Dashboard面板文件
~回退premium测试版核心,修复bug

~优化了本机代理实现方式,增加了选项菜单
~优化了定时任务实现方式,适配更多设备
~优化了配置文件修饰方式
~优化安装脚本

~修复部分情况下开机自启显示错误的bug
~修复部分设备无法正常显示局域网连接ip/mac的bug
~修复iptables报错的bug
~修复各种更新检测失败的bug
~修复关闭时报错的bug
~修复安装时同时下载多次的bug
~修复新手引导报错的bug
This commit is contained in:
juewuy
2020-11-01 11:38:26 +08:00
parent 3f8b3944bb
commit 56f588be92
4 changed files with 57 additions and 41 deletions

View File

@@ -1,4 +1,4 @@
clash_v=1.2.0
versionsh=1.0.0beta16
clashpre_v=2020.10.29.g5e54f48
clashpre_v=2020.10.26
GeoIP_v=20201031

View File

@@ -77,8 +77,6 @@ getconfig(){
echo -----------------------------------------------
#检查新手引导
if [ -z "$userguide" ];then
read -p "检测到首次运行,是否启动新手引导?(1/0) > " res
echo -----------------------------------------------
sed -i "1i\userguide=1" $ccfg
[ "$res" = 1 ] && source $clashdir/getdate.sh && userguide
fi
@@ -114,7 +112,7 @@ clashstart(){
if [ ! -f "$yaml" ];then
echo -----------------------------------------------
echo -e "\033[31m没有找到配置文件请先导入配置文件\033[0m"
clashlink
source $clashdir/getdate.sh && clashlink
fi
echo -----------------------------------------------
$clashdir/start.sh start
@@ -407,6 +405,8 @@ localproxy(){
read -p "请输入对应数字 > " num
if [ -z "$num" ]; then
errornum
elif [ "$num" = 0 ]; then
i=
elif [ "$num" = 1 ]; then
echo -----------------------------------------------
if [ "$local_proxy" = "未开启" ]; then
@@ -437,7 +437,7 @@ localproxy(){
local_proxy_type="GNOME"
setconfig local_proxy_type $local_proxy_type
else
echo -e "\033[31m没有找到GNOME桌面\033[0m"
echo -e "\033[31m没有找到GNOME桌面,无法设置\033[0m"
sleep 1
fi
localproxy
@@ -446,7 +446,7 @@ localproxy(){
local_proxy_type="KDE"
setconfig local_proxy_type $local_proxy_type
else
echo -e "\033[31m没有找到KDE桌面\033[0m"
echo -e "\033[31m没有找到KDE桌面,无法设置\033[0m"
sleep 1
fi
localproxy

View File

@@ -456,6 +456,24 @@ getcpucore(){
fi
[ -n "$cpucore" ] && setconfig cpucore $cpucore
}
setcpucore(){
cpucore_list="armv5 armv7 armv8 386 amd64 \nmipsle-softfloat mipsle-hardfloat mips-softfloat"
echo -----------------------------------------------
echo -e "\033[31m仅适合脚本无法正确识别核心或核心无法正常运行时使用\033[0m"
echo -e "当前可供在线下载的处理器架构为:"
echo -e "\033[32m$cpucore_list\033[0m"
echo -e "如果您的CPU架构未在以上列表中请运行【uname -a】命令,并复制好返回信息"
echo -e "之后前往 t.me/clashfm 群提交或 github.com/juewuy/ShellClash 提交issue"
echo -----------------------------------------------
read -p "请手动输入处理器架构 > " cpucore
if [ -z "$(echo $cpucore_list |grep "$cpucore")" ];then
echo -e "\033[31m请输入正确的处理器架构\033[0m"
sleep 1
cpucore=""
else
setconfig cpucore $cpucore
fi
}
getcore(){
[ -z "$clashcore" ] && clashcore=clashpre
[ -z "$cpucore" ] && getcpucore
@@ -502,22 +520,7 @@ setcore(){
clashcore=clashpre
version=$clashpre_v
elif [ "$num" = 3 ]; then
cpucore_list="armv5 armv7 armv8 386 amd64 \nmipsle-softfloat mipsle-hardfloat mips-softfloat"
echo -----------------------------------------------
echo -e "\033[31m仅适合脚本无法正确识别核心或核心无法正常运行时使用\033[0m"
echo -e "当前可供在线下载的处理器架构为:"
echo -e "\033[32m$cpucore_list\033[0m"
echo -e "如果您的CPU架构未在以上列表中请运行【uname -a】命令,并复制好返回信息"
echo -e "之后前往 t.me/clashfm 群提交或 github.com/juewuy/ShellClash 提交issue"
echo -----------------------------------------------
read -p "请手动输入处理器架构 > " cpucore
if [ -z "$(echo $cpucore_list |grep "$cpucore")" ];then
echo -e "\033[31m请输入正确的处理器架构\033[0m"
sleep 1
cpucore=""
else
setconfig cpucore $cpucore
fi
setcpucore
setcore
else
errornum
@@ -752,11 +755,11 @@ update(){
getsh
elif [ "$num" = 2 ]; then
getcore
setcore
update
elif [ "$num" = 3 ]; then
getgeo
setgeo
update
elif [ "$num" = 4 ]; then
@@ -812,14 +815,14 @@ userguide(){
whichmod(){
echo -----------------------------------------------
echo -e "\033[36m 是否需要代理UDP(主要用于游戏) \033[0m"
echo -e "\033[0m你之后依然可以在设置中更改各种配置\033[0m"
echo -e " 1 \033[36m不需要代理UDP流量\033[0m"
echo -e "\033[33m是否需要代理UDP流量(主要用于游戏) \033[0m"
echo -----------------------------------------------
echo -e " 1 \033[0m不代理UDP流量(可能会导致一部分游戏/应用无法连接)\033[0m"
modinfo tun >/dev/null 2>&1 && [ "$?" = 0 ] && \
echo -e " 2 \033[36m使用Tun虚拟网卡代理UDP流量(更低的延迟但更多的CPU消耗)\033[0m" || \
echo -e " x \033[36m(你的设备不支持此模式,如为虚拟机运行请调整虚拟网)\033[0m"
echo -e " 2 \033[0m使用Tun虚拟网卡代理UDP流量(更低的延迟但更多的CPU消耗)\033[0m" || \
echo -e " 0 \033[0m使用Tun模式(你的设备不支持此模式,如为虚拟机运行请调整虚拟网卡设置)\033[0m"
[ -n "$(iptables -j TPROXY 2>&1 | grep 'on-port')" ] && \
echo -e " 3 \033[36m使用Tproxy模式代理UDP流量(较低CPU消耗但更高的延迟)033[0m"
echo -e " 3 \033[0m使用Tproxy模式代理UDP流量(较低CPU消耗但更高的延迟)033[0m"
echo -----------------------------------------------
read -p "请输入对应数字 > " num
if [ -z "$num" ] || [ "$num" -gt 4 ];then
@@ -841,10 +844,12 @@ userguide(){
echo -----------------------------------------------
echo -e "\033[30;46m 欢迎使用ShellClash新手引导 \033[0m"
echo -----------------------------------------------
echo -e "\033[33m 请选择你的使用环境 \033[0m"
echo -e "\033[33m请选择你的使用环境 \033[0m"
echo -e "\033[0m(你之后依然可以在设置中更改各种配置)\033[0m"
echo -----------------------------------------------
echo -e " 1 \033[32m各类路由设备\033[0m配置局域网透明路由"
echo -e " 2 \033[36mLinux系统带GUI桌面\033[0m配置本机路由"
echo -e " 3 \033[32m服务器Linux系统\033[0m配置本机路由"
echo -e " 2 \033[36mLinux桌面系统\033[0m配置本机路由"
echo -e " 3 \033[32m服务器Linux系统\033[0m配置本机路由"
echo -e " 4 \033[36m多功能设备\033[0m配置本机及局域网路由"
echo -----------------------------------------------
read -p "请输入对应数字 > " num
@@ -856,26 +861,31 @@ userguide(){
elif [ "$num" = 2 -o "$num" = 3 ];then
setconfig redir_mod "纯净模式"
setconfig clashcore "clash"
echo -----------------------------------------------
echo -e "\033[36m请选择设置本机代理的方式\033[0m"
localproxy
elif [ "$num" = 4 ];then
whichmod
fi
}
checkupdate
forwhat
dir_size=$(df $clashdir | awk '{print $4}' | sed 1d)
if [ "$dir_size" -lt 10240 ];then
echo -e "\033[33m检测到你的安装目录空间不足10M是否开启小闪存模式\033[0m"
echo -e "\033[33m开启后核心及数据库文件将被下载到内存中\033[0m"
echo -e "\033[0m开启后核心及数据库文件将被下载到内存中,这将占用一部分内存空间\033[0m"
echo -e "\033[0m每次开机后首次运行clash时都会自动的重新下载相关文件\033[0m"
read -p "是否开启?(1/0) > " res
[ "$res" = 1 ] && setconfig bindir="/tmp/clash_$USER"
fi
echo -----------------------------------------------
echo -e "\033[33m安装本地Dashboard面板可以更快捷的管理clash内置规则\033[0m"
read -p "需要安装本地Dashboard面板吗(1/0) > " res
[ "$res" = 1 ] && getdb
read -p "现在导入订阅或者配置文件链接?(1/0) > " res
echo -----------------------------------------------
echo -e "\033[32m请导入订阅链接或者导入配置文件\033[0m"
read -p "开始导入?(1/0) > " res
[ "$res" = 1 ] && clashlink
clashsh
}
#测试菜单
testcommand(){

View File

@@ -394,8 +394,8 @@ web_restore(){
}
#启动相关
catpac(){
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}';)
[ -z "$host" ] && host=$(ip a|grep -w 'inet'|grep 'global'|grep -E '192.|10.'|sed 's/.*inet.//g'|sed 's/\/[0-9][0-9].*$//g'|head -n 1)
host=$(ubus call network.interface.lan status 2>&1 | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}';)
[ -z "$host" ] && host=$(ip a 2>&1 | grep -w 'inet' | grep 'global' | grep -E '192.|10.' | sed 's/.*inet.//g' | sed 's/\/[0-9][0-9].*$//g' | head -n 1)
[ -z "$host" ] && host=127.0.0.1
cat > /tmp/clash_pac <<EOF
function FindProxyForURL(url, host) {
@@ -419,7 +419,7 @@ EOF
}
bfstart(){
[ ! -d $bindir/ui ] && mkdir -p $bindir/ui
[ -z "$update_url" ] && update_url=https://cdn.jsdelivr.net/gh/juewuy/ShellClash
[ -z "$update_url" ] && update_url=https://cdn.jsdelivr.net/gh/juewuy/ShellClash@master
#检查clash核心
if [ ! -f $bindir/clash ];then
if [ -f $clashdir/clash ];then
@@ -428,8 +428,12 @@ bfstart(){
logger "未找到clash核心正在下载" 33
[ -z "$clashcore" ] && clashcore=clash
[ -z "$cpucore" ] && source $clashdir/getdate.sh && getcpucore
[ -z "$cpucore" ] && logger 找不到设备的CPU信息请手动指定处理器架构类型 31 && setcpucore
webget $bindir/clash "$update_url/bin/$clashcore/clash-linux-$cpucore"
[ "$?" = 1 ] && logger "核心下载失败,已退出!" 31 && rm -f $bindir/clash && exit 1
[ ! -x $bindir/clash ] && chmod +x $bindir/clash #检测可执行权限
clashv=$($bindir/clash -v | awk '{print $2}')
setconfig clashv $clashv
fi
fi
#检查数据库文件
@@ -438,8 +442,10 @@ bfstart(){
mv $clashdir/Country.mmdb $bindir/Country.mmdb
else
logger "未找到GeoIP数据库正在下载" 33
webget /tmp/Country.mmdb $update_url/bin/Country.mmdb
webget $bindir/Country.mmdb $update_url/bin/Country.mmdb
[ "$?" = 1 ] && logger "数据库下载失败,已退出!" 31 && rm -f $bindir/Country.mmdb && exit 1
GeoIP_v=$(date +"%Y%m%d")
setconfig GeoIP_v $GeoIP_v
fi
fi
#检查dashboard文件