19 Commits
1.4.1 ... 1.4.4

Author SHA1 Message Date
juewuy
4a59e858e9 v1.4.4-test
~同步最新1.7.1clash核心
~同步最新Geoip数据库文件
2021-10-29 17:51:03 +08:00
juewuy
4bc922dee6 v1.4.5-test
~同步最新1.7.1clash核心
~同步最新Geoip数据库文件
2021-09-16 13:05:08 +08:00
juewuy
2c59be20f3 v1.4.4-test
~适配hanwckf及chongshengb等版本Padavan固件
~增加clash.net核心
~增加脚本设置一键备份还原功能
2021-08-30 18:03:37 +08:00
juewuy
b3a153e684 v1.4.4-test
~适配hanwckf及chongshengb等版本Padavan固件
~增加clash.net核心
~增加脚本设置一键备份还原功能
2021-08-30 18:00:09 +08:00
juewuy
4767a9dc3a v1.4.4-test
~适配hanwckf及chongshengb等版本Padavan固件
~增加clash.net核心
~增加脚本设置一键备份还原功能
2021-08-30 17:49:33 +08:00
juewuy
5159886b64 Merge pull request #74 from light-d/patch-1
Update README_CN.md
2021-08-30 17:10:58 +08:00
juewuy
47437a1826 Merge pull request #72 from w1ndy/patch-1
Change group id to match iptable rules
2021-08-30 17:10:45 +08:00
light-d
d49b36fe2f Update README_CN.md
line67 install_n.sh is not available, use install.sh instead
2021-08-26 01:56:53 +08:00
Di Weng
16ce0c997c Change group id to match iptable rules 2021-08-25 13:38:19 +08:00
juewuy
cd801e120c v1.4.4-test
~适配hanwckf及chongshengb等版本Padavan固件
2021-07-26 16:50:00 +08:00
juewuy
b97bcc14ab v1.4.3-release
~同步最新1.6.5官方核心文件
~同步最新IP数据库文件
~自启脚本的启动优先级调整为99(请重新开关一次开机启动功能)
~redir模式增加强行开启fakeip的开关
~更新脚本时将强制关闭clash服务,以防止各种报错
~增加对vyos使用show作为默认sh的判断
~现在只有开启本机代理后才会代理本机的docker流量
2021-07-17 22:26:41 +08:00
juewuy
f539fe74da v1.4.2-test
~同步最新1.6.5官方核心文件
~同步最新IP数据库文件
~自启脚本的启动优先级调整为99(请重新开关一次开机启动功能)
~redir模式增加强行开启fakeip的开关
~更新脚本时将强制关闭clash服务,以防止各种报错
~增加对vyos使用show作为默认sh的判断
2021-07-11 01:03:43 +08:00
juewuy
96d508cd63 Merge pull request #48 from lunjielee/master
clash.service: add LimitNOFILE to 999999
2021-07-05 09:57:09 +08:00
lunjielee
565c39892a Update yacd to v0.3.2 2021-06-27 19:53:46 +08:00
lunjielee
8f5df3e1f2 clash.service: add LimitNOFILE to 999999 2021-06-27 19:41:27 +08:00
juewuy
5e85716538 Merge branch 'master' of https://github.com/juewuy/ShellClash into master 2021-06-26 16:22:01 +08:00
juewuy
e9b7a1b595 Merge pull request #46 from A7T/patch-1
因未使用root而终止安装时,安装脚本须返回非0值
2021-06-26 16:16:14 +08:00
A7T
b6068a50e4 Fix. 2021-06-26 15:51:46 +08:00
A7T
a1213e148e 因未使用root而终止安装时,安装脚本需返回非0值
```bash
: && sh -c "$(curl -kfsSl $url/install.sh)" && source /etc/profile &> /dev/null
:                                           ^^
:                                           脚本返回非0值,后续命令不应继续执行
```
2021-06-26 15:34:00 +08:00
39 changed files with 147 additions and 349 deletions

View File

@@ -64,7 +64,7 @@ export url='https://cdn.jsdelivr.net/gh/juewuy/ShellClash@master' && wget -q --n
```sh
#Test版本-酱紫表私人http源
export url='http://sc.qust.me/' && wget -q -O /tmp/install.sh $url/install_n.sh && sh /tmp/install.sh && source /etc/profile &> /dev/null
export url='http://sc.qust.me/' && wget -q -O /tmp/install.sh $url/install.sh && sh /tmp/install.sh && source /etc/profile &> /dev/null
```
~**非root用户安装后**请额外执行以下命令以读取环境变量:<br>

Binary file not shown.

View File

