162 Commits
1.6.3 ... 1.7.0

Author SHA1 Message Date
juewuy
d6f90c818f Merge branch 'master' of https://github.com/juewuy/ShellClash into master 2023-02-05 10:26:57 +08:00
juewuy
18d13f2105 1.7.0正式版打包 2023-02-05 10:26:45 +08:00
Bot
80837ace36 自动更新最新Dashboard、地址库、根证书 2023-02-04 09:01:51 +00:00
juewuy
7c07c51993 v1.7.0f
~优化手动上传内核及配置文件读取,修复bug
~NTP地址替换为阿里云纯IP,以适配部分老旧设备
2023-02-03 21:20:06 +08:00
juewuy
ef1fd70a32 v1.7.0e
~现在启动后会自动进行一次系统时间同步(使用ntpd)
~修复错误读取/tmp目录内核及配置文件导致的一系列bug
2023-02-02 12:18:03 +08:00
juewuy
70290746b4 v1.7.0d
~替换自建源与自建Sub服务器域名
~修复/tmp目录检测到多个内核或配置文件时跳出的bug
~其他提示相关修复及优化
2023-02-01 10:53:09 +08:00
juewuy
e98a113b2f v1.7.0d
~替换自建源与自建Sub服务器域名
~修复/tmp目录检测到多个内核或配置文件时跳出的bug
~其他提示相关修复及优化
2023-02-01 10:13:35 +08:00
Bot
c9227d9c36 自动更新最新Dashboard、地址库、根证书 2023-01-28 09:01:43 +00:00
juewuy
7fd3d79669 v1.7.0c
~自动导入/tmp下yaml文件时增加检测机制
~修复未安装面板时启动依然提示本地面板连接信息的bug
2023-01-28 13:05:07 +08:00
juewuy
ac0e024787 v1.7.0b
~修复部分路由设备会出现双进程的bug
~修复GeoSite大小写文件名导致额外下载的bug
2023-01-25 16:35:14 +08:00
juewuy
3f2485dbe4 v1.7.0b
~修复部分路由设备会出现双进程的bug
2023-01-25 16:27:11 +08:00
juewuy
6794271c5e v1.7.0
~优化安装脚本及安装流程
~合并https://github.com/juewuy/ShellClash/pull/309
2023-01-23 17:17:30 +08:00
juewuy
4447244b61 v1.7.0
~优化安装脚本及安装流程
~合并https://github.com/juewuy/ShellClash/pull/309
2023-01-23 16:19:14 +08:00
juewuy
72c9061cff v1.7.0
~优化安装脚本及安装流程
~合并https://github.com/juewuy/ShellClash/pull/309
2023-01-23 16:15:14 +08:00
juewuy
7772e82631 v1.7.0
~优化安装脚本及安装流程
~合并https://github.com/juewuy/ShellClash/pull/309
2023-01-23 16:14:53 +08:00
juewuy
bcf7b347b2 Merge branch 'master' of https://github.com/juewuy/ShellClash into master 2023-01-23 15:38:15 +08:00
juewuy
dc539cb51d v1.7.0
~正式版打包
~合并https://github.com/juewuy/ShellClash/pull/309
2023-01-23 15:38:07 +08:00
juewuy
6b9b83be35 1.7.0 2023-01-23 12:19:59 +08:00
juewuy
daf765f7ee Update README_CN.md 2023-01-23 12:14:34 +08:00
juewuy
fd57de5861 v1.7.0
~修改部分描述
2023-01-23 12:10:49 +08:00
juewuy
a64f00c6bf Merge branch 'master' of https://github.com/juewuy/ShellClash into master 2023-01-23 12:06:25 +08:00
juewuy
1662b9b31a v1.7.0
~修复国内源下载meta内核失败的问题
2023-01-23 12:06:08 +08:00
Bot
69ca9ae4c2 自动更新最新Dashboard、地址库、根证书 2023-01-21 09:01:37 +00:00
juewuy
d2ad04b1c7 修改部分安装源及说明 2023-01-20 15:58:05 +08:00
juewuy
c5f7030ff9 v1.6.16d
~修复在线安装报错的bug
2023-01-20 15:40:48 +08:00
juewuy
95af248016 v1.6.16d
~修复本地安装报错的bug
~手动上传内核时,增加报错机制
2023-01-20 14:59:46 +08:00
juewuy
4124a2e458 v1.6.16d
~修复本地安装报错的bug
~手动上传内核时,增加报错机制
2023-01-20 14:54:46 +08:00
juewuy
15461b3fdd 优化本地安装包名称 2023-01-20 14:04:41 +08:00
juewuy
aa0393f456 v1.6.16c
~修复手动下载内核始终报错的bug
2023-01-20 11:14:59 +08:00
juewuy
a8be67520a Update README.md 2023-01-20 09:34:39 +08:00
juewuy
8524d7a7fb Merge pull request #306 from ericsyj/fix
Update misnap_init.sh
2023-01-20 09:32:09 +08:00
juewuy
4874e3fbe1 v1.6.16c
~修复手动下载内核始终报错的bug
2023-01-19 22:34:24 +08:00
juewuy
bf5bb983c1 v1.6.16c
~核心下载提示及流程优化
~本机代理细节优化
~修复部分情况下不显示版本号的bug
2023-01-19 22:33:38 +08:00
juewuy
77908af189 v1.6.16b
~核心下载提示及流程优化
~本机代理细节优化
~修复部分情况下不显示版本号的bug
2023-01-19 22:19:33 +08:00
juewuy
f27a195bd9 v1.6.16b
~核心下载提示及流程优化
~本机代理细节优化
~修复部分情况下不显示版本号的bug
2023-01-19 22:13:04 +08:00
juewuy
732cee1e59 v1.6.16b
~核心下载提示及流程优化
~本机代理细节优化
~修复部分情况下不显示版本号的bug
2023-01-19 22:02:53 +08:00
juewuy
3ac3fe267f v1.6.16b
~核心下载提示及流程优化
~本机代理细节优化
~修复部分情况下不显示版本号的bug
2023-01-19 22:01:39 +08:00
juewuy
e179241dc2 v1.6.16b
~修复部分设备安装失败的问题
2023-01-19 21:57:11 +08:00
juewuy
b4069661b3 v1.6.16
~修复部分设备安装失败的问题
2023-01-17 23:56:27 +08:00
juewuy
2b2c18ac99 v1.6.16
~增加内核加载机制,现在只需要将任意内核上传至/tmp后(名称必须包含clash-linux)运行脚本即可自动加载
~增加配置文件加载机制,现在只需要将yaml/yml配置文件上传至/tmp后运行脚本即可自动加载
~修复更新时不显示进度条的bug
~修复dash环境安装后脚本运行出错的bug
2023-01-17 19:55:45 +08:00
ericsyj
22361515cf Update misnap_init.sh
启动防火墙时,先检查clash运行状态
2023-01-16 17:35:06 +08:00
juewuy
28dc17cd7e v1.6.15d
~修复脚本内置更新时无法正确更新版本号的bug
~修复dnsmasq转发无法正常禁用的bug
~梅林固件增加对nat-start文件的自启授权,解决脚本无法自启的问题
~修复华硕固件因不支持command命令而导致的一系列问题
2023-01-15 20:59:48 +08:00
juewuy
d9df06b0d9 Merge branch 'master' of https://github.com/juewuy/ShellClash into master 2023-01-15 20:59:25 +08:00
juewuy
69969841d8 v1.6.15c
~修复脚本内置更新时无法正确更新版本号的bug
~修复dnsmasq转发无法正常禁用的bug
~梅林固件增加对nat-start文件的自启授权,解决脚本无法自启的问题
~修复华硕固件因不支持command命令而导致的一系列问题
2023-01-15 20:58:15 +08:00
Bot
b73de1a9aa 自动更新最新Dashboard、地址库、根证书 2023-01-14 09:01:54 +00:00
juewuy
d27ebdb0a8 ~优化安装脚本,适配本地安装
~移除正式版安装
2023-01-13 20:39:59 +08:00
juewuy
28d9fe48c3 v1.6.15
~适配本地安装,增加初始化脚本
~增加内置hosts优化开关(读取本机hosts及劫持NTP)
~更新/下载失败时增加换源跳转
~新手引导路由模式自动设置开机启动
~修复因获取配置文件失败导致脚本运行出错的bug
~部分文本描述优化
2023-01-13 20:37:27 +08:00
juewuy
21a5186940 v1.6.15
~适配本地安装,增加初始化脚本
~增加内置hosts优化开关(读取本机hosts及劫持NTP)
~更新/下载失败时增加换源跳转
~新手引导路由模式自动设置开机启动
~修复因获取配置文件失败导致脚本运行出错的bug
~部分文本描述优化
2023-01-13 20:36:52 +08:00
juewuy
3376b24394 Merge branch 'master' of https://github.com/juewuy/ShellClash into master 2023-01-08 22:05:04 +08:00
juewuy
8e56a7443c 安装脚本优化,后续适配本地安装 2023-01-08 22:04:42 +08:00
juewuy
aae2f0ac18 v1.6.14c
~增加节点绕过功能
~增加nftables依赖检测及自动安装功能(限OpenWrt)
~优化配置文件生成逻辑
…………
~增加CN-IPV6绕过内核功能(https://github.com/juewuy/ShellClash/pull/294)
~修复节点绕过bug
~pre核redirhost模式强制启用域名嗅探
~新手引导部分优化
~在线生成配置下载优化
…………
~增加默认NTP劫持,用于谷歌/Meta设备激活
~增加更多的默认常用端口
~修复配置文件若干原因报错
2023-01-08 22:04:16 +08:00
juewuy
207dbdf8d1 v1.6.14c
~增加节点绕过功能
~增加nftables依赖检测及自动安装功能(限OpenWrt)
~优化配置文件生成逻辑
…………
~增加CN-IPV6绕过内核功能(https://github.com/juewuy/ShellClash/pull/294)
~修复节点绕过bug
~pre核redirhost模式强制启用域名嗅探
~新手引导部分优化
~在线生成配置下载优化
…………
~增加默认NTP劫持,用于谷歌/Meta设备激活
~增加更多的默认常用端口
~修复配置文件若干原因报错
2023-01-08 22:03:36 +08:00
Bot
9fb79b6c32 自动更新最新Dashboard、地址库、根证书 2023-01-07 09:02:03 +00:00
juewuy
08cc386e19 v1.6.14b
~增加节点绕过功能
~增加nftables依赖检测及自动安装功能(限OpenWrt)
~优化配置文件生成逻辑
…………
~增加CN-IPV6绕过内核功能(https://github.com/juewuy/ShellClash/pull/294)
~修复节点绕过bug
~pre核redirhost模式强制启用域名嗅探
~新手引导部分优化
~在线生成配置下载优化
2023-01-01 20:59:56 +08:00
juewuy
39c93ef417 Merge branch 'master' of https://github.com/juewuy/ShellClash into master 2023-01-01 20:26:33 +08:00
juewuy
862af13667 v1.6.14b
~增加节点绕过功能
~增加nftables依赖检测及自动安装功能(限OpenWrt)
~优化配置文件生成逻辑
…………
~修复节点绕过bug
~pre核redirhost模式强制启用域名嗅探
~新手引导部分优化
~在线生成配置下载优化
2023-01-01 20:25:30 +08:00
Bot
31873d25bf 自动更新最新Dashboard、地址库、根证书 2022-12-31 09:01:42 +00:00
Bot
863f37eb99 自动更新最新Dashboard、地址库、根证书 2022-12-24 09:01:35 +00:00
juewuy
1eb9734e86 Merge pull request #294 from embeddedlove/master
support bypass china ipv6 address
2022-12-23 19:46:20 +08:00
embeddedlove
5e703692ee +1 2022-12-21 11:24:06 +08:00
embeddedlove
9f5ab57e75 support bypass china ipv6 address 2022-12-21 11:23:23 +08:00
Bot
6a6bf0e499 自动更新最新Dashboard、地址库、根证书 2022-12-17 09:01:42 +00:00
juewuy
9aec51a267 v1.6.14
~增加节点绕过功能
~增加nftables依赖检测及自动安装功能(限OpenWrt)
~优化配置文件生成逻辑
2022-12-15 20:49:57 +08:00
juewuy
5f1b1bc3cc v1.6.13d
~Tun网卡Redir-host及IPV6支持
~日志推送适配PashDeer
~增加ipv6出口本机IP屏蔽
~安装脚本优化,兼容zsh
~在线生成服务器部分更新调整
2022-12-12 19:23:34 +08:00
juewuy
c4a6909feb v1.6.13d
~Tun网卡Redir-host及IPV6支持
~日志推送适配PashDeer
~增加ipv6出口本机IP屏蔽
~安装脚本优化,兼容zsh
~在线生成服务器部分更新调整
2022-12-12 19:23:11 +08:00
juewuy
5ad7785eae v1.6.13c
~Tun网卡Redir-host及IPV6支持
~日志推送适配PashDeer
~增加ipv6出口本机IP屏蔽
~安装脚本优化,兼容zsh
2022-12-11 22:01:30 +08:00
juewuy
3f0475973c Merge branch 'master' of https://github.com/juewuy/ShellClash into master 2022-12-10 21:21:06 +08:00
juewuy
b0ae77bdf6 v1.6.13b
~Tun网卡Redir-host支持
~日志推送适配PashDeer
~ipv6出口屏蔽本机WAN网卡
~安装脚本优化,兼容zsh
2022-12-10 21:19:47 +08:00
Bot
3c9e6d9255 自动更新最新Dashboard、地址库、根证书 2022-12-10 09:04:35 +00:00
juewuy
a6f60e64a8 v1.6.13b
~Tun网卡Redir-host支持
~日志推送适配PashDeer
~ipv6出口屏蔽本机WAN网卡
2022-12-09 22:40:11 +08:00
juewuy
cc38eeeb47 v1.6.13
~Tun模式Redir-host支持
2022-12-08 22:57:32 +08:00
juewuy
42946a19fc v1.6.12
~内置下载功能防滥用优化
~移除fastgit源
~域名嗅探默认改为未启用
~本机hosts生成优先读取user.yaml
~其他优化及若干bug修复
~修复日志推送导致的部分卡死
2022-12-08 20:36:56 +08:00
juewuy
cdbf02eb9b v1.6.12
~内置下载功能防滥用优化
~移除fastgit源
~域名嗅探默认改为未启用
~本机hosts生成优先读取user.yaml
~其他优化及若干bug修复
2022-12-07 22:30:00 +08:00
juewuy
86c52081cc Merge branch 'master' of https://github.com/juewuy/ShellClash into master 2022-12-07 22:08:24 +08:00
juewuy
886843cca6 v1.6.12
~内置下载功能防滥用优化
~移除fastgit源
~域名嗅探默认改为未启用
~本机hosts生成优先读取user.yaml
~其他优化及若干bug修复
2022-12-07 22:08:05 +08:00
juewuy
4f80fd66f2 v1.6.12
~内置下载功能防滥用优化
~移除fastgit源
~域名嗅探默认改为未启用
~本机hosts生成优先读取user.yaml
~其他优化及若干bug修复
2022-12-07 22:07:37 +08:00
juewuy
0ef13778d4 Update bug_report.yml 2022-12-05 20:59:01 +08:00
juewuy
527127f539 Create feature_request.yml 2022-12-05 20:58:45 +08:00
juewuy
234daf87b3 Update bug_report.yml 2022-12-05 20:54:08 +08:00
juewuy
d5157eb68b Update bug_report.yml 2022-12-05 20:51:02 +08:00
juewuy
1d2744ab3e Update bug_report.yml 2022-12-05 20:49:58 +08:00
juewuy
4527c9deed Merge branch 'master' of https://github.com/juewuy/ShellClash into master 2022-12-05 20:47:30 +08:00
juewuy
c6d17d5742 v1.6.11c
~日志功能优化,增加推送通道
  ·Telegram推送
  ·Bark推送
  ·Pushover推送
~新手引导优化
~ipv6支持优化
~优化内核说明、移除.net内核
~修复日志功能相关bug
~修复ipv6功能部分bug
2022-12-05 20:46:56 +08:00
Bot
0e0ba55f0b 更新Premium内核至2022.11.25 2022-12-05 12:20:52 +00:00
juewuy
cc422abb1e Update update_premium_core.yaml
armv8修改下载源文件名为arm64
2022-12-05 20:18:46 +08:00
juewuy
addccfcb12 v1.6.11
~日志功能优化,增加推送通道
  ·Telegram推送
  ·Bark推送
  ·Pushover推送
~新手引导优化
~ipv6支持优化
2022-12-04 20:54:09 +08:00
Bot
9da78cb31d 自动更新最新Dashboard、地址库、根证书 2022-12-03 09:03:41 +00:00
juewuy
a58820ec76 Merge pull request #287 from oluceps/master
Fix typo in README_CN
2022-12-02 23:14:14 +08:00
oluceps
7b38bf2fc5 fix: typo in README_CN 2022-12-02 22:55:24 +08:00
juewuy
a5bc88db23 Merge branch 'master' of https://github.com/juewuy/ShellClash into master
# Conflicts:
#	bin/version
2022-12-01 23:14:54 +08:00
juewuy
ca40f6bbba v1.6.9
~在线sub增加hysteria协议支持
~尝试适配nft基础模式ipv6支持
~增加ipv6本地地址过滤
~尝试修复延迟启动
~优化内置下载功能
~优化在线配置生成功能
2022-12-01 23:13:24 +08:00
juewuy
70f3256576 v1.6.10
~重写nftables支持,尝试支持全功能ipv6路由
~定时任务增加自定义语句功能
~修复ipv6 tproxy下quic屏蔽
~启动自检优化
~部分功能描述优化
2022-12-01 23:10:49 +08:00
Bot
17e84428a4 自动更新最新Dashboard、地址库、根证书 2022-11-26 09:02:08 +00:00
juewuy
18bb5069ce v1.6.8
~同步最新Meta内核
~同步最新Pre内核,支持域名嗅探
~增加启动管理菜单
~增加延时启动功能
~移除流媒体预解析功能,请用7-4域名嗅探
~域名嗅探功能默认改为为启用状态(限Pre或Meta生效)
~增加小闪存模式自定义目录功能
~内置DNS改为优先读取config.yaml
~新手引导简化调整
~修复正式版无法安装的问题
2022-11-25 21:47:48 +08:00
juewuy
155fb8c970 v1.6.9
~在线sub增加hysteria协议支持
~尝试适配nft基础模式ipv6支持
~增加ipv6本地地址过滤
~尝试修复延迟启动
~优化内置下载功能
~优化在线配置生成功能
2022-11-25 21:47:03 +08:00
juewuy
85d13e2483 Merge branch 'master' of https://github.com/juewuy/ShellClash into master 2022-11-20 20:13:43 +08:00
juewuy
1991ef3489 v1.6.8
~同步最新Meta内核
~同步最新Pre内核,支持域名嗅探
~增加启动管理菜单
~增加延时启动功能
~移除流媒体预解析功能,请用7-4域名嗅探
~域名嗅探功能默认改为为启用状态(限Pre或Meta生效)
~增加小闪存模式自定义目录功能
~内置DNS改为优先读取config.yaml
~新手引导简化调整
~修复正式版无法安装的问题
2022-11-20 20:12:37 +08:00
Bot
c5d7c8d8b1 更新Meta内核至v1.13.2 2022-11-20 11:10:57 +00:00
Bot
a9a0a41448 更新Premium内核至2022.08.26 2022-11-20 11:03:06 +00:00
Bot
d17ca606dd 自动更新最新Dashboard、地址库、根证书 2022-11-19 09:02:27 +00:00
juewuy
301565f8f5 Merge branch 'master' of https://github.com/juewuy/ShellClash into master 2022-11-16 19:49:13 +08:00
juewuy
b863bb6bc4 v1.6.7
~新增Tproxy模式
  ·tcp
  ·MAC过滤
  ·常用端口过滤
  ·CNIP绕过(已修复)
  ·屏蔽QUIC
  ·ipv6支持
~新增Nftables支持
  ·tcp&udp
  ·MAC过滤
  ·常用端口过滤
  ·CNIP绕过
  ·屏蔽QUIC
  ·ipv6支持(未测试)
  ·本机代理
  ·docker代理(未测试)
~移除部分不可用安装源
~修复版本回退功能不可用的问题
~修复部分Linux设备grep命令报错的问题
~尝试修复部分华硕设备无法正常开机启动的问题
~尝试修复部分设备提示ip6tables报错的问题
~修复部分情况下tun模式无法正常代理的问题
2022-11-16 19:49:02 +08:00
Bot
725c052b7c 自动更新最新Dashboard、地址库、根证书 2022-11-15 09:02:35 +00:00
juewuy
df153c9be0 v1.6.6
~新增Tproxy模式
  ·tcp
  ·MAC过滤
  ·常用端口过滤
  ·CNIP绕过
  ·屏蔽QUIC
  ·ipv6支持(未测试)
~新增Nftables支持
  ·tcp&udp
  ·MAC过滤
  ·常用端口过滤
  ·CNIP绕过
  ·屏蔽QUIC
  ·ipv6支持(未测试)
  ·本机代理
  ·docker代理(未测试)
~移除部分不可用安装源
~修复版本回退功能不可用的问题
~修复部分Linux设备grep命令报错的问题
~尝试修复部分华硕设备无法正常开机启动的问题
~尝试修复部分设备提示ip6tables报错的问题
2022-11-13 18:33:32 +08:00
juewuy
13fbc6923f v1.6.6
~新增Tproxy模式
  ·tcp
  ·MAC过滤
  ·常用端口过滤
  ·屏蔽QUIC
  ·ipv6支持(未测试)
~新增Nftables支持
  ·tcp&udp
  ·MAC过滤
  ·常用端口过滤
  ·屏蔽QUIC
  ·ipv6支持(未测试)
  ·本机代理
~修复部分Linux设备grep命令报错的问题
2022-11-13 18:11:22 +08:00
juewuy
7bd23131a3 Merge branch 'master' of https://github.com/juewuy/ShellClash into master 2022-11-12 22:55:03 +08:00
juewuy
3b37c04cb6 v1.6.6
~新增Tproxy模式
  ·tcp
  ·MAC过滤
  ·常用端口过滤
  ·屏蔽QUIC
  ·ipv6支持(未测试)
~新增Nftables支持
  ·tcp&udp
  ·MAC过滤
  ·常用端口过滤
  ·屏蔽QUIC
  ·ipv6支持(未测试)
  ·本机代理(未完成)
~修复部分Linux设备grep命令报错的问题
2022-11-12 22:54:46 +08:00
Bot
b36f324637 自动更新最新Dashboard、地址库、根证书 2022-11-12 09:04:30 +00:00
juewuy
66d230f748 Merge branch 'master' of https://github.com/juewuy/ShellClash into master 2022-11-08 22:07:13 +08:00
juewuy
d48402a101 v1.6.6
~新增Tproxy模式
~新增Nftables支持
2022-11-08 22:06:42 +08:00
Bot
e434b00703 自动更新最新Dashboard、地址库、根证书 2022-11-08 09:02:43 +00:00
juewuy
949c927a8d Merge pull request #267 from Yoshino-s/Yoshino-s-patch-1
fix: duplicated port check
2022-11-07 21:00:21 +08:00
Yoshino-s
a246e41079 fix: duplicated port check 2022-11-07 20:12:17 +08:00
Bot
ce06dc9d45 自动更新最新Dashboard、地址库、根证书 2022-11-05 09:02:49 +00:00
juewuy
7b08547f16 v1.6.6
~新增Tproxy模式
~新增Nftables支持
2022-11-03 16:12:43 +08:00
Bot
3c6a40dae5 自动更新最新Dashboard、地址库、根证书 2022-11-01 09:02:44 +00:00
Bot
258ffc85e0 自动更新最新Dashboard、地址库、根证书 2022-10-29 09:02:37 +00:00
Bot
bfa25f97e1 自动更新最新Dashboard、地址库、根证书 2022-10-25 09:08:24 +00:00
Bot
99b738da18 自动更新最新Dashboard、地址库、根证书 2022-10-22 09:05:13 +00:00
Bot
6ab2f27fc6 自动更新最新Dashboard、地址库、根证书 2022-10-18 09:08:46 +00:00
Bot
cede36be16 自动更新最新Dashboard、地址库、根证书 2022-10-15 09:04:46 +00:00
Bot
dead1a2d84 自动更新最新Dashboard、地址库、根证书 2022-10-11 09:05:57 +00:00
Bot
3b09e06c2c 自动更新最新Dashboard、地址库、根证书 2022-10-08 09:04:28 +00:00
Bot
4aaa809aad 自动更新最新Dashboard、地址库、根证书 2022-10-04 09:05:29 +00:00
Bot
52d2d7f25e 自动更新最新Dashboard、地址库、根证书 2022-10-01 09:05:00 +00:00
Bot
f683608cf3 自动更新最新Dashboard、地址库、根证书 2022-09-27 09:07:44 +00:00
Bot
e0a7f79e80 自动更新最新Dashboard、地址库、根证书 2022-09-24 09:03:04 +00:00
juewuy
b357d312f7 v1.6.5
~适配华硕官方固件(自启需插入任意USB设备)
~优化梅林固件自启逻辑
~优化小米设备安装目录选择
~增加安装到外置存储选项
~修复部分设备时间显示异常的bug
~修复部分设备环境变量配置重复的bug
~修复若干小bug
2022-09-23 19:14:22 +08:00
juewuy
27e6563d2c v1.6.4
~适配华硕官方固件(自启需插入任意USB设备)
~优化梅林固件自启逻辑
~优化小米设备安装目录选择
~增加安装到外置存储选项
~修复部分设备时间显示异常的bug
~修复部分设备环境变量配置重复的bug
2022-09-22 21:42:25 +08:00
juewuy
7fef15b4a8 v1.6.4
~适配华硕官方固件(自启需插入任意USB设备)
~优化梅林固件自启逻辑
~优化小米设备安装目录选择
~增加安装到外置存储选项
~修复部分设备时间显示异常的bug
~修复部分设备环境变量配置重复的bug
2022-09-22 20:37:08 +08:00
juewuy
eee0f06faf v1.6.4
~适配华硕官方固件(自启需插入任意USB设备)
~优化梅林固件自启逻辑
~优化小米设备安装目录选择
~增加安装到外置存储选项
~修复部分设备时间显示异常的bug
~修复部分设备环境变量配置重复的bug
2022-09-22 20:36:53 +08:00
Bot
0c659083dc 自动更新最新Dashboard、地址库、根证书 2022-09-20 09:05:57 +00:00
juewuy
d0d8cd57eb Merge pull request #232 from luckyyyyy/master
disabled dnsmasq resolv interface dns
2022-09-17 19:19:10 +08:00
William Chan
599fd0ccc9 disabled dnsmasq resolv interface dns
Signed-off-by: William Chan <root@williamchan.me>
2022-09-17 19:08:29 +08:00
juewuy
e711ad117f Merge pull request #228 from luckyyyyy/master
use uci commit written to openwrt flash
2022-09-17 18:34:32 +08:00
William Chan
63307cf67c use uci commit written to openwrt flash 2022-09-17 18:22:17 +08:00
Bot
b33d7daaa1 自动更新最新Dashboard、地址库、根证书 2022-09-17 09:02:50 +00:00
juewuy
e2691a522b Merge pull request #230 from wuxs/master
fix: repeated add clash alias and $clashdir
2022-09-16 18:01:38 +08:00
wuxs
651f21c7b6 fix: repeated add clash alias and $clashdir 2022-09-16 17:45:17 +08:00
juewuy
392b8f6877 Merge pull request #229 from BetaXOi/master
增加自定义代理和自定义策略
2022-09-16 17:01:58 +08:00
Ning Bo
f3ccaeb429 增加自定义代理和自定义策略
Signed-off-by: BetaXO <n.b@live.com>
2022-09-16 14:02:00 +08:00
Bot
c8205cabde 自动更新最新Dashboard、地址库、根证书 2022-09-13 09:03:59 +00:00
Bot
699068edd5 自动更新最新Dashboard、地址库、根证书 2022-09-10 09:02:40 +00:00
Bot
963af05d75 自动更新最新Dashboard、地址库、根证书 2022-09-06 09:02:59 +00:00
Bot
822cd6b8a2 自动更新最新Dashboard、地址库、根证书 2022-09-03 09:02:24 +00:00
Bot
59afb42f6e 自动更新最新Dashboard、地址库、根证书 2022-08-30 09:02:28 +00:00
Bot
a20b3284d1 自动更新最新Dashboard、地址库、根证书 2022-08-27 09:02:28 +00:00
Bot
4a4526fc09 自动更新最新Dashboard、地址库、根证书 2022-08-23 09:02:21 +00:00
Bot
9514cb56ff 自动更新最新Dashboard、地址库、根证书 2022-08-20 09:02:30 +00:00
Bot
85ca15eb76 自动更新最新Dashboard、地址库、根证书 2022-08-16 09:02:41 +00:00
Bot
8ff716488b 自动更新最新Dashboard、地址库、根证书 2022-08-13 09:02:27 +00:00
Bot
303df9a757 自动更新最新Dashboard、地址库、根证书 2022-08-09 09:02:34 +00:00
Bot
89a251dfad 自动更新最新Dashboard、地址库、根证书 2022-08-06 09:02:29 +00:00
Bot
87628ff36b 自动更新最新Dashboard、地址库、根证书 2022-08-02 09:02:29 +00:00
Bot
677de581f6 自动更新最新Dashboard、地址库、根证书 2022-07-30 09:02:25 +00:00
Bot
191be63049 自动更新最新Dashboard、地址库、根证书 2022-07-26 09:02:24 +00:00
Bot
9f643170d1 自动更新最新Dashboard、地址库、根证书 2022-07-23 09:02:18 +00:00
juewuy
d4549ba582 Merge pull request #200 from AnyOfYou/master
小米设备软固化 SSH 时备份还原 authorized_keys
2022-07-22 10:25:13 +08:00
Lucas Liu
651dec0914 小米设备软固化SSH时备份还原authorized_keys 2022-07-22 04:12:10 +08:00
Bot
ce1b4cb926 自动更新最新Dashboard、地址库、根证书 2022-07-19 09:03:42 +00:00
Bot
8f6a41cbed 自动更新最新Dashboard、地址库、根证书 2022-07-16 09:02:27 +00:00
Bot
9b8d364b46 自动更新最新Dashboard、地址库、根证书 2022-07-12 09:02:20 +00:00
40 changed files with 33987 additions and 28180 deletions

32
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@@ -0,0 +1,32 @@
name: Feature report
description: Suggest an idea for this project
title: "[Feature] "
body:
- type: checkboxes
id: ensure
attributes:
label: Verify steps
description: "
在提交之前,请确认
Please verify that you've followed these steps
"
options:
- label: "
我已经在 [Issue Tracker](……/) 中找过我要提出的问题
I have searched on the [issue tracker](……/) for a related issue.
"
required: true
- label: "
我已经使用公测版本测试过,问题依旧存在
I have tested using the test mod, and the issue still exists.
"
required: true
- label: "
我已经仔细看过 [常见问题](https://juewuy.github.io/chang-jian-wen-ti/) 并无法自行解决问题
"
required: true
- type: textarea
attributes:
label: Description
validations:
required: true

View File

@@ -0,0 +1,33 @@
name: Bug report
description: Create a report to help us improve
title: "[Bug] "
body:
- type: checkboxes
id: ensure
attributes:
label: Verify steps
description: "
在提交之前,请确认
Please verify that you've followed these steps
"
options:
- label: "
我已经在 [Issue Tracker](……/) 中找过我要提出的问题
I have searched on the [issue tracker](……/) for a related issue.
"
required: true
- label: "
我已经使用公测版本测试过,问题依旧存在
I have tested using the test mod, and the issue still exists.
"
required: true
- label: "
我已经仔细看过 [常见问题](https://juewuy.github.io/chang-jian-wen-ti/) 并无法自行解决问题
"
required: true
- type: textarea
attributes:
label: Description
description: 请详细、清晰地表达你要提出的论述例如这个问题如何影响到你你想实现什么功能目前ShellClash的行为是什么
validations:
required: true

View File

@@ -9,7 +9,7 @@ on:
# branches:
# - master
schedule:
- cron: 0 9 * * 2,6
- cron: 0 9 * * 6
# watch:
# types: [started]
workflow_dispatch:
@@ -88,6 +88,7 @@ jobs:
curl -kfSL -O https://raw.githubusercontent.com/alecthw/mmdb_china_ip_list/release/Country.mmdb
curl -kfSL -o cn_mini.mmdb https://raw.githubusercontent.com/Hackl0us/GeoIP2-CN/release/Country.mmdb
curl -kfSL -o china_ip_list.txt https://raw.githubusercontent.com/17mon/china_ip_list/master/china_ip_list.txt
curl -kfSL -o china_ipv6_list.txt https://raw.githubusercontent.com/ChanthMiao/China-IPv6-List/release/cn6.txt
curl -kfSL -O https://raw.githubusercontent.com/P3TERX/ca-certificates.crt/download/ca-certificates.crt
curl -kfSL -O https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geosite.dat
sed -i '/GeoIP_v*/'d version

View File

@@ -23,7 +23,7 @@ jobs:
tar xf upx-3.93-amd64_linux.tar.xz
- name: Download Core
run: |
archs="386 amd64 armv5 armv7 armv8 mips-softfloat mipsle-hardfloat mipsle-softfloat"
archs="386 amd64 armv5 armv7 arm64 mips-softfloat mipsle-hardfloat mipsle-softfloat"
mkdir tmp
for arch in ${archs};do
wget "${download_url}/${download_version}/clash-linux-${arch}-${download_version}.gz" -O - | gunzip -c > ./tmp/clash-linux-${arch}
@@ -36,6 +36,7 @@ jobs:
fi
fi
done
mv -f ./tmp/clash-linux-arm64 ./tmp/clash-linux-armv8
rm -fr upx*
- name: Update
run: |

108
README.md
View File

@@ -23,113 +23,5 @@
~Support various router devices based on OpenWrt or secondary custom development using OpenWrt<br>~Support various devices running standard Linux systems (such as Debian/CenOS/Armbian, etc.)<br>~Compatible with Padavan firmware (conservative mode), Pandora firmware<br>~Compatible with various types of devices customized and developed using the Linux kernel<br>——————————<br>~For more device support, please submit an issue or go to the TG group for feedback (the device name and the device core information returned by running uname -a must be provided)<br>
How to use:
--
~Confirm that the router device has enabled SSH and obtained root privileges (Linux devices with GUI desktops can be installed using their own terminal)<br>~Use SSH connection tools (such as putty, JuiceSSH, system built-in terminal, etc.) router or Linux device SSH management interface or terminal interface, and switch to the root user<br>~Confirm that the curl or wget download tool has been installed on the device. If not installed, please [refer to here](https://www.howtoforge.com/install-curl-in-linux) for LInux devices to install curl. For devices based on OpenWrt (Xiaomi official system, Pandora, Gaoke, etc.), please Use the following command to install curl:<br>
```Shell
opkg update && opkg install curl
```
~ Then execute the following installation commands on the SSH interface, and follow the subsequent prompts to complete the installation<br>
##### ~Use curl:<br>
```Shell
#by fastgit.org
export url='https://raw.fastgit.org/juewuy/ShellClash/master' && sh -c "$(curl -kfsSl $url/install.sh)" && source /etc/profile &> /dev/null
```
```shell
#by GitHub
export url='https://raw.githubusercontent.com/juewuy/ShellClash/master' && sh -c "$(curl -kfsSl $url/install.sh)" && source /etc/profile &> /dev/null
```
```shell
#by jsDelivr-CDN
export url='https://fastly.jsdelivr.net/gh/juewuy/ShellClash@master' && sh -c "$(curl -kfsSl $url/install.sh)" && source /etc/profile &> /dev/null
```
##### ~Use wget<br>
```Shell
#by GitHub
export url='https://raw.githubusercontent.com/juewuy/ShellClash/master' && wget -q --no-check-certificate -O /tmp/install.sh $url/install.sh && sh /tmp/install.sh && source /etc/profile &> /dev/null
```
```shell
#By jsDelivrCDN
export url='https://fastly.jsdelivr.net/gh/juewuy/ShellClash@master' && wget -q --no-check-certificate -O /tmp/install.sh $url/install.sh && sh /tmp/install.sh && source /etc/profile &> /dev/null
```
~**Use a low version of wget (prompt not to support https) local installation**:<br>
```Shell
#by shellclash.cf
export url='http://shellclash.cf/' && wget -q -O /tmp/install.sh $url/install.sh && sh /tmp/install.sh && source /etc/profile &> /dev/null
```
~**After installation by non-root users**, please execute the following additional commands to read environment variables:<br>
```Shell
source ~/.bashrc &> /dev/null
```
~After installing the management script, execute the following command to **run the management script**<br>
```Shell
clash #normal mode
clash -h #help
clash -u #uninstall
clash -t #test mode
```
~**Install in Docker**<br>
Use: https://github.com/echvoyager/shellclash_docker
~**Additional dependencies at runtime**<br>
> Most of the equipment/systems are pre-installed with most of the following dependencies, you can ignore them if there is no impact when you use them.
```Text
bash/ash necessary Cannot install and run scripts when all are missing
curl/wget necessary When all are missing, it cannot be installed and updated online
iptables important Only use pure mode when missing
systemd/rc.common general Only use conservative mode when all are missing
iptables-mod-nat general Cannot use redir mode, mixed mode when missing
ip6tables-mod-nat lower Affects redir mode when missing, mixed mode support for ipv6
crontab lower Cannot enable timing task function when missing
net-tools minimal Cannot detect port occupancy normally when missing
ubus/iproute-doc minimal The host address of the machine cannot be obtained normally when missing
```
## Update log:
### [Click to view](https://github.com/juewuy/ShellClash/releases)
## Exchange feedback:
### [TG Discussion Group](https://t.me/ShellClash)
## Related Q&A:
### [See blog for details](https://juewuy.github.io)
## Donate
Alipay WeChat
##### <img src="http://juewuy.github.io/post-images/1604390977172.png" style="zoom:50%;" /><img src="http://juewuy.github.io/post-images/1604391042406.png" style="zoom:50%;" />
机场推荐:
--
#### [Catnet](https://dash.catnet.uk/#/register?code=KOhfH9qD)<br>
#### [Dler](https://dler.best/auth/register?affid=89698)<br>

View File

@@ -32,96 +32,99 @@
——————————<br>
~更多设备支持请提issue或前往TG群反馈需提供设备名称及运行uname -a返回的设备核心信息<br>
使用方式
--
~确认路由器设备已经开启SSH并获取root权限带GUI桌面的Linux设备可使用自带终端安装<br>
~使用SSH连接工具如puttyJuiceSSH系统自带终端等路由器或Linux设备的SSH管理界面或终端界面并切换到root用户<br>
~确认设备已经安装curl或者wget下载工具。**如未安装**LInux设备请[参考此处](https://www.howtoing.com/install-curl-in-linux)安装curl基于OpenWrt小米官方系统、潘多拉、高恪等的设备请使用如下命令安装curl<br>
## 常见问题
```Shell
opkg update && opkg install curl #如已安装请忽略
```
[ShellClash常见问题 | Juewuy's Blog](https://juewuy.github.io/chang-jian-wen-ti/)
~之后在SSH界面执行如下安装命令并按照后续提示完成安装<br>
## 使用方式:
~确认设备已经开启SSH并获取root权限带GUI桌面的Linux设备可使用自带终端安装<br>
~使用SSH连接工具如puttyJuiceSSH系统自带终端等路由器或Linux设备的SSH管理界面或终端界面
~之后在SSH界面执行目标设备对应的安装命令并按照后续提示完成安装<br>
### 在线安装:<br>
**如无法连接或出现SSL连接错误请尝试更换各种不同的安装源**<br>
~**使用curl安装**<br>
```Shell
#fastgit.org加速
export url='https://raw.fastgit.org/juewuy/ShellClash/master' && sh -c "$(curl -kfsSl $url/install.sh)" && source /etc/profile &> /dev/null
```
~**标准Linux设备安装**<br>
```shell
#GitHub源
export url='https://raw.githubusercontent.com/juewuy/ShellClash/master' && sh -c "$(curl -kfsSl $url/install.sh)" && source /etc/profile &> /dev/null
sudo -i #切换到root用户如果需要密码请输入密码
export url='https://fastly.jsdelivr.net/gh/juewuy/ShellClash@master' && wget -q --no-check-certificate -O /tmp/install.sh $url/install.sh && bash /tmp/install.sh && source /etc/profile &> /dev/null
```
或者
```shell
sudo -i #切换到root用户如果需要密码请输入密码
export url='https://gh.jwsc.eu.org/master' && bash -c "$(curl -kfsSl $url/install.sh)" && source /etc/profile &> /dev/null
```
~**路由设备使用curl安装**<br>
```shell
#GitHub源(可能需要代理)
export url='https://raw.githubusercontent.com/juewuy/ShellClash/master' && sh -c "$(curl -kfsSl $url/install.sh)" && source /etc/profile &> /dev/null
```
或者
```shell
#jsDelivrCDN源
export url='https://fastly.jsdelivr.net/gh/juewuy/ShellClash@master' && sh -c "$(curl -kfsSl $url/install.sh)" && source /etc/profile &> /dev/null
```
或者
```shell
#作者私人源
export url='https://shellclash.cf' && 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>
```Shell
#GitHub源
#GitHub源(可能需要代理)
export url='https://raw.githubusercontent.com/juewuy/ShellClash/master' && wget -q --no-check-certificate -O /tmp/install.sh $url/install.sh && sh /tmp/install.sh && source /etc/profile &> /dev/null
```
或者
```shell
#jsDelivrCDN源
export url='https://fastly.jsdelivr.net/gh/juewuy/ShellClash@master' && wget -q --no-check-certificate -O /tmp/install.sh $url/install.sh && sh /tmp/install.sh && source /etc/profile &> /dev/null
```
```shell
#fastgit.org加速
export url='https://raw.fastgit.org/juewuy/ShellClash/master' && wget -q -O /tmp/install.sh $url/install.sh && sh /tmp/install.sh && source /etc/profile &> /dev/null
```
~**使用低版本wget提示不支持https安装**<br>
~**老旧设备使用低版本wge安装**<br>
```Shell
#作者私人http源
export url='http://shellclash.cf/' && wget -q -O /tmp/install.sh $url/install.sh && sh /tmp/install.sh && source /etc/profile &> /dev/null
```
~**非root用户安装后**请额外执行以下命令以读取环境变量:<br>
```Shell
source ~/.bashrc &> /dev/null
```
~安装完成管理脚本后,执行如下命令以**运行管理脚本**<br>
```Shell
clash #正常模式运行
clash -h #脚本帮助及说明
clash -u #卸载脚本
clash -t #测试模式运行
#作者私人http内测
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>
请参考https://github.com/echvoyager/shellclash_docker
请参考 [ShellClash_docker 一键脚本和镜像](https://github.com/echvoyager/shellclash_docker)
~**运行时的额外依赖**<br>
### **本地安装:**<br>
如使用在线安装出现问题,请参考:[本地安装ShellClash的教程 | Juewuy's Blog](https://juewuy.github.io/bdaz) 使用本地安装!<br>
### 使用脚本:<br>
安装完成管理脚本后,执行如下命令使用~
```Shell
clash #进入对话脚本
clash -h #脚本帮助及说明
clash -u #卸载脚本
clash -t #测试模式运行
clash -s start #启动服务
clash -s stop #停止服务
```
#### **运行时的额外依赖**<br>
> 大部分的设备/系统都已经预装了以下的大部分依赖,使用时如无影响可以无视之
```Text
bash/ash 必须 全部缺少时无法安装及运行脚本
```shell
curl/wget 必须 全部缺少时无法在线安装及更新,无法使用节点保存功能
iptables 重要 缺少时只能使用纯净模式
systemd/rc.common 一般 全部缺少时只能使用保守模式
iptables-mod-nat 一般 缺少时无法使用redir模式混合模式
ip6tables-mod-nat 较低 缺少时影响redir模式混合模式对ipv6的支持
iptables/nftables 重要 缺少时只能使用纯净模式
crontab 较低 缺少时无法启用定时任务功能
net-tools 极低 缺少时无法正常检测端口占用
ubus/iproute-doc 极低 缺少时无法正常获取本机host地址
@@ -138,11 +141,6 @@ ubus/iproute-doc 极低 缺少时无法正常获取本机host地址
--
### [TG讨论组](https://t.me/ShellClash)
相关Q&A
--
### [详见博客](https://juewuy.github.io)
## 请喝杯茶:
支付宝 微信
@@ -151,5 +149,5 @@ ubus/iproute-doc 极低 缺少时无法正常获取本机host地址
机场推荐:
--
#### [梦迪-高速专线,流媒体解锁,月付推荐](https://dash.catnet.uk/#/register?code=KOhfH9qD)<br>
#### [墙洞-老牌稳定,流媒体解锁,年付推荐](https://dler.best/auth/register?affid=89698)<br>
#### [大米-群友力荐,流媒体解锁,月付推荐](https://bigme.pro/auth/register?code=tdXp)<br>
#### [Dler-老牌稳定,流媒体解锁,年付推荐](https://dler.best/auth/register?affid=89698)<br>

Binary file not shown.

BIN
bin/ShellClash.tar.gz Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

1605
bin/china_ipv6_list.txt Normal file

File diff suppressed because it is too large Load Diff

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: 114 KiB

After

Width:  |  Height:  |  Size: 115 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

View File

@@ -1,3 +1,4 @@
1.7.0
1.6.3
1.5.1
1.3.0

View File

@@ -1,6 +1,6 @@
clashnet_v=v1.7.6
clashpre_v=2021.09.15
clashpre_v=2022.11.25
clash_v=v1.7.1
meta_v=v1.12.0
versionsh=1.6.3
GeoIP_v=20220709
meta_v=v1.13.2
versionsh=1.7.0f
GeoIP_v=20230204

Binary file not shown.

View File

@@ -1,14 +1,15 @@
#! /bin/bash
# Copyright (C) Juewuy
type bash &>/dev/null && shtype=bash || shtype=sh
echo='echo -e' && [ -n "$(echo -e|grep e)" ] && echo=echo
#[ -z "$1" ] && test=0 || test=$1
echo "***********************************************"
echo "** 欢迎使用 **"
echo "** ShellClash **"
echo "** by Juewuy **"
echo "***********************************************"
#内置工具
dir_avail(){
df -h $1 |awk '{ for(i=1;i<=NF;i++){ if(NR==1){ arr[i]=$i; }else{ arr[i]=arr[i]" "$i; } } } END{ for(i=1;i<=NF;i++){ print arr[i]; } }' |grep Ava |awk '{print $2}'
}
@@ -16,22 +17,6 @@ setconfig(){
configpath=$clashdir/mark
[ -n "$(grep ${1} $configpath)" ] && sed -i "s#${1}=.*#${1}=${2}#g" $configpath || echo "${1}=${2}" >> $configpath
}
[ -f "/etc/storage/started_script.sh" ] && systype=Padavan && initdir='/etc/storage/started_script.sh'
[ -d "/jffs" ] && systype=asusrouter && {
[ -f "/jffs/.asusrouter" ] && initdir='/jffs/.asusrouter'
[ -d "/jffs/scripts" ] && initdir='/jffs/scripts/nat-start'
[ -z "$initdir" ] && initdir='/jffs/scripts/nat-start' && mkdir -p '/jffs/scripts'
}
[ -f "/data/etc/crontabs/root" -a "$(dir_avail /etc)" = 0 ] && systype=mi_snapshot
#检查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 1
fi
webget(){
#参数【$1】代表下载目录【$2】代表在线地址
#参数【$3】代表输出显示【$4】不启用重定向
@@ -53,132 +38,103 @@ webget(){
[ $? -eq 0 ] && result="200"
fi
}
#检查更新
url_cdn="https://raw.githubusercontents.com/juewuy/ShellClash"
[ -z "$url" ] && url=$url_cdn
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 1;
elif [ "$num" = "1" ];then
webget /tmp/clashrelease $url_cdn/master/bin/release_version echoon rediroff 2>/tmp/clashrelease
if [ "$result" = "200" ];then
release_new=$(cat /tmp/clashrelease | head -1)
url_dl="$url_cdn/$release_new"
else
echo "无法切换版本,尝试安装测试版!"
fi
fi
[ -z "$url_dl" ] && url_dl=$url
webget /tmp/clashversion "$url_dl/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=$url_dl/bin/clashfm.tar.gz
error_down(){
$echo "请参考 \033[32mhttps://github.com/juewuy/ShellClash/blob/master/README_CN.md"
$echo "\033[33m使用其他安装源重新安装\033[0m"
}
#安装及初始化
gettar(){
webget /tmp/clashfm.tar.gz $tarurl
[ "$result" != "200" ] && echo "文件下载失败,请尝试使用其他安装源!" && exit 1
$clashdir/start.sh stop 2>/dev/null
#解压
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方式启动
cp -f $clashdir/clashservice /etc/init.d/clash
chmod 755 /etc/init.d/clash
webget /tmp/ShellClash.tar.gz $tarurl
if [ "$result" != "200" ];then
$echo "\033[33m文件下载失败\033[0m"
error_down
exit 1
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
$clashdir/start.sh stop 2>/dev/null
#解压
echo -----------------------------------------------
echo 开始解压文件!
mkdir -p $clashdir > /dev/null
tar -zxvf '/tmp/ShellClash.tar.gz' -C $clashdir/
if [ $? -ne 0 ];then
rm -rf /tmp/ShellClash.tar.gz
$echo "\033[33m文件解压失败\033[0m"
error_down
exit 1
else
#设为保守模式启动
setconfig start_old 已开启
source $clashdir/init.sh >/dev/null
fi
fi
#修饰文件及版本号
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 755 $clashdir/start.sh
setconfig versionsh_l $release_new
#设置更新地址
[ -n "$url" ] && setconfig update_url $url
#设置环境变量
[ -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 "$initdir" ] && {
sed -i '/ShellClash初始化/'d $initdir && touch $initdir && echo "$clashdir/start.sh init #ShellClash初始化脚本" >> $initdir
setconfig initdir $initdir
}
#小米镜像化OpenWrt额外设置
if [ "$systype" = "mi_snapshot" ];then
chmod 755 $clashdir/misnap_init.sh
uci set firewall.ShellClash=include
uci set firewall.ShellClash.type='script'
uci set firewall.ShellClash.path='/data/clash/misnap_init.sh'
uci set firewall.ShellClash.enabled='1'
uci commit firewall
setconfig systype $systype
else
rm -rf $clashdir/misnap_init.sh
rm -rf $clashdir/clashservice
fi
#删除临时文件
rm -rf /tmp/clashfm.tar.gz
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(){
set_usb_dir(){
$echo "请选择安装目录"
du -hL /mnt | awk '{print " "NR" "$2" "$1}'
read -p "请输入相应数字 > " num
dir=$(du -hL /mnt | awk '{print $2}' | sed -n "$num"p)
if [ -z "$dir" ];then
$echo "\033[31m输入错误请重新设置\033[0m"
set_usb_dir
fi
}
echo -----------------------------------------------
if [ -n "$systype" ];then
[ "$systype" = "Padavan" ] && dir=/etc/storage
[ "$systype" = "asusrouter" ] && dir=/jffs
[ "$systype" = "mi_snapshot" ] && dir=/data
[ "$systype" = "mi_snapshot" ] && {
$echo "\033[33m检测到当前设备为小米官方系统请选择安装位置\033[0m"
$echo " 1 安装到/data目录(推荐,支持软固化功能)"
$echo " 2 安装到USB设备(支持软固化功能)"
[ "$(dir_avail /etc)" != 0 ] && $echo " 3 安装到/etc目录(不推荐)"
$echo " 0 退出安装"
echo -----------------------------------------------
read -p "请输入相应数字 > " num
case "$num" in
1)
dir=/data
;;
2)
set_usb_dir ;;
3)
if [ "$(dir_avail /etc)" != 0 ];then
dir=/etc
systype=""
else
$echo "\033[31m你的设备不支持安装到/etc目录已改为安装到/data\033[0m"
dir=data
fi
;;
*)
exit 1 ;;
esac
}
[ "$systype" = "asusrouter" ] && {
$echo "\033[33m检测到当前设备为华硕固件请选择安装方式\033[0m"
$echo " 1 基于USB设备安装(通用,须插入\033[31m任意\033[0mUSB设备)"
$echo " 2 基于自启脚本安装(仅支持梅林及部分官改固件)"
$echo " 0 退出安装"
echo -----------------------------------------------
read -p "请输入相应数字 > " num
case "$num" in
1)
read -p "将脚本安装到USB存储/系统闪存?(1/0) > " res
[ "$res" = "1" ] && set_usb_dir || dir=/jffs
usb_status=1
;;
2)
$echo "如无法正常开机启动请重新使用USB方式安装"
sleep 2
dir=/jffs ;;
*)
exit 1 ;;
esac
}
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 " 2 在\033[32m/usr/share目录\033[0m下安装(适合Linux系统)"
$echo " 3 在\033[32m当前用户目录\033[0m下安装(适合非root用户)"
$echo " 4 手动设置安装目录"
$echo " 4 在\033[32m外置存储\033[0m中安装"
$echo " 5 手动设置安装目录"
$echo " 0 退出安装"
echo -----------------------------------------------
read -p "请输入相应数字 > " num
@@ -194,6 +150,8 @@ else
dir=~/.local/share
mkdir -p ~/.config/systemd/user
elif [ "$num" = "4" ];then
set_usb_dir
elif [ "$num" = "5" ];then
echo -----------------------------------------------
echo '可用路径 剩余空间:'
df -h | awk '{print $6,$4}'| sed 1d
@@ -217,6 +175,67 @@ else
[ "$res" = "1" ] && clashdir=$dir/clash || setdir
fi
}
install(){
echo -----------------------------------------------
echo 开始从服务器获取安装文件!
echo -----------------------------------------------
gettar
echo -----------------------------------------------
echo ShellClash 已经安装成功!
[ "$profile" = "~/.bashrc" ] && echo "请执行【source ~/.bashrc &> /dev/null】命令以加载环境变量"
[ -n "$(ls -l /bin/sh|grep -oE 'zsh')" ] && echo "请执行【source ~/.zshrc &> /dev/null】命令以加载环境变量"
echo -----------------------------------------------
$echo "\033[33m输入\033[30;47m clash \033[0;33m命令即可管理\033[0m"
echo -----------------------------------------------
}
#特殊固件识别及标记
[ -f "/etc/storage/started_script.sh" ] && {
systype=Padavan #老毛子固件
initdir='/etc/storage/started_script.sh'
}
[ -d "/jffs" ] && {
systype=asusrouter #华硕固件
[ -f "/jffs/.asusrouter" ] && initdir='/jffs/.asusrouter'
[ -d "/jffs/scripts" ] && initdir='/jffs/scripts/nat-start'
}
[ -f "/data/etc/crontabs/root" ] && systype=mi_snapshot #小米设备
#检查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 1
fi
#检查更新
url_cdn="https://fastly.jsdelivr.net/gh/juewuy/ShellClash"
[ -z "$url" ] && url=$url_cdn
echo -----------------------------------------------
$echo "\033[33m请选择想要安装的版本\033[0m"
$echo " 1 \033[32mShellclash公测版\033[0m"
$echo " 2 \033[36mShellclash稳定版\033[0m"
echo -----------------------------------------------
read -p "请输入相应数字 > " num
if [ -z $num ];then
echo 安装已取消! && exit 1;
elif [ "$num" = "2" ];then
webget /tmp/clashrelease $url_cdn@master/bin/release_version echoon rediroff 2>/tmp/clashrelease
if [ "$result" = "200" ];then
release_new=$(cat /tmp/clashrelease | head -1)
url_dl="$url_cdn@$release_new"
else
$echo "\033[33m无法获取稳定版安装地址将尝试安装公测版\033[0m"
fi
fi
[ -z "$url_dl" ] && url_dl=$url
webget /tmp/clashversion "$url_dl/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=$url_dl/bin/ShellClash.tar.gz
#输出
$echo "最新版本:\033[32m$release_new\033[0m"

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,11 @@
#!/bin/bash
# Copyright (C) Juewuy
error_down(){
echo -e "\033[33m请尝试切换至其他安装源后重新下载\033[0m"
sleep 1
setserver
}
#导入订阅、配置文件相关
linkconfig(){
echo -----------------------------------------------
@@ -37,9 +42,9 @@ linkserver(){
echo -e "\033[32m感谢以下作者的无私奉献\033[0m"
echo 当前使用后端为:$server_link
echo 1 api.dler.io (墙洞提供)
echo 2 sub.shellclash.cf (作者提供
echo 3 sub.xeton.dev SUB作者T大提供)
echo 4 sub.id9.cc (品云提供)
echo 2 api.v1.mk (肥羊提供,支持vless
echo 3 sub.xeton.dev SUB作者提供
echo 4 v.id9.cc (品云提供,支持vless
echo 5 sub.maoxiongnet.com (猫熊提供)
echo -----------------------------------------------
echo 0 返回上级菜单
@@ -146,9 +151,8 @@ getlink(){
if [ -n "$Url_link" ];then
i=100
#将用户链接写入mark
sed -i '/Https=*/'d $ccfg
setconfig Https
setconfig Url \'$Url_link\'
Https=""
#获取在线yaml文件
getyaml
else
@@ -194,7 +198,7 @@ getlink2(){
read -p "请输入完整链接 > " link
test=$(echo $link | grep -iE "tp.*://" )
link=`echo ${link/\ \(*\)/''}` #删除恶心的超链接内容
link=`echo ${link//\&/\%26}` #分隔符 & 替换成urlcode%26
link=`echo ${link//\&/\\\&}` #处理分隔符
if [ -n "$link" -a -n "$test" ];then
echo -----------------------------------------------
echo -e 请检查输入的链接是否正确:
@@ -256,10 +260,16 @@ clashlink(){
elif [ "$num" = 2 ];then
echo -----------------------------------------------
echo -e "\033[33m此功能可能会导致严重bug仅限熟练了解clash运行机制的用户使用\033[0m"
echo -e "如你不熟悉clash机制或者使用此功能出现bug请使用\033[32m在线生成配置文件功能\033[0m"
echo -e "\033[33m此功能可能会导致严重bug\033[0m"
sleep 1
echo -----------------------------------------------
read -p "是否继续?[1/0] > " res
echo -e "强烈建议你使用\033[32m在线生成配置文件功能\033[0m"
sleep 1
echo -----------------------------------------------
echo -e "\033[33m继续后如出现任何问题请务必自行解决一切提问恕不受理\033[0m"
echo -----------------------------------------------
sleep 2
read -p "我确认遇到问题可以自行解决[1/0] > " res
if [ "$res" = '1' ]; then
getlink2
else
@@ -319,76 +329,26 @@ clashlink(){
#下载更新相关
gettar(){
$clashdir/start.sh webget /tmp/clashfm.tar.gz $tarurl
[ "$?" != "0" ] && echo "文件下载失败,请尝试使用其他安装源!" && exit 1
$clashdir/start.sh stop 2>/dev/null
#解压
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方式启动
cp -f $clashdir/clashservice /etc/init.d/clash
chmod +x /etc/init.d/clash
if [ "$?" != "0" ];then
echo -e "\033[33m文件下载失败\033[0m"
error_down
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
$clashdir/start.sh stop 2>/dev/null
#解压
echo -----------------------------------------------
echo 开始解压文件!
mkdir -p $clashdir > /dev/null
tar -zxvf '/tmp/clashfm.tar.gz' -C $clashdir/
if [ $? -ne 0 ];then
rm -rf /tmp/clashfm.tar.gz
echo -e "\033[33m文件解压失败\033[0m"
error_down
else
#设为保守模式启动
setconfig start_old 已开启
source $clashdir/init.sh >/dev/null
echo -e "\033[32m脚本更新成功\033[0m"
fi
fi
#修饰文件及版本号
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 +x $clashdir/start.sh
setconfig versionsh_l $release_new
#设置更新地址
[ -n "$url" ] && setconfig update_url $url
#设置环境变量
[ -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 "$initdir" ] && {
sed -i '/ShellClash初始化/'d $initdir && touch $initdir && echo "$clashdir/start.sh init #ShellClash初始化脚本" >> $initdir
setconfig initdir $initdir
}
#小米镜像化OpenWrt额外设置
if [ "$systype" = "mi_snapshot" ];then
chmod +x $clashdir/misnap_init.sh
uci set firewall.ShellClash=include
uci set firewall.ShellClash.type='script'
uci set firewall.ShellClash.path='/data/clash/misnap_init.sh'
uci set firewall.ShellClash.enabled='1'
uci commit firewall
setconfig systype $systype
else
rm -rf $clashdir/misnap_init.sh
rm -rf $clashdir/clashservice
fi
#删除临时文件
rm -rf /tmp/clashfm.tar.gz
rm -rf $clashdir/clash.service
exit
}
getsh(){
echo -----------------------------------------------
@@ -408,6 +368,7 @@ getsh(){
exit;
fi
}
getcpucore(){
cputype=$(uname -ms | tr ' ' '_' | tr '[A-Z]' '[a-z]')
[ -n "$(echo $cputype | grep -E "linux.*armv.*")" ] && cpucore="armv5"
@@ -427,8 +388,7 @@ setcpucore(){
echo -e "\033[31m仅适合脚本无法正确识别核心或核心无法正常运行时使用\033[0m"
echo -e "当前可供在线下载的处理器架构为:"
echo $cpucore_list | awk -F " " '{for(i=1;i<=NF;i++) {print i" "$i }}'
echo -e "如果您的CPU架构未在以上列表中请运行【uname -a】命令,并复制好返回信息"
echo -e "之后前往 t.me/ShellClash 群提交或 github.com/juewuy/ShellClash 提交issue"
echo -e "不知道如何获取核心版本?请参考:\033[36;4mhttps://juewuy.github.io/bdaz\033[0m"
echo -----------------------------------------------
read -p "请输入对应数字 > " num
setcpucore=$(echo $cpucore_list | awk '{print $"'"$num"'"}' )
@@ -453,11 +413,14 @@ getcore(){
if [ "$?" = "1" ];then
echo -e "\033[31m核心文件下载失败\033[0m"
rm -rf /tmp/clash.new
error_down
else
chmod +x /tmp/clash.new && /tmp/clash.new -v >/dev/null 2>&1
if [ "$?" != 0 ];then
echo -e "\033[31m核心文件下载失败\033[0m"
chmod +x /tmp/clash.new
clashv=$(/tmp/clash.new -v 2>/dev/null | sed 's/ linux.*//;s/.* //')
if [ -z "$clashv" ];then
echo -e "\033[31m核心文件下载成功但校验失败请尝试手动指定CPU版本\033[0m"
rm -rf /tmp/clash.new
setcpucore
else
echo -e "\033[32m$clashcore核心下载成功\033[0m"
mv -f /tmp/clash.new $bindir/clash
@@ -473,21 +436,21 @@ setcore(){
###
echo -----------------------------------------------
[ -z "$cpucore" ] && getcpucore
echo -e "当前clash核心\033[47;30m $clashcore \033[46;30m$clashv\033[0m"
echo -e "当前clash核心\033[42;30m $clashcore \033[47;30m$clashv\033[0m"
echo -e "当前系统处理器架构:\033[32m $cpucore \033[0m"
echo -e "\033[33m请选择需要使用的核心版本\033[0m"
echo -----------------------------------------------
echo "1 clash 稳定,内存占用小,推荐!"
echo "(官方正式版) 不支持Tun模式、混合模式"
echo -e "1 \033[43;30m Clash \033[0m \033[32m占用低\033[0m"
echo -e " (官方基础版) \033[33m不支持Tun、Rule-set等\033[0m"
echo -e " 说明文档: \033[36;4mhttps://lancellc.gitbook.io\033[0m"
echo
echo "2 clashpre 支持Tun模式、混合模式"
echo "(高级预览版) 内存占用更高"
echo -e "2 \033[43;30m Clashpre \033[0m \033[32m支持Tun、Rule-set、域名嗅探\033[0m"
echo -e " (官方高级版) \033[33m不支持vless、hy协议\033[0m"
echo -e " 说明文档: \033[36;4mhttps://lancellc.gitbook.io\033[0m"
echo
echo "3 clash.net 支持部分vless协议"
echo "(.net定制版) 第三方定制内核"
echo
echo "4 clash.meta支持大部分vless协议"
echo "(meta定制版) 第三方定制内核"
echo -e "3 \033[43;30mClash.Meta\033[0m \033[32m多功能支持最全面\033[0m"
echo -e " (Meta定制版) \033[33m第三方定制内核\033[0m"
echo -e " 说明文档: \033[36;4mhttps://docs.metacubex.one\033[0m"
echo
echo "5 手动指定处理器架构"
echo -----------------------------------------------
@@ -506,10 +469,6 @@ setcore(){
version=$clashpre_v
getcore
elif [ "$num" = 3 ]; then
clashcore=clash.net
version=$clashnet_v
getcore
elif [ "$num" = 4 ]; then
clashcore=clash.meta
version=$meta_v
getcore
@@ -521,6 +480,7 @@ setcore(){
update
fi
}
getgeo(){
echo -----------------------------------------------
echo 正在从服务器获取数据库文件…………
@@ -528,7 +488,7 @@ getgeo(){
if [ "$?" = "1" ];then
echo -----------------------------------------------
echo -e "\033[31m文件下载失败\033[0m"
exit 1
error_down
else
mv -f /tmp/$geoname $bindir/$geoname
echo -----------------------------------------------
@@ -548,9 +508,10 @@ setgeo(){
echo -----------------------------------------------
echo -e " 1 由\033[32malecthw\033[0m提供的全球版GeoIP数据库(约6mb)"
echo -e " 2 由\033[32mHackl0us\033[0m提供的精简版CN-IP数据库(约0.2mb)"
echo -e " 3 由\033[32m17mon\033[0m提供的CN-IP文件(需启用CN_IP绕过内核功能约0.2mb)"
echo -e " 3 由\033[32m17mon\033[0m提供的CN-IP文件(需启用CN_IP绕过约0.2mb)"
echo -e " 4 由\033[32mChanthMiao\033[0m提供的CN-IPV6文件(需ipv6启用CN_IP绕过约50kb)"
[ "$clashcore" = "clash.meta" ] && \
echo -e " 4 由\033[32mLoyalsoldier\033[0m提供的GeoSite数据库(限Meta内核约4.5mb)"
echo -e " 5 由\033[32mLoyalsoldier\033[0m提供的GeoSite数据库(限Meta内核约4.5mb)"
echo " 0 返回上级菜单"
echo -----------------------------------------------
read -p "请输入对应数字 > " num
@@ -573,16 +534,27 @@ setgeo(){
sleep 1
fi
elif [ "$num" = '4' ]; then
if [ "$cn_ipv6_route" = "已开启" -a "$ipv6_redir" = "已开启" ]; then
geotype=china_ipv6_list.txt
geoname=cn_ipv6.txt
getgeo
else
echo -----------------------------------------------
echo -e "\033[31m未开启ipv6下CN绕过功能无需更新CN-IPV6文件\033[0m"
sleep 1
fi
elif [ "$num" = '5' ]; then
geotype=geosite.dat
geoname=geosite.dat
geoname=GeoSite.dat
getgeo
else
update
fi
}
getdb(){
#下载及安装
if [ -d /www/clash -o -d $clashdir/ui ];then
if [ -f /www/clash/index.html -o -f $clashdir/ui/index.html ];then
echo -----------------------------------------------
echo -e "\033[31m检测到您已经安装过本地面板了\033[0m"
echo -----------------------------------------------
@@ -601,6 +573,7 @@ getdb(){
echo -----------------------------------------------
echo -e "\033[31m文件下载失败\033[0m"
echo -----------------------------------------------
error_down
setdb
else
echo -e "\033[33m下载成功正在解压文件\033[0m"
@@ -697,6 +670,7 @@ setdb(){
errornum
fi
}
getcrt(){
crtlink="${update_url}/bin/ca-certificates.crt"
echo -----------------------------------------------
@@ -705,6 +679,7 @@ getcrt(){
if [ "$?" = "1" ];then
echo -----------------------------------------------
echo -e "\033[31m文件下载失败\033[0m"
error_down
else
echo -----------------------------------------------
mv -f /tmp/ca-certificates.crt $crtdir
@@ -746,6 +721,7 @@ setcrt(){
sleep 1
fi
}
#安装源
setserver(){
saveserver(){
#写入mark文件
@@ -759,13 +735,12 @@ setserver(){
echo -e "\033[30;47m切换ShellClash版本及更新源地址\033[0m"
echo -e "当前源地址:\033[4;32m$update_url\033[0m"
echo -----------------------------------------------
echo -e " 1 \033[32m正式版\033[0m&Jsdelivr-CDN源"
echo -e " 2 \033[32m正式版\033[0m&fastgit.org源"
echo -e " 3 \033[36m公测版\033[0m&Github源(本机clash服务加速)"
echo -e " 4 \033[36m公测版\033[0m&ShellClash源"
echo -e " 5 \033[36m公测版\033[0m&githubusercontents加速"
echo -e " 6 \033[36m公测版\033[0m&fastgit.org源"
echo -e " 7 \033[33m内测版\033[0m(请加TG讨论组:\033[4;36mhttps://t.me/ShellClash\033[0m)"
echo -e " 1 \033[33m稳定版\033[0m&Jsdelivr-CDN源"
echo -e " 2 \033[33m稳定版\033[0m&Github源(须clash服务启用)"
echo -e " 3 \033[32m公测版\033[0m&Github源(clash服务启用)"
echo -e " 4 \033[32m公测版\033[0m&ShellClash私人源"
echo -e " 5 \033[32m公测版\033[0m&Jsdelivr-CDN源(推荐)"
echo -e " 7 \033[31m内测版\033[0m(请加TG讨论组:\033[4;36mhttps://t.me/ShellClash\033[0m)"
echo -e " 8 自定义源地址(用于本地源或自建源)"
echo -e " 9 \033[31m版本回退\033[0m"
echo -e " 0 返回上级菜单"
@@ -776,26 +751,26 @@ setserver(){
release_url='https://fastly.jsdelivr.net/gh/juewuy/ShellClash'
saveserver
elif [ "$num" = 2 ]; then
release_url='https://raw.fastgit.org/juewuy/ShellClash'
release_url='https://raw.githubusercontent.com/juewuy/ShellClash'
saveserver
elif [ "$num" = 3 ]; then
update_url='https://raw.githubusercontent.com/juewuy/ShellClash/master'
release_url=''
saveserver
elif [ "$num" = 4 ]; then
update_url='https://gh.shellclash.cf/master'
update_url='https://gh.jwsc.eu.org/master'
release_url=''
saveserver
elif [ "$num" = 5 ]; then
update_url='https://raw.githubusercontents.com/juewuy/ShellClash/master'
update_url='https://fastly.jsdelivr.net/gh/juewuy/ShellClash@master'
release_url=''
saveserver
elif [ "$num" = 6 ]; then
update_url='https://raw.fastgit.org/juewuy/ShellClash/master'
update_url='https://raw.staticdn.net/juewuy/ShellClash/master'
release_url=''
saveserver
elif [ "$num" = 7 ]; then
update_url='http://test.shellclash.cf'
update_url='http://t.jwsc.eu.org'
release_url=''
saveserver
elif [ "$num" = 8 ]; then
@@ -810,26 +785,29 @@ setserver(){
fi
elif [ "$num" = 9 ]; then
echo -----------------------------------------------
$clashdir/start.sh webget /tmp/clashrelease https://raw.githubusercontents.com/juewuy/ShellClash/master/bin/release_version echooff rediroff 2>/tmp/clashrelease
echo -e "\033[33m如无法连接请务必先启用clash服务\033[0m"
$clashdir/start.sh webget /tmp/clashrelease https://raw.githubusercontent.com/juewuy/ShellClash/master/bin/release_version echooff rediroff 2>/tmp/clashrelease
echo -e "\033[31m请选择想要回退至的release版本\033[0m"
cat /tmp/clashrelease | awk '{print " "NR" "$1}'
echo -e " 0 返回上级菜单"
read -p "请输入对应数字 > " num
if [ -z "$num" -o "$num" = 0 ]; then
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)
update_url="https://raw.githubusercontents.com/juewuy/ShellClash/$release_version"
update_url="https://raw.githubusercontent.com/juewuy/ShellClash/$release_version"
saveserver
release_url=''
else
echo -----------------------------------------------
echo -e "\033[31m输入有误请重新输入\033[0m"
fi
rm -rf /tmp/clashrelease
else
errornum
fi
}
#检查更新
checkupdate(){
if [ -z "$release_new" ];then
if [ -n "$release_url" ];then
@@ -844,7 +822,14 @@ if [ -z "$release_new" ];then
fi
$clashdir/start.sh webget /tmp/clashversion $update_url/bin/version echooff
[ "$?" = "0" ] && release_new=$(cat /tmp/clashversion | grep -oE 'versionsh=.*' | awk -F'=' '{ print $2 }')
[ -n "$release_new" ] && source /tmp/clashversion 2>/dev/null || echo -e "\033[31m检查更新失败请检查网络连接或切换安装源\033[0m"
if [ -n "$release_new" ];then
source /tmp/clashversion 2>/dev/null
else
echo -e "\033[31m检查更新失败请切换其他安装源\033[0m"
echo -e "\033[36m如全部安装源都无法使用请先运行服务后再使用更新\033[0m"
sleep 1
setserver
fi
rm -rf /tmp/clashversion
fi
}
@@ -868,8 +853,10 @@ update(){
echo -e " 6 查看\033[32mPAC\033[0m自动代理配置"
echo -----------------------------------------------
echo -e " 7 切换\033[36m安装源\033[0m及\033[36m安装版本\033[0m"
echo -e " 8 鸣谢"
echo -e " 8 \033[32m重新初始化运行环境\033[0m"
echo -e " 9 \033[31m卸载\033[34mShellClash\033[0m"
echo -----------------------------------------------
echo -e "99 \033[36m鸣谢\033[0m"
echo -e " 0 返回上级菜单"
echo -----------------------------------------------
read -p "请输入对应数字 > " num
@@ -906,21 +893,28 @@ update(){
elif [ "$num" = 7 ]; then
setserver
update
elif [ "$num" = 8 ]; then
echo -----------------------------------------------
echo -e "感谢:\033[32mClash \033[0m作者\033[36m Dreamacro\033[0m 项目地址:\033[32mhttps://github.com/Dreamacro/clash\033[0m"
echo -e "感谢:\033[32msubconverter \033[0m作者\033[36m tindy2013\033[0m 项目地址:\033[32mhttps://github.com/tindy2013/subconverter\033[0m"
echo -e "感谢:\033[32malecthw提供的GeoIP数据库\033[0m 项目地址:\033[32mhttps://github.com/alecthw/mmdb_china_ip_list\033[0m"
echo -e "感谢:\033[32mHackl0us提供的GeoIP精简数据库\033[0m 项目地址:\033[32mhttps://github.com/Hackl0us/GeoIP2-CN\033[0m"
echo -e "感谢:\033[32m17mon提供的CN-IP列表\033[0m 项目地址:\033[32mhttps://github.com/17mon/china_ip_list\033[0m"
echo -e "感谢:\033[32myacd \033[0m作者\033[36m haishanh\033[0m 项目地址:\033[32mhttps://github.com/haishanh/yacd\033[0m"
echo -e "感谢:\033[32m更多的帮助过我的人\033[0m"
sleep 2
source $clashdir/init.sh
update
elif [ "$num" = 9 ]; then
$0 -u
exit
elif [ "$num" = 99 ]; then
echo -----------------------------------------------
echo -e "感谢:\033[32mClash项目 \033[0m作者\033[36m Dreamacro\033[0m 项目地址:\033[32mhttps://github.com/Dreamacro/clash\033[0m"
echo -e "感谢:\033[32mClash.meta项目 \033[0m作者\033[36m MetaCubeX\033[0m 项目地址:\033[32mhttps://github.com/MetaCubeX/Clash.Meta\033[0m"
echo -e "感谢:\033[32mYACD面板项目 \033[0m作者\033[36m haishanh\033[0m 项目地址:\033[32mhttps://github.com/haishanh/yacd\033[0m"
echo -e "感谢:\033[32mSubconverter \033[0m作者\033[36m tindy2013\033[0m 项目地址:\033[32mhttps://github.com/tindy2013/subconverter\033[0m"
echo -e "感谢:\033[32m由alecthw提供的GeoIP数据库\033[0m 项目地址:\033[32mhttps://github.com/alecthw/mmdb_china_ip_list\033[0m"
echo -e "感谢:\033[32m由Hackl0us提供的GeoIP精简数据库\033[0m 项目地址:\033[32mhttps://github.com/Hackl0us/GeoIP2-CN\033[0m"
echo -e "感谢:\033[32m由17mon提供的CN-IP列表\033[0m 项目地址:\033[32mhttps://github.com/17mon/china_ip_list\033[0m"
echo -e "感谢:\033[32m由ChanthMiao提供的CN-IPV6列表\033[0m 项目地址:\033[32mhttps://github.com/ChanthMiao/China-IPv6-List\033[0m"
echo -----------------------------------------------
echo -e "特别感谢:\033[36m所有帮助及赞助过此项目的同仁们\033[0m"
echo -----------------------------------------------
sleep 2
update
else
errornum
@@ -928,33 +922,7 @@ update(){
}
#新手引导
userguide(){
whichmod(){
echo -----------------------------------------------
echo -e "\033[33m是否需要代理UDP流量(主要用于连接外服游戏) \033[0m"
echo -----------------------------------------------
echo -e " 1 \033[33m不代理UDP流量(推荐)\033[0m"
ip tuntap >/dev/null 2>&1 && [ "$?" = 0 ] && \
echo -e " 2 \033[32m使用Tun虚拟网卡\033[0m代理UDP流量" || \
echo -e " - \033[0m使用Tun模式(你的设备不支持此模式,如为虚拟机运行请调整虚拟网卡设置)\033[0m"
[ -n "$(iptables -j TPROXY 2>&1 | grep 'on-port')" ] && \
echo -e " 3 \033[32m使用Tproxy模式\033[0m代理UDP流量"
echo -----------------------------------------------
read -p "请输入对应数字 > " num
if [ -z "$num" ] || [ "$num" -gt 4 ];then
errornum
whichmod
elif [ "$num" = 1 ];then
setconfig redir_mod "Redir模式"
setconfig clashcore "clash"
elif [ "$num" = 2 ];then
setconfig redir_mod "混合模式"
setconfig clashcore "clashpre"
elif [ "$num" = 3 ];then
setconfig redir_mod "Redir模式"
setconfig clashcore "clash"
setconfig tproxy_mod "已开启"
fi
}
forwhat(){
echo -----------------------------------------------
echo -e "\033[30;46m 欢迎使用ShellClash新手引导 \033[0m"
@@ -971,7 +939,16 @@ userguide(){
errornum
forwhat
elif [ "$num" = 1 ];then
whichmod
if ckcmd nft;then
setconfig redir_mod "Nft模式"
else
setconfig redir_mod "Redir模式"
fi
#设置开机启动
[ -f /etc/rc.common ] && /etc/init.d/clash enable
ckcmd systemctl && systemctl enable clash.service > /dev/null 2>&1
rm -rf $clashdir/.dis_startup
autostart=enable
#检测IP转发
if [ "$(cat /proc/sys/net/ipv4/ip_forward)" = "0" ];then
echo -----------------------------------------------
@@ -983,10 +960,12 @@ userguide(){
elif [ "$num" = 2 ];then
setconfig redir_mod "纯净模式"
setconfig clashcore "clash"
setconfig common_ports "未开启"
echo -----------------------------------------------
echo -e "\033[36m请选择设置本机代理的方式\033[0m"
echo -e " 1 使用\033[32m环境变量\033[0m方式配置(不支持部分应用)"
echo -e " 2 使用\033[32miptables增强模式\033[0m配置(不支持OpenWrt)"
echo -e " 2 使用\033[32miptables增强模式\033[0m配置"
echo -e " 3 使用\033[32mnftables增强模式\033[0m配置"
echo -e " 0 稍后设置"
read -p "请输入对应数字 > " num
if [ "$num" = 1 ]; then
@@ -995,6 +974,9 @@ userguide(){
elif [ "$num" = 2 ]; then
local_proxy=已开启
local_type=iptables增强模式
elif [ "$num" = 3 ]; then
local_proxy=已开启
local_type=nftables增强模式
fi
setconfig local_proxy $local_proxy
setconfig local_type $local_type
@@ -1049,7 +1031,7 @@ userguide(){
sethost
fi
}
if type systemd >/dev/null 2>&1 ;then
if ckcmd systemd;then
echo -----------------------------------------------
echo -e "\033[32m是否开启公网访问Dashboard面板及socks服务\033[0m"
echo -e "注意当前设备必须有公网IP才能从公网正常访问"
@@ -1073,6 +1055,12 @@ userguide(){
setconfig authentication \'$authentication\'
fi
fi
#小米设备软固化
if [ "$systype" = "mi_snapshot" ];then
echo -----------------------------------------------
read -p "是否启用软固化SSH(1/0) > " res
[ "$res" = 1 ] && setconfig mi_autoSSH 已启用
fi
#提示导入订阅或者配置文件
echo -----------------------------------------------
echo -e "\033[32m是否导入配置文件\033[0m(这是运行前的最后一步)"
@@ -1097,11 +1085,9 @@ testcommand(){
echo " 1 查看Clash运行时的报错信息(会停止clash服务)"
echo " 2 查看系统DNS端口(:53)占用 "
echo " 3 测试ssl加密(aes-128-gcm)跑分"
echo " 4 查看iptables端口转发详情"
echo " 5 查看config.yaml前40行"
echo " 4 查看clash相关路由规则"
echo " 5 查看config.yaml前30行"
echo " 6 测试代理服务器连通性google.tw)"
echo " 7 重新进入新手引导"
echo " 9 查看后台脚本运行日志"
echo -----------------------------------------------
echo " 0 返回上级目录!"
read -p "请输入对应数字 > " num
@@ -1129,22 +1115,35 @@ testcommand(){
echo -----------------------------------------------
exit;
elif [ "$num" = 4 ]; then
echo -----------------------------------------------
iptables -t nat -L PREROUTING --line-numbers
echo -----------------------------------------------
iptables -t nat -L clash --line-numbers
echo -----------------------------------------------
iptables -t nat -L clash_dns --line-numbers
echo -----------------------------------------------
ip6tables -t nat -L PREROUTING --line-numbers
echo -----------------------------------------------
ip6tables -t nat -L clashv6 --line-numbers
echo -----------------------------------------------
ip6tables -t nat -L clashv6_dns --line-numbers
if [ -n "$(echo $redir_mod | grep 'Nft')" -o "$local_type" = "nftables增强模式" ];then
nft list table inet shellclash
else
echo -------------------Redir---------------------
iptables -t nat -L PREROUTING --line-numbers
iptables -t nat -L clash_dns --line-numbers
iptables -t nat -L clash --line-numbers
[ -n "$(echo $redir_mod | grep 'Tproxy')" ] && {
echo ----------------Tun/Tproxy-------------------
iptables -t mangle -L PREROUTING --line-numbers
iptables -t mangle -L clash --line-numbers
}
[ -n "$(echo $redir_mod | grep 'Tproxy')" -a "$ipv6_redir" = "已开启" ] && {
echo ----------------Tun/Tproxy-------------------
ip6tables -t mangle -L PREROUTING --line-numbers
ip6tables -t mangle -L clashv6 --line-numbers
[ -n "$(lsmod | grep 'ip6table_nat')" ] && {
echo -------------------Redir---------------------
ip6tables -t nat -L PREROUTING --line-numbers
ip6tables -t nat -L clashv6_dns --line-numbers
ip6tables -t nat -L clashv6 --line-numbers
}
}
fi
exit;
elif [ "$num" = 5 ]; then
echo -----------------------------------------------
sed -n '1,40p' $yaml
sed -n '1,30p' $yaml
echo -----------------------------------------------
exit;
elif [ "$num" = 6 ]; then
@@ -1158,12 +1157,7 @@ testcommand(){
echo -e "\033[31m连接超时请重试或检查节点配置\033[0m"
fi
clashsh
elif [ "$num" = 7 ]; then
userguide
elif [ "$num" = 9 ]; then
echo -----------------------------------------------
cat $clashdir/log
exit;
else
errornum
clashsh

226
scripts/init.sh Normal file
View File

@@ -0,0 +1,226 @@
#!/bin/sh
# Copyright (C) Juewuy
version=1.7.0f
setdir(){
dir_avail(){
df -h $1 |awk '{ for(i=1;i<=NF;i++){ if(NR==1){ arr[i]=$i; }else{ arr[i]=arr[i]" "$i; } } } END{ for(i=1;i<=NF;i++){ print arr[i]; } }' |grep Ava |awk '{print $2}'
}
set_usb_dir(){
echo -e "请选择安装目录"
du -hL /mnt | awk '{print " "NR" "$2" "$1}'
read -p "请输入相应数字 > " num
dir=$(du -hL /mnt | awk '{print $2}' | sed -n "$num"p)
if [ -z "$dir" ];then
echo -e "\033[31m输入错误请重新设置\033[0m"
set_usb_dir
fi
}
echo -----------------------------------------------
if [ -n "$systype" ];then
[ "$systype" = "Padavan" ] && dir=/etc/storage
[ "$systype" = "mi_snapshot" ] && {
echo -e "\033[33m检测到当前设备为小米官方系统请选择安装位置\033[0m"
echo -e " 1 安装到/data目录(推荐,支持软固化功能)"
echo -e " 2 安装到USB设备(支持软固化功能)"
[ "$(dir_avail /etc)" != 0 ] && echo -e " 3 安装到/etc目录(不推荐)"
echo -e " 0 退出安装"
echo -----------------------------------------------
read -p "请输入相应数字 > " num
case "$num" in
1)
dir=/data
;;
2)
set_usb_dir ;;
3)
if [ "$(dir_avail /etc)" != 0 ];then
dir=/etc
systype=""
else
echo -e "\033[31m你的设备不支持安装到/etc目录已改为安装到/data\033[0m"
dir=data
fi
;;
*)
exit 1 ;;
esac
}
[ "$systype" = "asusrouter" ] && {
echo -e "\033[33m检测到当前设备为华硕固件请选择安装方式\033[0m"
echo -e " 1 基于USB设备安装(通用,须插入\033[31m任意\033[0mUSB设备)"
echo -e " 2 基于自启脚本安装(仅支持梅林及部分官改固件)"
echo -e " 0 退出安装"
echo -----------------------------------------------
read -p "请输入相应数字 > " num
case "$num" in
1)
read -p "将脚本安装到USB存储/系统闪存?(1/0) > " res
[ "$res" = "1" ] && set_usb_dir || dir=/jffs
usb_status=1
;;
2)
echo -e "如无法正常开机启动请重新使用USB方式安装"
sleep 2
dir=/jffs ;;
*)
exit 1 ;;
esac
}
else
echo -e "\033[33m安装ShellClash至少需要预留约1MB的磁盘空间\033[0m"
echo -e " 1 在\033[32m/etc目录\033[0m下安装(适合root用户)"
echo -e " 2 在\033[32m/usr/share目录\033[0m下安装(适合Linux系统)"
echo -e " 3 在\033[32m当前用户目录\033[0m下安装(适合非root用户)"
echo -e " 4 在\033[32m外置存储\033[0m中安装"
echo -e " 5 手动设置安装目录"
echo -e " 0 退出安装"
echo -----------------------------------------------
read -p "请输入相应数字 > " num
#设置目录
if [ -z $num ];then
echo 安装已取消
exit 1;
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
set_usb_dir
elif [ "$num" = "5" ];then
echo -----------------------------------------------
echo '可用路径 剩余空间:'
df -h | awk '{print $6,$4}'| sed 1d
echo '路径是必须带 / 的格式,注意写入虚拟内存(/tmp,/opt,/sys...)的文件会在重启后消失!!!'
read -p "请输入自定义路径 > " dir
if [ -z "$dir" ];then
echo -e "\033[31m路径错误请重新设置\033[0m"
setdir
fi
else
echo 安装已取消!!!
exit 1;
fi
fi
if [ ! -w $dir ];then
echo -e "\033[31m没有$dir目录写入权限!请重新设置!\033[0m" && sleep 1 && setdir
else
echo -e "目标目录\033[32m$dir\033[0m空间剩余$(dir_avail $dir)"
read -p "确认安装?(1/0) > " res
[ "$res" = "1" ] && clashdir=$dir/clash || setdir
fi
}
setconfig(){
#参数1代表变量名参数2代表变量值,参数3即文件路径
[ -z "$3" ] && configpath=$clashdir/mark || configpath=$3
[ -n "$(grep -E "^${1}=" $configpath)" ] && sed -i "s#^${1}=\(.*\)#${1}=${2}#g" $configpath || echo "${1}=${2}" >> $configpath
}
$clashdir/start.sh stop 2>/dev/null #防止进程冲突
#特殊固件识别及标记
[ -f "/etc/storage/started_script.sh" ] && {
systype=Padavan #老毛子固件
initdir='/etc/storage/started_script.sh'
}
[ -d "/jffs" ] && {
systype=asusrouter #华硕固件
[ -f "/jffs/.asusrouter" ] && initdir='/jffs/.asusrouter'
[ -d "/jffs/scripts" ] && initdir='/jffs/scripts/nat-start'
}
[ -f "/data/etc/crontabs/root" ] && systype=mi_snapshot #小米设备
#检查环境变量
[ -z "$clashdir" -a -d /tmp/SC_tmp ] && {
setdir
}
#移动文件
mkdir -p $clashdir
mv -f /tmp/SC_tmp/* $clashdir 2>/dev/null
#初始化
[ -f "$clashdir/mark" ] || echo '#ShellClash配置文件不明勿动' > $clashdir/mark
#本地安装跳过新手引导
[ -z "$url" ] && setconfig userguide 1
#判断系统类型写入不同的启动文件
if [ -f /etc/rc.common ];then
#设为init.d方式启动
cp -f $clashdir/clashservice /etc/init.d/clash
chmod 755 /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 -f $clashdir/clash.service $sysdir/clash.service 2>/dev/null
sed -i "s%/etc/clash%$clashdir%g" $sysdir/clash.service
systemctl daemon-reload
else
#设为保守模式启动
setconfig start_old 已开启
fi
fi
#修饰文件及版本号
type bash &>/dev/null && shtype=bash || shtype=sh
sed -i "s|/bin/sh|/bin/$shtype|" $clashdir/start.sh
chmod 755 $clashdir/start.sh
setconfig versionsh_l $version
#设置更新地址
[ -n "$url" ] && setconfig update_url $url
#设置环境变量
[ -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路径环境变量
source $profile &>/dev/null
#适配zsh环境变量
[ -n "$(ls -l /bin/sh|grep -oE 'zsh')" ] && [ -z "$(cat ~/.zshrc 2>/dev/null|grep clashdir)" ] && {
echo "alias clash=\"$shtype $clashdir/clash.sh\"" >> ~/.zshrc
echo "export clashdir=\"$clashdir\"" >> ~/.zshrc
source ~/.zshrc &>/dev/null
}
else
echo -e "\033[33m无法写入环境变量请检查安装权限\033[0m"
exit 1
fi
#梅林/Padavan额外设置
[ -n "$initdir" ] && {
sed -i '/ShellClash初始化/'d $initdir
touch $initdir
echo "$clashdir/start.sh init #ShellClash初始化脚本" >> $initdir
chmod a+rx $initdir 2>/dev/null
setconfig initdir $initdir
}
#小米镜像化OpenWrt额外设置
if [ "$systype" = "mi_snapshot" ];then
chmod 755 $clashdir/misnap_init.sh
uci set firewall.ShellClash=include
uci set firewall.ShellClash.type='script'
uci set firewall.ShellClash.path='/data/clash/misnap_init.sh'
uci set firewall.ShellClash.enabled='1'
uci commit firewall
setconfig systype $systype
else
rm -rf $clashdir/misnap_init.sh
fi
#华硕USB启动额外设置
[ "$usb_status" = "1" ] && {
echo "$clashdir/start.sh init #ShellClash初始化脚本" > $clashdir/asus_usb_mount.sh
nvram set script_usbmount="$clashdir/asus_usb_mount.sh"
nvram commit
}
#删除临时文件
rm -rf /tmp/*lash*gz
rm -rf /tmp/SC_tmp
sleep 1
echo -e "\033[32m脚本初始化完成,请输入\033[30;47m clash \033[0;33m命令开始使用\033[0m"

View File

@@ -4,20 +4,27 @@
clashdir=/data/clash
profile=/etc/profile
#h初始化环境变量
echo "alias clash=\"$clashdir/clash.sh\"" >> $profile
echo "export clashdir=\"$clashdir\"" >> $profile
#检查clash运行状态
if [ -z $(pidof clash) ]; then
#初始化环境变量
sed -i "/alias clash/d" $profile
sed -i "/export clashdir/d" $profile
echo "alias clash=\"$clashdir/clash.sh\"" >>$profile
echo "export clashdir=\"$clashdir\"" >>$profile
#设置init.d服务并启动clash服务
cp -f $clashdir/clashservice /etc/init.d/clash
chmod 755 /etc/init.d/clash
#设置init.d服务并启动clash服务
ln -sf $clashdir/clashservice /etc/init.d/clash
chmod 755 /etc/init.d/clash
if [ ! -f $clashdir/.dis_startup ];then
log_file=`uci get system.@system[0].log_file`
while [ "$i" -lt 10 ];do
sleep 3
[ -n "$(grep 'init complete' $log_file)" ] && i=10 || i=$((i+1))
done
/etc/init.d/clash start
/etc/init.d/clash enable
if [ ! -f $clashdir/.dis_startup ]; then
log_file=$(uci get system.@system[0].log_file)
while [ "$i" -lt 10 ]; do
sleep 5
[ -n "$(grep 'init complete' $log_file)" ] && i=10 || i=$((i + 1))
done
/etc/init.d/clash start
/etc/init.d/clash enable
fi
else
sleep 10
$clashdir/start.sh restart
fi

File diff suppressed because it is too large Load Diff