~替换自建源与自建Sub服务器域名
~修复/tmp目录检测到多个内核或配置文件时跳出的bug
~其他提示相关修复及优化
This commit is contained in:
juewuy
2023-02-01 10:13:35 +08:00
parent c9227d9c36
commit e98a113b2f
9 changed files with 34 additions and 26 deletions

View File

@@ -56,7 +56,7 @@ export url='https://fastly.jsdelivr.net/gh/juewuy/ShellClash@master' && wget -q
或者 或者
```shell ```shell
sudo -i #切换到root用户如果需要密码请输入密码 sudo -i #切换到root用户如果需要密码请输入密码
export url='https://gh.shellclash.cf/master' && bash -c "$(curl -kfsSl $url/install.sh)" && source /etc/profile &> /dev/null export url='https://gh.jwsc.eu.org/master' && bash -c "$(curl -kfsSl $url/install.sh)" && source /etc/profile &> /dev/null
``` ```
~**路由设备使用curl安装**<br> ~**路由设备使用curl安装**<br>
@@ -73,7 +73,7 @@ export url='https://fastly.jsdelivr.net/gh/juewuy/ShellClash@master' && sh -c "$
或者 或者
```shell ```shell
#作者私人源 #作者私人源
export url='https://gh.shellclash.cf/master' && sh -c "$(curl -kfsSl $url/install.sh)" && source /etc/profile &> /dev/null export url='https://gh.jwsc.eu.org/master' && sh -c "$(curl -kfsSl $url/install.sh)" && source /etc/profile &> /dev/null
``` ```
~**路由设备使用wget安装**<br> ~**路由设备使用wget安装**<br>
@@ -92,7 +92,7 @@ export url='https://fastly.jsdelivr.net/gh/juewuy/ShellClash@master' && wget -q
```Shell ```Shell
#作者私人http内测源 #作者私人http内测源
export url='http://test.shellclash.cf' && wget -q -O /tmp/install.sh $url/install.sh && sh /tmp/install.sh && source /etc/profile &> /dev/null export url='http://t.jwsc.eu.org' && wget -q -O /tmp/install.sh $url/install.sh && sh /tmp/install.sh && source /etc/profile &> /dev/null
``` ```
~**DOCKER环境下安装**<br> ~**DOCKER环境下安装**<br>

Binary file not shown.

Binary file not shown.

View File

@@ -2,5 +2,5 @@ clashnet_v=v1.7.6
clashpre_v=2022.11.25 clashpre_v=2022.11.25
clash_v=v1.7.1 clash_v=v1.7.1
meta_v=v1.13.2 meta_v=v1.13.2
versionsh=1.7.0b
GeoIP_v=20230128 GeoIP_v=20230128
versionsh=1.7.0d

View File

@@ -62,7 +62,7 @@ gettar(){
error_down error_down
exit 1 exit 1
else else
source $clashdir/init.sh 2>/dev/null source $clashdir/init.sh >/dev/null
fi fi
fi fi
} }

View File