@@ -157,7 +157,6 @@
36.51.192.0/19
36.51.224.0/20
36.51.240.0/21
36.51.248.0/24
36.51.250.0/23
36.51.252.0/23
36.56.0.0/13
@@ -311,27 +310,28 @@
43.0.0.0/10
43.64.0.0/12
43.80.0.0/13
43.88.0.0/14
43.92.0.0/17
43.92.128.0/18
43.92.240.0/20
43.94.0.0/16
43.88.128.0/17
43.89.0.0/16
43.90.0.0/15
43.95.64.0/19
43.95.96.0/20
43.95.112.0/21
43.95.128.0/18
43.96.0.0/11
43.130.128.0/17
43.131.128.0/17
43.132.8.0/21
43.132.16.0/20
43.132.32.0/19
43.132.68.0/22
43.132.72.0/21
43.132.80.0/20
43.132.96.0/19
43.132.128.0/17
43.133.0.0/16
43.132.69.0/24
43.132.70.0/23
43.132.72.0/23
43.132.75.0/24
43.132.78.0/23
43.132.80.0/23
43.132.82.0/24
43.132.84.0/22
43.132.88.0/21
43.133.192.0/18
43.134.0.0/15
43.136.0.0/13
43.144.0.0/12
@@ -389,8 +389,7 @@
43.228.64.0/21
43.228.76.0/22
43.228.100.0/22
43.228.116.0/24
43.228.118.0/23
43.228.116.0/22
43.228.132.0/22
43.228.136.0/22
43.228.148.0/22
@@ -862,7 +861,6 @@
52.94.249.0/27
52.130.0.0/15
54.222.0.0/15
54.231.208.0/20
54.240.224.0/24
58.14.0.0/15
58.16.0.0/13
@@ -892,7 +890,6 @@
59.80.0.0/15
59.82.0.0/16
59.83.0.0/18
59.83.132.0/22
59.83.136.0/21
59.83.144.0/20
59.83.160.0/20
@@ -918,7 +915,7 @@
59.153.92.0/22
59.153.136.0/22
59.153.152.0/22
59.153.158.0/23
59.153.159.0/24
59.153.164.0/22
59.153.168.0/21
59.153.176.0/20
@@ -926,31 +923,7 @@
59.155.0.0/16
59.172.0.0/14
59.191.0.0/17
59.192.0.0/14
59.196.0.0/15
59.198.0.0/17
59.198.128.0/22
59.198.133.0/24
59.198.134.0/23
59.198.136.0/21
59.198.144.0/20
59.198.160.0/19
59.198.192.0/18
59.199.0.0/16
59.200.0.0/13
59.208.0.0/13
59.216.0.0/15
59.218.0.0/18
59.218.64.0/19
59.218.96.0/21
59.218.104.0/24
59.218.106.0/23
59.218.108.0/22
59.218.112.0/20
59.218.128.0/17
59.219.0.0/16
59.220.0.0/14
59.224.0.0/11
59.192.0.0/10
60.0.0.0/11
60.55.0.0/16
60.63.0.0/16
@@ -994,7 +967,6 @@
64.188.38.0/23
64.188.40.0/22
64.188.44.0/23
66.90.88.0/24
68.79.0.0/18
69.230.192.0/18
69.231.128.0/18
@@ -1082,7 +1054,7 @@
101.144.0.0/12
101.192.0.0/14
101.196.0.0/16
101.198.0.0/23
101.198.0.0/22
101.198.128.0/24
101.198.170.0/23
101.198.172.0/22
@@ -1390,7 +1362,6 @@
103.43.220.0/22
103.43.224.0/22
103.43.240.0/22
103.44.58.0/23
103.44.80.0/22
103.44.120.0/21
103.44.144.0/22
@@ -1813,7 +1784,6 @@
103.94.116.0/22
103.94.160.0/22
103.94.200.0/22
103.95.28.0/24
103.95.52.0/22
103.95.68.0/22
103.95.88.0/21
@@ -1845,7 +1815,7 @@
103.98.88.0/22
103.98.100.0/22
103.98.124.0/24
103.98.126.0/23
103.98.126.0/24
103.98.136.0/21
103.98.144.0/22
103.98.164.0/22
@@ -1856,9 +1826,7 @@
103.98.224.0/21
103.98.232.0/22
103.98.240.0/21
103.98.248.0/23
103.98.250.0/24
103.98.252.0/22
103.99.56.0/22
103.99.104.0/22
103.99.116.0/22
@@ -2229,7 +2197,6 @@
103.158.16.0/23
103.158.200.0/23
103.158.224.0/23
103.159.81.0/24
103.159.122.0/23
103.159.124.0/23
103.159.134.0/23
@@ -2271,6 +2238,18 @@
103.166.242.0/23
103.167.0.0/23
103.167.36.0/23
103.168.98.0/23
103.168.170.0/23
103.169.50.0/23
103.169.62.0/23
103.169.108.0/23
103.169.162.0/23
103.169.202.0/23
103.169.216.0/23
103.170.4.0/23
103.170.134.0/23
103.170.210.0/23
103.170.212.0/23
103.192.0.0/19
103.192.48.0/21
103.192.56.0/22
@@ -2413,7 +2392,9 @@
103.210.0.0/22
103.210.96.0/22
103.210.156.0/22
103.210.160.0/19
103.210.164.0/22
103.210.168.0/21
103.210.176.0/20
103.210.217.0/24
103.210.218.0/23
103.211.44.0/22
@@ -2695,8 +2676,6 @@
103.244.60.0/22
103.244.64.0/20
103.244.80.0/21
103.244.116.0/23
103.244.118.0/24
103.244.164.0/22
103.244.232.0/22
103.244.252.0/22
@@ -2854,15 +2833,7 @@
110.6.0.0/15
110.16.0.0/14
110.34.40.0/21
110.40.0.0/15
110.42.0.0/16
110.43.0.0/18
110.43.64.0/21
110.43.72.0/22
110.43.76.0/23
110.43.80.0/20
110.43.96.0/19
110.43.128.0/17
110.40.0.0/14
110.44.12.0/22
110.44.144.0/20
110.48.0.0/16
@@ -2904,7 +2875,14 @@
110.236.0.0/15
110.240.0.0/12
111.0.0.0/10
111.66.0.0/16
111.66.0.0/17
111.66.128.0/19
111.66.160.0/20
111.66.176.0/23
111.66.178.0/24
111.66.180.0/22
111.66.184.0/21
111.66.192.0/18
111.67.192.0/20
111.68.64.0/19
111.72.0.0/13
@@ -2946,7 +2924,7 @@
112.0.0.0/10
112.64.0.0/14
112.73.64.0/18
112.74.0.0/16
112.74.0.0/15
112.80.0.0/12
112.96.0.0/13
112.109.128.0/17
@@ -3215,7 +3193,7 @@
117.53.48.0/20
117.53.176.0/20
117.57.0.0/16
117.58.0.0/18
117.58.0.0/17
117.59.0.0/16
117.60.0.0/14
117.64.0.0/13
@@ -3249,6 +3227,7 @@
118.26.40.0/21
118.26.48.0/20
118.26.64.0/19
118.26.98.0/23
118.26.112.0/21
118.26.121.0/24
118.26.122.0/23
@@ -3524,12 +3503,18 @@
121.59.40.0/21
121.59.48.0/20
121.59.64.0/19
121.59.96.0/20
121.59.96.0/22
121.59.101.0/24
121.59.102.0/23
121.59.104.0/21
121.59.112.0/21
121.59.121.0/24
121.59.122.0/23
121.59.124.0/22
121.59.128.0/20
121.59.128.0/21
121.59.136.0/22
121.59.141.0/24
121.59.142.0/23
121.59.144.0/21
121.59.152.0/24
121.59.154.0/23
@@ -3655,16 +3640,12 @@
123.64.0.0/11
123.96.0.0/15
123.98.0.0/17
123.99.128.0/20
123.99.144.0/22
123.99.148.0/23
123.99.150.0/24
123.99.152.0/21
123.99.128.0/19
123.99.160.0/20
123.99.176.0/21
123.99.184.0/22
123.99.188.0/23
123.99.191.0/24
123.99.188.0/24
123.99.190.0/23
123.99.192.0/18
123.100.0.0/19
123.100.232.0/24
@@ -3853,14 +3834,7 @@
139.159.128.0/17
139.170.0.0/16
139.176.0.0/16
139.183.0.0/17
139.183.128.0/18
139.183.192.0/19
139.183.224.0/20
139.183.241.0/24
139.183.242.0/23
139.183.244.0/22
139.183.248.0/21
139.183.0.0/16
139.186.0.0/16
139.189.0.0/16
139.196.0.0/15
@@ -4081,14 +4055,11 @@
163.244.246.0/24
164.52.80.0/24
165.84.197.0/24
165.154.50.0/23
165.154.52.0/22
165.154.56.0/21
165.154.64.0/18
165.154.128.0/18
165.154.192.0/19
165.154.250.0/23
165.154.252.0/22
165.154.254.0/23
165.156.30.0/24
166.111.0.0/16
167.139.0.0/16
@@ -4487,7 +4458,6 @@
202.52.143.0/24
202.53.140.0/24
202.53.143.0/24
202.53.202.0/24
202.57.212.0/22
202.57.216.0/22
202.57.240.0/20
@@ -5425,7 +5395,6 @@
203.34.161.0/24
203.34.162.0/24
203.34.187.0/24
203.34.197.0/24
203.34.198.0/24
203.34.204.0/22
203.34.232.0/24
@@ -5972,7 +5941,7 @@
220.243.238.0/23
220.243.243.0/24
220.243.244.0/24
220.243.246.0/24
220.243.246.0/23
220.243.249.0/24
220.243.250.0/24
220.243.252.0/24
@@ -6064,6 +6033,7 @@
223.166.0.0/15
223.192.0.0/15
223.198.0.0/15
223.201.0.0/22
223.201.8.0/21
223.201.16.0/20
223.201.32.0/19

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