@@ -98,8 +98,9 @@ ckstatus(){
#检查执行权限 #检查执行权限
[ ! -x $clashdir/start.sh ] && chmod +x $clashdir/start.sh [ ! -x $clashdir/start.sh ] && chmod +x $clashdir/start.sh
#检查/tmp内核文件 #检查/tmp内核文件
[ -f /tmp/clash*linux* ] && chmod +x /tmp/clash*linux* && { for file in /tmp/clash*linux* ; do
tmp_version=$(/tmp/clash*linux* -v) chmod +x $file
tmp_version=$($file -v)
if [ -n "$tmp_version" ];then if [ -n "$tmp_version" ];then
echo -e "\033[32m发现可用的内核文件\033[0m" echo -e "\033[32m发现可用的内核文件\033[0m"
read -p "是否加载?(1/0) > " res read -p "是否加载?(1/0) > " res
@@ -113,27 +114,29 @@ ckstatus(){
3) clashcore=clash.meta ;; 3) clashcore=clash.meta ;;
*) clashcore=clash ;; *) clashcore=clash ;;
esac esac
mv -f /tmp/clash*linux* $bindir/clash mv -f $file $bindir/clash
setconfig clashcore $clashcore setconfig clashcore $clashcore
} }
else else
echo -e "\033[33m检测到不可用的内核文件可能是文件受损或CPU架构不匹配\033[0m" echo -e "\033[33m检测到不可用的内核文件可能是文件受损或CPU架构不匹配\033[0m"
rm -rf /tmp/clash*linux* rm -rf $file
echo -e "\033[33m内核文件已移除请认真检查后重新上传\033[0m" echo -e "\033[33m内核文件已移除请认真检查后重新上传\033[0m"
sleep 3 sleep 2
fi fi
echo ----------------------------------------------- echo -----------------------------------------------
} done
#检查/tmp配置文件 #检查/tmp配置文件
[ -f /tmp/*.*ml -a -x $bindir/clash ] && $bindir/clash -t -d $bindir -f /tmp/*.*ml &>/dev/null && { [ -x $bindir/clash ] && \
for file in /tmp/clash*linux* ; do
$bindir/clash -t -d $bindir -f $file &>/dev/null && {
echo -e "\033[32m发现可用的YAML配置文件\033[0m" echo -e "\033[32m发现可用的YAML配置文件\033[0m"
echo /tmp/*.*ml echo $file
read -p "是否加载为config.yaml配置文件(1/0) > " res read -p "是否加载为config.yaml配置文件(1/0) > " res
[ "$res" = 1 ] && { [ "$res" = 1 ] && {
mv -f /tmp/*.*ml $clashdir/config.yaml mv -f $file $clashdir/config.yaml
} }
echo ----------------------------------------------- echo -----------------------------------------------
} done
} }
#启动相关 #启动相关
@@ -669,7 +672,7 @@ macfilter(){
echo -e "\033[31m已添加的设备请勿重复添加\033[0m" echo -e "\033[31m已添加的设备请勿重复添加\033[0m"
fi fi
add_mac add_mac
elif [ $num -le $(cat $dhcpdir | awk 'END{print NR}') 2>/dev/null ]; then elif [ $num -le $(cat $dhcpdir 2>/dev/null | awk 'END{print NR}') ]; then
macadd=$(cat $dhcpdir | awk '{print $2}' | sed -n "$num"p) macadd=$(cat $dhcpdir | awk '{print $2}' | sed -n "$num"p)
if [ -z "$(cat $clashdir/mac | grep -E "$macadd")" ];then if [ -z "$(cat $clashdir/mac | grep -E "$macadd")" ];then
echo $macadd >> $clashdir/mac echo $macadd >> $clashdir/mac
@@ -1039,6 +1042,10 @@ clashcfg(){
set_redir_config set_redir_config
elif [ "$num" = 2 ]; then elif [ "$num" = 2 ]; then
modprobe tun &>/dev/null || {
echo -e "\033[32m设备未检测到Tun模块可能无法代理UDP流量\033[0m"
sleep 1
}
redir_mod=混合模式 redir_mod=混合模式
set_redir_config set_redir_config

View File

@@ -758,7 +758,7 @@ setserver(){
release_url='' release_url=''
saveserver saveserver
elif [ "$num" = 4 ]; then elif [ "$num" = 4 ]; then
update_url='https://gh.shellclash.cf/master' update_url='https://gh.jwsc.eu.org/master'
release_url='' release_url=''
saveserver saveserver
elif [ "$num" = 5 ]; then elif [ "$num" = 5 ]; then
@@ -770,7 +770,7 @@ setserver(){
release_url='' release_url=''
saveserver saveserver
elif [ "$num" = 7 ]; then elif [ "$num" = 7 ]; then
update_url='http://test.shellclash.cf' update_url='http://t.jwsc.eu.org'
release_url='' release_url=''
saveserver saveserver
elif [ "$num" = 8 ]; then elif [ "$num" = 8 ]; then
@@ -793,7 +793,7 @@ setserver(){
read -p "请输入对应数字 > " num read -p "请输入对应数字 > " num
if [ -z "$num" -o "$num" = 0 ]; then if [ -z "$num" -o "$num" = 0 ]; then
setserver setserver
elif [ $num -le $(cat /tmp/clashrelease | awk 'END{print NR}') 2>/dev/null ]; then elif [ $num -le $(cat /tmp/clashrelease 2>/dev/null | awk 'END{print NR}') ]; then
release_version=$(cat /tmp/clashrelease | awk '{print $1}' | sed -n "$num"p) release_version=$(cat /tmp/clashrelease | awk '{print $1}' | sed -n "$num"p)
update_url="https://raw.githubusercontent.com/juewuy/ShellClash/$release_version" update_url="https://raw.githubusercontent.com/juewuy/ShellClash/$release_version"
saveserver saveserver

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# Copyright (C) Juewuy # Copyright (C) Juewuy
version=1.7.0b version=1.7.0d
setdir(){ setdir(){
dir_avail(){ dir_avail(){

View File

@@ -155,7 +155,7 @@ https://api.v1.mk
https://sub.xeton.dev https://sub.xeton.dev
https://v.id9.cc https://v.id9.cc
https://sub.maoxiongnet.com https://sub.maoxiongnet.com
http://sub2.shellclash.cf http://sub2.jwsc.eu.org
EOF` EOF`
Config=`sed -n ""$rule_link"p"<<EOF Config=`sed -n ""$rule_link"p"<<EOF
https://github.com/juewuy/ShellClash/raw/master/rules/ShellClash.ini https://github.com/juewuy/ShellClash/raw/master/rules/ShellClash.ini
@@ -180,7 +180,7 @@ EOF`
#如果传来的是Url链接则合成Https链接否则直接使用Https链接 #如果传来的是Url链接则合成Https链接否则直接使用Https链接
if [ -z "$Https" -a -z "$retry" ];then if [ -z "$Https" -a -z "$retry" ];then
[ -n "$(echo $Url | grep -oE 'vless:')" ] && Server='https://api.v1.mk' [ -n "$(echo $Url | grep -oE 'vless:')" ] && Server='https://api.v1.mk'
[ -n "$(echo $Url | grep -oE 'hysteria:')" ] && Server='https://sub.shellclash.cf' [ -n "$(echo $Url | grep -oE 'hysteria:')" ] && Server='https://sub.jwsc.eu.org'
Https="$Server/sub?target=clash&insert=true&new_name=true&scv=true&udp=true&exclude=$exclude&include=$include&url=$Url&config=$Config" Https="$Server/sub?target=clash&insert=true&new_name=true&scv=true&udp=true&exclude=$exclude&include=$include&url=$Url&config=$Config"
url_type=true url_type=true
fi fi
@@ -1152,8 +1152,9 @@ bfstart(){
catpac catpac
#预下载GeoSite数据库 #预下载GeoSite数据库
if [ "$clashcore" = "clash.meta" ] && [ ! -f $bindir/GeoSite.dat ] && [ -n "$(cat $clashdir/config.yaml|grep -Ei 'geosite')" ];then if [ "$clashcore" = "clash.meta" ] && [ ! -f $bindir/GeoSite.dat ] && [ -n "$(cat $clashdir/config.yaml|grep -Ei 'geosite')" ];then
if [ -f $clashdir/*eo*ite.dat ];then [ -f $clashdir/geosite.dat ] && mv -f $clashdir/geosite.dat $clashdir/GeoSite.dat
mv -f $clashdir/*eo*ite.dat $bindir/GeoSite.dat if [ -f $clashdir/GeoSite.dat ];then
mv -f $clashdir/GeoSite.dat $bindir/GeoSite.dat
else else
logger "未找到geosite数据库正在下载" 33 logger "未找到geosite数据库正在下载" 33
$0 webget $bindir/GeoSite.dat $update_url/bin/geosite.dat $0 webget $bindir/GeoSite.dat $update_url/bin/geosite.dat
@@ -1359,7 +1360,7 @@ webget)
getconfig getconfig
[ -n "$authentication" ] && auth="$authentication@" [ -n "$authentication" ] && auth="$authentication@"
export https_proxy="http://${auth}127.0.0.1:$mix_port" export https_proxy="http://${auth}127.0.0.1:$mix_port"
url=$(echo $3 | sed 's#https://.*/juewuy/ShellClash[@|/]#https://raw.githubusercontent.com/juewuy/ShellClash/#' | sed 's#https://gh.shellclash.cf/#https://raw.githubusercontent.com/juewuy/ShellClash/#') url=$(echo $3 | sed 's#https://.*/juewuy/ShellClash[@|/]#https://raw.githubusercontent.com/juewuy/ShellClash/#' | sed 's#https://gh.jwsc.eu.org/#https://raw.githubusercontent.com/juewuy/ShellClash/#')
else else
url=$(echo $3 | sed 's#https://.*/juewuy/ShellClash/#https://fastly.jsdelivr.net/gh/juewuy/ShellClash@#') url=$(echo $3 | sed 's#https://.*/juewuy/ShellClash/#https://fastly.jsdelivr.net/gh/juewuy/ShellClash@#')
fi fi