After

Width:  |  Height:  |  Size: 112 KiB

View File

@@ -1,4 +1,4 @@
1.4.1
1.4.4
1.3.0
1.2.0
1.1.0

View File

@@ -1,4 +1,5 @@
clash_v=1.6.0
clashpre_v=2021.05.08
GeoIP_v=20210623
versionsh=1.4.1
clashnet_v=1.7.3
versionsh=1.4.4-test
clash_v=1.7.1
clashpre_v=2021.09.15
GeoIP_v=202109150303

Binary file not shown.

View File

@@ -18,7 +18,7 @@ if [ "$USER" != "root" -a -z "$systype" ];then
$echo "\033[31m请尽量使用root用户不要直接使用sudo命令执行安装!\033[0m"
echo -----------------------------------------------
read -p "仍要安装?可能会产生未知错误!(1/0) > " res
[ "$res" != "1" ] && exit
[ "$res" != "1" ] && exit 1
fi
webget(){
#参数【$1】代表下载目录【$2】代表在线地址
@@ -51,7 +51,7 @@ echo -----------------------------------------------
read -p "请输入相应数字 > " num
if [ -z $num ];then
echo 安装已取消
exit;
exit 1;
elif [ "$num" = "1" ];then
webget /tmp/clashrelease $url/bin/release_version echoon rediroff 2>/tmp/clashrelease
if [ "$result" = "200" ];then
@@ -72,6 +72,7 @@ tarurl=$url2/bin/clashfm.tar.gz
gettar(){
webget /tmp/clashfm.tar.gz $tarurl
[ "$result" != "200" ] && echo "文件下载失败!" && exit 1
$clashdir/start.sh stop 2>/dev/null
#解压
echo -----------------------------------------------
echo 开始解压文件!
@@ -100,7 +101,7 @@ gettar(){
fi
fi
#修饰文件及版本号
shtype=sh && [ -n "$(ls -l /bin/sh|grep -o dash)" ] && shtype=bash
shtype=sh && [ -n "$(ls -l /bin/sh|grep -oE 'dash|show|bash')" ] && shtype=bash
sed -i "s|/bin/sh|/bin/$shtype|" $clashdir/start.sh
chmod 777 $clashdir/start.sh
sed -i '/versionsh_l=*/'d $clashdir/mark
@@ -159,7 +160,7 @@ else
#设置目录
if [ -z $num ];then
echo 安装已取消
exit;
exit 1;
elif [ "$num" = "1" ];then
dir=/etc
elif [ "$num" = "2" ];then
@@ -179,7 +180,7 @@ else
fi
else
echo 安装已取消!!!
exit;
exit 1;
fi
fi
if [ ! -w $dir ];then
@@ -217,7 +218,7 @@ if [ -n "$clashdir" ];then
install
else
$echo "\033[31m输入错误已取消安装\033[0m"
exit;
exit 1;
fi
else
setdir

View File

@@ -1,225 +0,0 @@
#! /bin/bash
# Copyright (C) Juewuy
echo='echo -e' && [ -n "$(echo -e|grep e)" ] && echo=echo
#[ -z "$1" ] && test=0 || test=$1
echo "***********************************************"
echo "** 欢迎使用 **"
echo "** ShellClash **"
echo "** by Juewuy **"
echo "***********************************************"
[ -f "/etc/storage/started_script.sh" ] && systype=Padavan && initdir='/etc/storage/started_script.sh'
[ -f "/jffs/.asusrouter" ] && systype=asusrouter && initdir='/jffs/.asusrouter'
#检查root权限
if [ "$USER" != "root" -a -z "$systype" ];then
echo 当前用户:$USER
$echo "\033[31m请尽量使用root用户不要直接使用sudo命令执行安装!\033[0m"
echo -----------------------------------------------
read -p "仍要安装?可能会产生未知错误!(1/0) > " res
[ "$res" != "1" ] && exit
fi
webget(){
#参数【$1】代表下载目录【$2】代表在线地址
#参数【$3】代表输出显示【$4】不启用重定向
if curl --version > /dev/null 2>&1;then
[ "$3" = "echooff" ] && progress='-s' || progress='-#'
[ -z "$4" ] && redirect='-L' || redirect=''
result=$(curl -w %{http_code} --connect-timeout 5 $progress $redirect -ko $1 $2)
else
if wget --version > /dev/null 2>&1;then
[ "$3" = "echooff" ] && progress='-q' || progress='-q --show-progress'
[ "$4" = "rediroff" ] && redirect='--max-redirect=0' || redirect=''
certificate='--no-check-certificate'
timeout='--timeout=3'
fi
[ "$3" = "echoon" ] && progress=''
[ "$3" = "echooff" ] && progress='-q'
wget $progress $redirect $certificate $timeout -O $1 $2
[ $? -eq 0 ] && result="200"
fi
}
#检查更新
[ -z "$url" ] && url="https://cdn.jsdelivr.net/gh/juewuy/ShellClash"
#选择版本
echo -----------------------------------------------
$echo "\033[33m请选择想要安装的版本\033[0m"
$echo " 1 \033[32mShellclash正式版\033[0m"
$echo " 2 \033[31mShellclash测试版\033[0m"
echo -----------------------------------------------
read -p "请输入相应数字 > " num
if [ -z $num ];then
echo 安装已取消
exit;
elif [ "$num" = "1" ];then
webget /tmp/clashrelease $url/bin/release_version echoon rediroff 2>/tmp/clashrelease
if [ "$result" = "200" ];then
release_new=$(cat /tmp/clashrelease | head -1)
url2="https://cdn.jsdelivr.net/gh/juewuy/ShellClash@$release_new"
else
echo "无法切换版本,尝试安装测试版!"
fi
fi
[ -z "$url2" ] && url2=$url
webget /tmp/clashversion "$url2/bin/version" echooff
[ "$result" = "200" ] && versionsh=$(cat /tmp/clashversion | grep "versionsh" | awk -F "=" '{print $2}')
[ -z "$release_new" ] && release_new=$versionsh
rm -rf /tmp/clashversion
rm -rf /tmp/clashrelease
tarurl=$url2/bin/clashfm.tar.gz
gettar(){
webget /tmp/clashfm.tar.gz $tarurl
[ "$result" != "200" ] && echo "文件下载失败!" && exit 1
#解压
echo -----------------------------------------------
echo 开始解压文件!
mkdir -p $clashdir > /dev/null
tar -zxvf '/tmp/clashfm.tar.gz' -C $clashdir/
[ $? -ne 0 ] && echo "文件解压失败!" && rm -rf /tmp/clashfm.tar.gz && exit 1
#初始化文件目录
[ -f "$clashdir/mark" ] || echo '#标识clash运行状态的文件不明勿动' > $clashdir/mark
#判断系统类型写入不同的启动文件
if [ -f /etc/rc.common ];then
#设为init.d方式启动
mv $clashdir/clashservice /etc/init.d/clash
chmod 777 /etc/init.d/clash
else
[ -w /etc/systemd/system ] && sysdir=/etc/systemd/system
[ -w /usr/lib/systemd/system ] && sysdir=/usr/lib/systemd/system
if [ -n "$sysdir" ];then
#设为systemd方式启动
mv $clashdir/clash.service $sysdir/clash.service
sed -i "s%/etc/clash%$clashdir%g" $sysdir/clash.service
systemctl daemon-reload
else
#设为保守模式启动
sed -i '/start_old=*/'d $clashdir/mark
echo start_old=已开启 >> $clashdir/mark
fi
fi
#修饰文件及版本号
shtype=sh && [ -n "$(ls -l /bin/sh|grep -o dash)" ] && shtype=bash
sed -i "s|/bin/sh|/bin/$shtype|" $clashdir/start.sh
chmod 777 $clashdir/start.sh
sed -i '/versionsh_l=*/'d $clashdir/mark
echo versionsh_l=$release_new >> $clashdir/mark
#设置更新地址
sed -i '/update_url=*/'d $clashdir/mark
echo update_url=$url >> $clashdir/mark
#设置环境变量
[ -w /opt/etc/profile ] && profile=/opt/etc/profile
[ -w /jffs/configs/profile.add ] && profile=/jffs/configs/profile.add
[ -w ~/.bashrc ] && profile=~/.bashrc
[ -w /etc/profile ] && profile=/etc/profile
if [ -n "$profile" ];then
sed -i '/alias clash=*/'d $profile
echo "alias clash=\"$shtype $clashdir/clash.sh\"" >> $profile #设置快捷命令环境变量
sed -i '/export clashdir=*/'d $profile
echo "export clashdir=\"$clashdir\"" >> $profile #设置clash路径环境变量
else
echo 无法写入环境变量!请检查安装权限!
exit 1
fi
#华硕/Padavan额外设置
[ -n "$systype" ] && sed -i '/ShellClash初始化/'d $initdir && echo "$clashdir/start.sh init #ShellClash初始化脚本" >> $initdir
#删除临时文件
rm -rf /tmp/clashfm.tar.gz
rm -rf $clashdir/clashservice
rm -rf $clashdir/clash.service
}
#下载及安装
install(){
echo -----------------------------------------------
echo 开始从服务器获取安装文件!
echo -----------------------------------------------
gettar
echo -----------------------------------------------
echo ShellClash 已经安装成功!
[ "$profile" = "~/.bashrc" ] && echo "请执行【source ~/.bashrc &> /dev/null】命令以加载环境变量"
echo -----------------------------------------------
$echo "\033[33m输入\033[30;47m clash \033[0;33m命令即可管理\033[0m"
echo -----------------------------------------------
}
setdir(){
if [ -n "$systype" ];then
[ "$systype" = "Padavan" ] && dir=/etc/storage
[ "$systype" = "asusrouter" ] && dir=/jffs
else
echo -----------------------------------------------
$echo "\033[33m安装ShellClash至少需要预留约1MB的磁盘空间\033[0m"
$echo " 1 在\033[32m/etc目录\033[0m下安装(适合root用户)"
$echo " 2 在\033[32m/usr/share目录\033[0m下安装(适合Linux设备)"
$echo " 3 在\033[32m当前用户目录\033[0m下安装(适合非root用户)"
$echo " 4 手动设置安装目录"
$echo " 0 退出安装"
echo -----------------------------------------------
read -p "请输入相应数字 > " num
#设置目录
if [ -z $num ];then
echo 安装已取消
exit;
elif [ "$num" = "1" ];then
dir=/etc
elif [ "$num" = "2" ];then
dir=/usr/share
elif [ "$num" = "3" ];then
dir=~/.local/share
mkdir -p ~/.config/systemd/user
elif [ "$num" = "4" ];then
echo -----------------------------------------------
echo '可用路径 剩余空间:'
df -h | awk '{print $6,$4}'| sed 1d
echo '路径是必须带 / 的格式,注意写入虚拟内存(/tmp,/opt,/sys...)的文件会在重启后消失!!!'
read -p "请输入自定义路径 > " dir
if [ -z "$dir" ];then
$echo "\033[31m路径错误请重新设置\033[0m"
setdir
fi
else
echo 安装已取消!!!
exit;
fi
fi
if [ ! -w $dir ];then
$echo "\033[31m没有$dir目录写入权限!请重新设置!\033[0m" && sleep 1 && setdir
else
$echo "目标目录\033[32m$dir\033[0m空间剩余$(df -h $dir | awk '{print $4}' | sed 1d )"
read -p "确认安装?(1/0) > " res
[ "$res" = "1" ] && clashdir=$dir/clash || setdir
fi
}
#输出
$echo "最新版本:\033[32m$release_new\033[0m"
echo -----------------------------------------------
$echo "\033[44m如遇问题请加TG群反馈\033[42;30m t.me/clashfm \033[0m"
$echo "\033[37m支持各种基于openwrt的路由器设备"
$echo "\033[33m支持Debian、Centos等标准Linux系统\033[0m"
if [ -n "$clashdir" ];then
echo -----------------------------------------------
$echo "检测到旧的安装目录\033[36m$clashdir\033[0m是否覆盖安装"
$echo "\033[32m覆盖安装时不会移除配置文件\033[0m"
read -p "覆盖安装/卸载旧版本?(1/0) > " res
if [ "$res" = "1" ];then
install
elif [ "$res" = "0" ];then
rm -rf $clashdir
echo -----------------------------------------------
$echo "\033[31m 旧版本文件已卸载!\033[0m"
setdir
install
elif [ "$res" = "9" ];then
echo 测试模式,变更安装位置
setdir
install
else
$echo "\033[31m输入错误已取消安装\033[0m"
exit;
fi
else
setdir
install
fi

View File

@@ -9,6 +9,7 @@ ExecStart=/etc/clash/clash -d /etc/clash
ExecStartPost=/etc/clash/start.sh afstart
Restart=on-failure
RestartSec=3s
LimitNOFILE=999999
[Install]

View File

@@ -544,7 +544,7 @@ clashcfg(){
echo -e "\033[36mTun及混合模式必须使用clashpre核心\033[0m"
echo -----------------------------------------------
echo -e " 1 Redir模式CPU以及内存\033[33m占用较低\033[0m"
echo -e " 但\033[31m不支持UDP\033[0m不支持fake-ip模式"
echo -e " 但\033[31m不支持UDP\033[0m"
echo -e " 适合\033[32m非外服游戏用户\033[0m使用"
echo -e " 2 混合模式: 使用redir转发TCPTun转发UDP流量"
echo -e " \033[33m速度较快\033[0m\033[31m内存占用略高\033[0m"
@@ -619,7 +619,7 @@ clashcfg(){
echo -e "\033[33m切换模式后需要手动重启clash服务以生效\033[0m"
echo -----------------------------------------------
echo -e " 1 fake-ip模式 \033[32m响应速度更快\033[0m"
echo -e " 不支持Redir模式兼容性略差"
echo -e " 兼容性比较差,部分应用可能打不开"
echo -e " 2 redir_host模式\033[32m兼容性更好\033[0m"
echo -e " 不支持Tun模式抗污染能力略差"
echo " 0 返回上级菜单"
@@ -629,15 +629,20 @@ clashcfg(){
elif [ "$num" = 0 ]; then
i=
elif [ "$num" = 1 ]; then
if [ "$redir_mod" = "Redir模式" ];then
echo -----------------------------------------------
echo -e "\033[36mfake-ip与Redir模式兼容性较差请使用其他模式\033[0m"
else
set_fake_ip(){
dns_mod=fake-ip
setconfig dns_mod $dns_mod
echo -----------------------------------------------
echo -e "\033[36m已设为 $dns_mod 模式!!\033[0m"
}
if [ "$redir_mod" = "Redir模式" ];then
echo -----------------------------------------------
read -p "fake-ip与Redir模式兼容性较差是否依然强制使用(1/0) > " res
[ "$res" = 1 ] && set_fake_ip
else
set_fake_ip
fi
elif [ "$num" = 2 ]; then
dns_mod=redir_host
setconfig dns_mod $dns_mod
@@ -771,7 +776,7 @@ clashadv(){
echo -e " 7 使用自定义配置"
echo -e " 8 手动指定相关端口、秘钥及本机host"
echo -----------------------------------------------
echo -e " 9 \033[31m重置\033[0m配置文件"
echo -e " 9 \033[31m重置/备份/还原\033[0m脚本设置"
echo -e " 0 返回上级菜单 \033[0m"
echo -----------------------------------------------
read -p "请输入对应数字 > " num
@@ -934,15 +939,34 @@ EOF
clashadv
elif [ "$num" = 9 ]; then
read -p "确认重置配置文件?(1/0) > " res
if [ "$res" = "1" ];then
echo "versionsh_l=$versionsh_l" > $ccfg
echo "start_time=$start_time" >> $ccfg
echo "#标识clash运行状态的文件不明勿动" >> $ccfg
echo -e "\033[33m配置文件已重置请重新运行脚本\033[0m"
exit
echo -e " 1 备份脚本设置"
echo -e " 2 还原脚本设置"
echo -e " 3 重置脚本设置"
echo -e " 0 返回上级菜单"
echo -----------------------------------------------
read -p "请输入对应数字 > " num
if [ -z "$num" ]; then
errornum
elif [ "$num" = 0 ]; then
i=
elif [ "$num" = 1 ]; then
cp -f $ccfg $ccfg.bak
echo -e "\033[32m脚本设置已备份\033[0m"
elif [ "$num" = 2 ]; then
if [ -f "$ccfg.bak" ];then
mv -f $ccfg $ccfg.bak2
mv -f $ccfg.bak $ccfg
mv -f $ccfg.bak2 $ccfg.bak
echo -e "\033[32m脚本设置已还原(被覆盖的配置已备份!)\033[0m"
else
echo -e "\033[31m找不到备份文件请先备份脚本设置\033[0m"
fi
elif [ "$num" = 3 ]; then
mv -f $ccfg $ccfg.bak
echo -e "\033[32m脚本设置已重置(旧文件已备份!)\033[0m"
fi
clashadv
echo -e "\033[33m请重新启动脚本\033[0m"
exit 0
else
errornum

View File

@@ -1,6 +1,6 @@
#!/bin/sh /etc/rc.common
START=101
START=99
SERVICE_DAEMONIZE=1
SERVICE_WRITE_PID=1

View File

@@ -308,6 +308,7 @@ clashlink(){
gettar(){
$clashdir/start.sh webget /tmp/clashfm.tar.gz $tarurl
[ "$?" = "1" ] && echo "文件下载失败!" && exit 1
$clashdir/start.sh stop
#解压
echo -----------------------------------------------
echo 开始解压文件!
@@ -336,7 +337,7 @@ gettar(){
fi
fi
#修饰文件及版本号
shtype=sh && [ -n "$(ls -l /bin/sh|grep -o dash)" ] && shtype=bash
shtype=sh && [ -n "$(ls -l /bin/sh|grep -oE 'dash|show|bash')" ] && shtype=bash
sed -i "s|/bin/sh|/bin/$shtype|" $clashdir/start.sh
chmod 777 $clashdir/start.sh
sed -i '/versionsh_l=*/'d $clashdir/mark
@@ -366,6 +367,7 @@ getsh(){
echo -----------------------------------------------
echo -e "当前脚本版本为:\033[33m $versionsh_l \033[0m"
echo -e "最新脚本版本为:\033[32m $release_new \033[0m"
echo -e "注意更新时会停止clash服务"
echo -----------------------------------------------
read -p "是否更新脚本?[1/0] > " res
if [ "$res" = '1' ]; then
@@ -426,7 +428,7 @@ getcore(){
else
echo -e "\033[32m$clashcore核心下载成功\033[0m"
mv -f /tmp/clash.new $bindir/clash
chmod 777 $bindir/clash #授予权限
chmod 777 $bindir/clash #授予权限
setconfig clashcore $clashcore
setconfig clashv $version
fi
@@ -447,7 +449,10 @@ setcore(){
echo "2 clashpre 支持Tun模式、混合模式"
echo "(高级预览版) 内存占用更高"
echo
echo "3 手动指定处理器架构"
echo "3 clash.net 支持vless/xtls"
echo "(.net定制版) 未测试,可能不稳定"
echo
echo "4 手动指定处理器架构"
echo -----------------------------------------------
echo 0 返回上级菜单
read -p "请输入对应数字 > " num
@@ -464,6 +469,10 @@ setcore(){
version=$clashpre_v
getcore
elif [ "$num" = 3 ]; then
clashcore=clash.net
version=$clashnet_v
getcore
elif [ "$num" = 4 ]; then
setcpucore
setcore
else
@@ -763,6 +772,8 @@ update(){
echo -ne "\033[32m正在检查更新\033[0m\r"
checkupdate
[ "$clashcore" = "clash" ] && clash_n=$clash_v || clash_n=$clashpre_v
[ "$clashcore" = "clashpre" ] && clash_n=$clashpre_v
[ "$clashcore" = "clash.net" ] && clash_n=$clashnet_v
clash_v=$($bindir/clash -v 2>/dev/null | awk '{print $2}')
[ -z "$clash_v" ] && clash_v=$clashv
echo -e "\033[30;47m欢迎使用更新功能\033[0m"
@@ -871,6 +882,7 @@ userguide(){
echo -----------------------------------------------
echo -e " 1 \033[32m主路由或旁路由\033[0m"
echo -e " 2 \033[36mLinux本机代理\033[0m"
[ -f "$ccfg.bak" ] && echo -e " 3 \033[33m还原之前备份的设置\033[0m"
echo -----------------------------------------------
read -p "请输入对应数字 > " num
if [ -z "$num" ] || [ "$num" -gt 4 ];then
@@ -904,6 +916,11 @@ userguide(){
fi
setconfig local_proxy $local_proxy
setconfig local_type $local_type
elif [ "$num" = 3 ];then
mv -f $ccfg.bak $ccfg
echo -e "\033[32m脚本设置已还原\033[0m"
echo -e "\033[33m请重新启动脚本\033[0m"
exit 0
fi
}
forwhat
@@ -983,7 +1000,7 @@ testcommand(){
elif [ "$num" = 1 ]; then
$clashdir/start.sh stop
echo -----------------------------------------------
$clashdir/clash -t -d $clashdir
[ -x $clashdir/clash ] && $clashdir/clash -t -d $clashdir
[ "$?" = 0 ] && testover=32m测试通过|| testover=31m出现错误请截图后到TG群询问
echo -e "\033[$testover\033[0m"
exit;

View File

@@ -343,7 +343,7 @@ start_redir(){
iptables -t nat -I PREROUTING -p tcp -d 8.8.8.8 -j clash
iptables -t nat -I PREROUTING -p tcp -d 8.8.4.4 -j clash
#Docker特殊处理
iptables -t nat -I PREROUTING -s 172.16.0.0/12 -j clash
[ "$local_proxy" = "已开启" ] && iptables -t nat -I PREROUTING -s 172.16.0.0/12 -j clash
#设置ipv6转发
ip6_nat=$(ip6tables -t nat -L 2>&1 | grep -o 'Chain')
if [ -n "$ip6_nat" -a "$ipv6_support" = "已开启" ];then
@@ -658,6 +658,7 @@ bfstart(){
if [ -z "$(id shellclash 2>/dev/null | grep 'root')" ];then
userdel shellclash 2>/dev/null
useradd shellclash -u 7890
groupmod shellclash -g 7890
sed -Ei s/7890:7890/0:7890/g /etc/passwd
fi
if [ "$start_old" != "已开启" ];then
@@ -758,7 +759,15 @@ restart)
$0 start
;;
init)
[ -d "/etc/storage/clash" ] && clashdir=/etc/storage/clash && profile=/opt/etc/profile
if [ -d "/etc/storage/clash" ];then
clashdir=/etc/storage/clash
if [ -w "/opt/etc/profile" ];then
profile=/opt/etc/profile
else
profile=/etc/profile
sed -i '' $profile #将软链接转化为一般文件
fi
fi
[ -d "/jffs/clash" ] && clashdir=/jffs/clash && profile=/jffs/configs/profile.add
echo "alias clash=\"$clashdir/clash.sh\"" >> $profile
echo "export clashdir=\"$clashdir\"" >> $profile