115 Commits

Author SHA1 Message Date
juewuy
827f70a95b Merge branch 'dev' of https://github.com/juewuy/ShellCrash into dev 2024-01-30 11:41:13 +08:00
juewuy
1a14d3f8e2 v1.8.9c
~优化iptables及nftables的模块检测机制
~修复本机代理相关的一系列问题
~修复保守模式启动报错
~修复首次启动时定时任务提示找不到用户的bug
~修复自定义singbox配置文件功能导致的若干报错
~修复systemd启动时的若干问题
~修复保守模式启动时将信息输出到ssh中的bug
2024-01-30 11:40:55 +08:00
juewuy
147c558e5f Update update_meta_core_test.yaml 2024-01-29 18:52:50 +08:00
juewuy
6d2edbdcd8 修改内核压缩方式 2024-01-29 18:44:23 +08:00
juewuy
4cf7952f26 修改内核压缩方式 2024-01-29 16:30:12 +08:00
juewuy
a921366d89 Create blank.yml 2024-01-29 16:27:18 +08:00
juewuy
099fd89e6d 清理无用文件 2024-01-29 16:19:09 +08:00
Bot
1a621cb4a0 更新sing-box内核至v1.8.4 2024-01-28 11:59:21 +00:00
juewuy
7f40ae54fc v1.8.9c
~修复mix模式+nft模式cn绕过失效的bug
~增加自定义配置文件rule-set.json的导入
2024-01-28 14:23:48 +08:00
juewuy
21aba94e04 v1.8.9b
~自定义端口秘钥功能移回进阶配置菜单
~修复singbox自定义规则相关报错
~修复启动时提示找不到用户组的相关报错
~修复singbox内核部分启动失败的问题
~修复singbox内核启动时找不到配置文件的相关报错
2024-01-28 12:15:40 +08:00
Bot
bfccbb7e26 自动更新最新Dashboard、地址库、根证书 2024-01-27 18:02:32 +00:00
juewuy
8bd3bf303d v1.8.9
~适配singbox自定义规则
~适配singbox在线生成配置文件时的自动去除无效策略组功能
~singbox配置文件修饰方式及执行方式调整,可更友好的自定义json模块
~移除了切换singbox内核时是否保留clash配置文件的提醒
~优化了面板下载,在使用singbox内核时屏蔽基础面板的下载
~修复mix模式下cn绕过功能未能实际生效的bug
~修复部分未安装nftables的设备新手引导设置nft模式的bug
~修复用户组相关报错bug
~修复部分旧设备无法正确显示开机启动的bug
2024-01-27 22:54:24 +08:00
juewuy
fa79806d77 ~适配singbox自定义规则
~singbox配置文件修饰方式及执行方式调整
2024-01-26 22:15:31 +08:00
juewuy
395833f329 v1.8.8g
~修复首次创建自定义任务时的意外报错
~调整条件任务-启动前执行的执行顺位
~修复旧版本升级时创建用户的报错
~修复保守模式部分极端情况下开机自启的相关问题
2024-01-26 15:30:07 +08:00
juewuy
b1358563ee 修复一个格式错误 2024-01-26 14:25:12 +08:00
juewuy
7d0310c263 v1.8.8e
~修复部分linux设备使用meta内核开机自启后无法正确还原面板节点及配置的问题
~修复使用clash内核启用域名嗅探后,因未能正确切换内核而导致的启动失败
~修复卸载后部分定时任务未能正确移除的bug
~修复下载或更新meta内核时的显示bug
2024-01-26 14:11:04 +08:00
juewuy
973900c52e Merge pull request #563 from simonsmh/dev
fix crash path check
2024-01-26 14:04:38 +08:00
Simon Shi
f242131387 fix crash path check 2024-01-25 23:47:59 +08:00
juewuy
3b7c61faef Merge pull request #560 from SharerMax/check-zsh
修改 `zsh` 判断方式
2024-01-25 12:55:20 +08:00
Max Zhao
a7c1dbe68d 兼容 clash 命令 2024-01-25 12:48:51 +08:00
Max Zhao
ca43babe06 忽略 cat /etc/shells 错误 2024-01-25 12:42:23 +08:00
Max Zhao
d985a821b9 修改zsh判断方式 2024-01-25 02:13:04 +08:00
juewuy
8975e0bee5 Merge branch 'dev' of https://github.com/juewuy/ShellCrash into dev 2024-01-24 17:51:24 +08:00
juewuy
85f01c987a v1.8.8e
~修复procd启动本机代理回环的bug
2024-01-24 17:51:14 +08:00
juewuy
7b48fbc84a v1.8.8d
~修复procd启动本机代理回环的bug
2024-01-24 17:46:38 +08:00
juewuy
5c8cfd7b71 v1.8.8c
~重写本机代理部分逻辑,修复相关死循环bug
~安装时现在默认会自动清理多余的旧目录
~现在在linux设备上默认使用保守模式而不是systemd
~singbox默认启用sniff以匹配规则,但不会覆写域名
~修复使用systemd启动时,无法正确配置防火墙的bug
~修复在线生成时导入包含@符号的链接时,无法正确转换的bug
~修复singbox对ipv6-tun模式的支持
2024-01-24 16:09:10 +08:00
juewuy
85558022fa Merge branch 'master' of https://github.com/juewuy/ShellCrash into dev
# Conflicts:
#	rules/ShellClash_Mini.ini
2024-01-24 12:27:45 +08:00
juewuy
e3cd47c9f6 更新 ShellClash_Mini.ini 2024-01-23 18:55:10 +08:00
juewuy
85240c1096 更新 ShellClash_Mini.ini
修复报错
2024-01-23 18:52:51 +08:00
juewuy
114b917983 更新 ShellClash_Mini.ini
修复报错
2024-01-23 18:51:18 +08:00
juewuy
bf9f013c61 v1.8.8c
~自定义内核列表增加了PuerNya版本singbox内核,支持ssr、providers
~切换版本时,会自动切换不可用源至默认源
~修复b版本面板节点无法正确还原的bug
~修复触发自动下载meta内核时意外报错的bug
~修复触发自动下载时首次启动失败的bug
2024-01-22 21:06:05 +08:00
juewuy
daed770afd 添加singbox测试版actions文件 2024-01-22 19:33:57 +08:00
juewuy
a8a9448d9e 添加singbox测试版actions文件 2024-01-22 19:31:59 +08:00
juewuy
5013903d34 添加singbox测试版actions文件 2024-01-22 19:02:03 +08:00
juewuy
32dc9dc49a 添加singbox测试版actions文件 2024-01-22 18:56:31 +08:00
juewuy
e28c47bc42 添加singbox测试版actions文件 2024-01-22 18:41:31 +08:00
juewuy
e176398e2a 添加singbox测试版actions文件 2024-01-22 18:35:00 +08:00
juewuy
e815a1e7f5 添加singbox测试版actions文件 2024-01-22 18:27:05 +08:00
juewuy
1fbcc36bb8 添加singbox测试版actions文件 2024-01-22 14:22:42 +08:00
juewuy
b1f61ed0ab 添加singbox测试版actions文件 2024-01-22 14:14:50 +08:00
juewuy
f5303961ca 回归singbox自定义内核下载功能 2024-01-21 19:52:00 +08:00
juewuy
f114ba884d 添加singbox测试版actions文件 2024-01-21 19:48:30 +08:00
juewuy
0e316335f3 添加singbox测试版actions文件 2024-01-21 19:41:05 +08:00
juewuy
9f0772b368 Merge branch 'dev' of https://github.com/juewuy/ShellCrash into dev
# Conflicts:
#	bin/version
2024-01-21 19:27:27 +08:00
juewuy
9f0a2f8e1a v1.8.8
~增加了自动还原面板设置的功能(singbox内核未支持此功能)
~优化了singbox的tun网卡默认网段,与clash内核统一,防止回环等问题
~修复了dns模式为mix时,常用端口过滤会导致部分地址无法访问的问题
~修复了部分旧设备保持面板节点出错的问题
~修复了新手引导的部分报错问题
2024-01-21 19:26:13 +08:00
Bot
3cafe2b238 自动更新最新Dashboard、地址库、根证书 2024-01-20 18:02:27 +00:00
juewuy
85547ab863 v1.8.7e
~增加了singbox内核对ssr协议的检测提醒
~修改了Cloudflare源的地址
~修复了小闪存模式更新内核失败的bug
~修复了自动下载内核失败的bug
~修复了启用本机代理后的若干报错
~修复部分第三方geo数据库下载失败的问题
~修复了升级后小闪存模式会被自动取消的bug
~修复了部分低性能设备无法自动还原面板节点的问题
~修复了热更新订阅失败的bug
2024-01-20 16:35:52 +08:00
juewuy
243c66282f 修改安装脚本适配新的分支结构 2024-01-18 15:54:44 +08:00
juewuy
b7c97ba007 Merge branch 'master' of https://github.com/juewuy/ShellCrash into master 2024-01-18 15:52:19 +08:00
juewuy
cf9449f1f3 Merge branch 'dev' into master 2024-01-18 15:51:51 +08:00
juewuy
e5b198afe5 修改安装脚本适配新的分支结构 2024-01-18 15:48:40 +08:00
juewuy
923b4ff596 修改安装脚本适配新的分支结构 2024-01-18 15:41:17 +08:00
juewuy
a384fc6734 修改安装脚本适配新的分支结构 2024-01-18 15:38:55 +08:00
juewuy
baa2dc1dd5 Update version 2024-01-16 18:38:22 +08:00
juewuy
2090ead938 Merge branch 'dev' into master
# Conflicts:
#	bin/version
#	scripts/menu.sh
2024-01-16 18:36:30 +08:00
juewuy
3ab931d946 v1.8.7d
~暂时隐藏部分不可用的第三方geo数据库下载链接
2024-01-16 18:27:02 +08:00
juewuy
54b7981833 v1.8.7c
~clash命令改为依旧可用
~修复新手引导按提示开启小闪存但后续扔继续提示的bug
~移除了clash系内核在线获取配置文件时调用内核进行校验的机制
2024-01-15 18:46:18 +08:00
juewuy
705ed82396 v1.8.7c
~修复新手引导按提示开启小闪存但后续扔继续提示的bug
~移除了clash系内核在线获取配置文件时调用内核进行校验的机制
2024-01-15 18:22:14 +08:00
juewuy
8abdab8843 Merge branch 'dev' of https://github.com/juewuy/ShellCrash into dev 2024-01-14 19:30:59 +08:00
juewuy
a83161fdf0 v1.8.7b
~回退singbox内核至1.7.8版本
~合并https://github.com/juewuy/ShellCrash/pull/549
~修复任务列表显示
~修复小闪存模式singbox运行命令出错的bug
2024-01-14 19:28:52 +08:00
juewuy
155ae9e9ea v1.8.7b
~修复任务列表显示
~修复小闪存模式singbox运行命令出错的bug
2024-01-14 19:22:24 +08:00
Bot
c1021a3459 更新sing-box内核至v1.7.8 2024-01-14 10:48:13 +00:00
Bot
0c8f4d7bb6 更新sing-box内核至v1.8.1 2024-01-14 10:15:53 +00:00
juewuy
4640348c4d Update bin_update.yml 2024-01-14 18:08:18 +08:00
juewuy
8b73700c9e 已修改 .github/workflows/bin_update.yml 2024-01-14 18:06:06 +08:00
juewuy
997ec78ab8 已修改 .github/workflows/bin_update.yml 2024-01-14 17:57:47 +08:00
juewuy
a05bcd8238 已修改 .github/workflows/bin_update.yml
已修改        .github/workflows/update_premium.latest_core.yaml
2024-01-14 17:56:35 +08:00
juewuy
e41e63cddb Merge commit '4cdd01e24eefdab8c66a8b90cb8946eab007d206' into dev
# Conflicts:
#	.github/workflows/update_singbox_core.yaml
#	bin/version
2024-01-14 13:55:52 +08:00
juewuy
4bd9ee6d88 https://github.com/juewuy/ShellCrash/pull/549 2024-01-14 13:50:31 +08:00
juewuy
7759b0ed9a Merge branch 'master' of https://github.com/juewuy/ShellCrash into master
# Conflicts:
#	.github/workflows/update_singbox_core.yaml
#	bin/version
2024-01-14 13:39:30 +08:00
juewuy
82a8c1cf6a v1.8.7
~增加debug模式菜单(8-1-1)
~优化tun模式识别机制
~继续修复覆盖安装或升级时卡死的bug
~修复卸载脚本时的若干报错
2024-01-14 12:53:23 +08:00
juewuy
bcf29a1bbb Merge pull request #549 from firedes/master
禁用小米路由自动更新
2024-01-14 08:58:53 +08:00
Bot
4cdd01e24e 自动更新最新Dashboard、地址库、根证书 2024-01-13 18:04:56 +00:00
juewuy
0e402881a1 v1.8.6c
~增加8-1-1命令等待时长
~自动同步ntp的任务当检测到singbox内核时不会运行
~修复singbox内核启动时geosite-cn相关报错
~修复singbox内核无法正确还原面板节点的问题
~修复卸载时报错source未找到
~修复升级或覆盖安装时界面卡死的bug
2024-01-13 19:39:15 +08:00
juewuy
ea1b44669d v1.8.6b
~重写8-1-1测试命令,现在可以更可靠的显示问题
~修复部分用户singbox启动后无法进入Dashboard面板的bug
~修复部分mips设备无法正常启动的bug
~修复部分用户安装或者卸载时脚本卡死的bug
~小闪存模式提示优化
2024-01-13 14:23:34 +08:00
juewuy
47a42b7a64 已修改 README_CN.md 2024-01-12 21:37:20 +08:00
juewuy
a01af085a7 增加人工智能选项 2024-01-12 21:37:07 +08:00
juewuy
75f1bbeaa4 v1.8.6
~更新功能调整,新增更新版本通道选择
  ·增加稳定版分支及分支切换
  ·增加公测版及开发版分支
  ·现在前4个源都支持各个分支之间任意切换及回退
  ·内测源今后改为个人开发测试用,请更新后尽快换源
~正式适配sing-box1.8.0内核
  ·已编译mips相关版本内核文件
  ·已将内核添加到项目内/bin目录,以支持小闪存模式
  ·编译时移除了with_gvisor参数,以优化内存占用
~修复手动加载/tmp目录下内核时无法正确识别的bug
~修复保守模式启用本机代理后部分设备导致日志刷屏的bug
2024-01-12 21:36:31 +08:00
Bot
3679267902 更新sing-box内核至v1.8.0 2024-01-12 13:12:18 +00:00
juewuy
51dfb8feb7 Update update_singbox_core.yaml 2024-01-12 21:09:43 +08:00
juewuy
3a8be13fa2 Update update_singbox_core.yaml 2024-01-12 21:06:10 +08:00
Bot
9863fc8a59 更新sing-box内核至 2024-01-12 12:46:40 +00:00
juewuy
b42c7f5d14 Update update_singbox_core.yaml 2024-01-12 20:44:10 +08:00
juewuy
2087bc8480 Update update_singbox_core.yaml 2024-01-12 20:39:05 +08:00
juewuy
7dfd1a448e Update update_singbox_core.yaml 2024-01-12 20:33:29 +08:00
juewuy
6d90b95530 Update update_singbox_core.yaml 2024-01-12 20:28:22 +08:00
juewuy
a3edf7a4fd Update update_singbox_core.yaml 2024-01-12 20:24:11 +08:00
juewuy
bf3debf51b Update update_singbox_core.yaml 2024-01-12 20:16:19 +08:00
juewuy
d07edc66dc Update update_singbox_core.yaml
改为直接从主干编译指定版本并上传到bin目录
2024-01-12 20:02:41 +08:00
YinAqu
4f2309beb4 禁用小米路由自动更新 2024-01-12 19:39:16 +08:00
juewuy
f9163f949b v1.8.5f
~修复定时任务无法生效以及启动后报错的bug
~修复本地/tmp导入内核时不记录版本号的bug
~修复升级后内核版本号丢失的bug
~调整singbox配置文件本地导入策略,现在只会导入config.json
2024-01-11 18:21:50 +08:00
juewuy
ff4fcf736b v1.8.5f
~修复定时任务无法生效以及启动后报错的bug
~修复本地/tmp导入内核时不记录版本号的bug
~修复升级后内核版本号丢失的bug
~调整singbox配置文件本地导入策略,现在只会导入config.json
2024-01-11 16:28:46 +08:00
juewuy
475b3b32e8 v1.8.5e
~修复定时任务无法生效的bug
~修复本地/tmp导入内核时不记录版本号的bug
~修复升级后内核版本号丢失的bug
~调整singbox配置文件本地导入策略,现在只会导入config.json
2024-01-11 15:04:51 +08:00
juewuy
0ac216bf77 已修改 .github/workflows/update_singbox_core.yaml 2024-01-10 22:10:47 +08:00
juewuy
5d93ffe64f Merge branch 'master' of https://github.com/juewuy/ShellCrash into master
# Conflicts:
#	.github/workflows/update_singbox_core.yaml
#	bin/version
2024-01-10 22:06:07 +08:00
juewuy
b5fe9b1acc v1.8.5d
~全面适配singbox内核(自定义节点和规则相关功能除外)
  ·增加了singbox专属dns模式-mix模式
  ·增加了singbox数据库文件下载
  ·增加从/tmp导入singbox内核及singbox配置文件的功能
~正式改名为ShellCrash并调整脚本内相关说明
~重写systemd和procd启动脚本,优化启动流程和启动日志
~重写保守模式及本机代理相关功能,适配singbox内核
~增加第三方Geo数据库下载功能
~任务功能优化,增加旧版任务管理,增加可定时系统重启的任务
~保守模式启动优化
~修改部分在线生成服务器以适配singbox配置生成
~自定义clash节点功能提示优化,修复相关bug
~修复推荐任务每10分钟保存节点配置未生效的bug
2024-01-10 22:03:27 +08:00
juewuy
ce907f5a6d v1.8.5d
~全面适配singbox内核(自定义节点和规则相关功能除外)
  ·增加了singbox专属dns模式-mix模式
  ·增加了singbox数据库文件下载
  ·增加从/tmp导入singbox内核及singbox配置文件的功能
~正式改名为ShellCrash并调整脚本内相关说明
~重写systemd和procd启动脚本,优化启动流程和启动日志
~重写保守模式及本机代理相关功能,适配singbox内核
~增加第三方Geo数据库下载功能
~任务功能优化,增加旧版任务管理,增加可定时系统重启的任务
~保守模式启动优化
~修改部分在线生成服务器以适配singbox配置生成
~自定义clash节点功能提示优化,修复相关bug
~修复推荐任务每10分钟保存节点配置未生效的bug
2024-01-10 22:02:15 +08:00
juewuy
b073c55d90 Update version 2024-01-10 11:16:09 +08:00
juewuy
a3b88011bc Update version 2024-01-09 12:34:57 +08:00
juewuy
0dfc146bb9 Update update_meta_core.yaml 2024-01-09 12:34:02 +08:00
Bot
d37d0cb934 更新Meta内核至v1.18.0 2024-01-09 04:26:59 +00:00
juewuy
b38cdc91b5 Update update_meta_core.yaml 2024-01-09 12:24:39 +08:00
juewuy
3493ee3e5f Update update_singbox_core.yaml 2024-01-08 21:30:36 +08:00
juewuy
a14e09c613 Update update_singbox_core.yaml 2024-01-08 21:29:06 +08:00
juewuy
94b9c62691 Update update_singbox_core.yaml 2024-01-08 21:28:03 +08:00
Bot
2313647bd2 自动更新最新Dashboard、地址库、根证书 2024-01-06 18:04:48 +00:00
juewuy
101bbae2ba v1.8.4(未测试)
~全面适配singbox内核
~保守模式启动优化
~修复推荐任务每10分钟保存节点配置未生效的bug
2024-01-06 22:35:41 +08:00
Bot
2602a7842a 自动更新最新Dashboard、地址库、根证书 2024-01-06 11:29:10 +00:00
juewuy
485a31ff95 Update bin_update.yml
增加singbox的geoip_cn.db和geosite_cn.db的生成
2024-01-06 19:28:33 +08:00
juewuy
42a5474939 Merge branch 'master' of https://github.com/juewuy/ShellCrash into master
# Conflicts:
#	scripts/clash.sh
#	scripts/getdate.sh
2024-01-05 13:35:15 +08:00
juewuy
7fc1fa20d8 为适配singbox修改部分变量名及文本 2024-01-05 13:24:07 +08:00
juewuy
1f4deaa2e9 增加singbox内核生成文件 2024-01-05 13:22:40 +08:00
juewuy
99a0c8494c v1.8.3d
~添加重启设备的定时任务
~修复不显示运行时长的bug
~修复卸载时部分报错
~修复下载列表结构错乱的bug
~修复数据库版本号显示不正常的bug
~修复重复下载面板的bug
~修复未能正确移除版本升级包及安装包的bug
2024-01-05 13:15:44 +08:00
juewuy
809a5b224c v1.8.3d
~修复数据库无法下载的bug
2024-01-04 23:05:00 +08:00
juewuy
e93af12812 v1.8.3d
~修复数据库无法下载的bug
2024-01-04 23:00:42 +08:00
51 changed files with 47203 additions and 45815 deletions

View File

@@ -20,9 +20,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@master
- name: Checkout ShellCrash
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
repository: juewuy/ShellCrash
ref: dev
- name: Apt Update
env:
DEBIAN_FRONTEND: noninteractive
@@ -105,6 +107,8 @@ jobs:
curl -kfSL -o geodata/china_ip_list.txt https://raw.githubusercontent.com/17mon/china_ip_list/master/china_ip_list.txt
curl -kfSL -o geodata/china_ipv6_list.txt https://raw.githubusercontent.com/ChanthMiao/China-IPv6-List/release/cn6.txt
curl -kfSL -o geodata/geosite.dat https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geosite.dat
curl -kfSL -o geodata/geoip_cn.db https://github.com/lyc8503/sing-box-rules/releases/latest/download/geoip-cn.db
curl -kfSL -o geodata/geosite_cn.db https://github.com/SagerNet/sing-geosite/releases/latest/download/geosite-cn.db
curl -kfSL -o fix/ca-certificates.crt https://raw.githubusercontent.com/P3TERX/ca-certificates.crt/download/ca-certificates.crt
sed -i '/GeoIP_v*/'d version
echo GeoIP_v=`date '+%Y%m%d'` >> version

View File

@@ -1,55 +0,0 @@
name: Update Clash Core
on:
workflow_dispatch:
inputs:
version:
description: 'version of Clash, such as v1.10.6'
required: true
type: string
env:
download_version: ${{ github.event.inputs.version }}
download_url: https://github.com/Dreamacro/clash/releases/download
jobs:
Update:
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@main
- name: Init Dependencies
run: |
wget https://github.com/upx/upx/releases/download/v3.96/upx-3.96-amd64_linux.tar.xz
wget https://github.com/upx/upx/releases/download/v3.93/upx-3.93-amd64_linux.tar.xz
tar xf upx-3.96-amd64_linux.tar.xz
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"
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}
chmod +x ./tmp/clash-linux-${arch}
if [ "${arch}" != "armv5" ];then
if [[ ${arch} == mips* ]];then
./upx-3.93-amd64_linux/upx ./tmp/clash-linux-${arch}
else
./upx-3.96-amd64_linux/upx ./tmp/clash-linux-${arch}
fi
fi
done
rm -fr upx*
- name: Update
run: |
rm -fr ./bin/clash/*
cp ./tmp/* ./bin/clash/
rm -fr ./tmp
sed -i "s/clash_v=.*/clash_v=$(./bin/clash/clash-linux-amd64 -v 2>/dev/null | sed 's/ linux.*//;s/.* //')/" bin/version
- name: Commit and push
run: |
git config --global user.email "juewuy@gmail.com" && git config --global user.name "Bot"
git add . && git commit -m "更新Clash内核至${download_version}" || exit 0
git push
- name: Cleanup Workflow
uses: Mattraks/delete-workflow-runs@main
with:
retain_days: 1
keep_minimum_runs: 2

View File

@@ -47,10 +47,10 @@ jobs:
rm -fr upx*
- name: Update
run: |
rm -fr ./bin/clash.meta/*
cp ./tmp/* ./bin/clash.meta/
rm -fr ./bin/meta/*
cp ./tmp/* ./bin/meta/
rm -fr ./tmp
sed -i "s/meta_v=.*/meta_v=$(./bin/clash.meta/clash-linux-amd64 -v 2>/dev/null | head -n 1 | sed 's/ linux.*//;s/.* //')/" bin/version
sed -i "s/meta_v=.*/meta_v=$(./bin/meta/clash-linux-amd64 -v 2>/dev/null | head -n 1 | sed 's/ linux.*//;s/.* //')/" bin/version
- name: Commit and push
run: |
git config --global user.email "juewuy@gmail.com" && git config --global user.name "Bot"

View File

@@ -0,0 +1,179 @@
name: Test meta Core for ShellCrash
on:
workflow_dispatch:
inputs:
tag1:
description: 'project name of meta, such as MetaCubeX/mihomo'
required: true
type: string
tag2:
description: 'tag or branches of meta, such as v1.18.0 or Alpha'
required: true
type: string
tag3:
description: 'a new prerelease name or not, if value=0, then only upload-artifact'
required: false
type: string
tag4:
description: 'build tags'
required: false
type: string
jobs:
go:
runs-on: ubuntu-latest
outputs:
version: ${{steps.go.outputs.version}}
steps:
- name: get latest go version
id: go
run: |
echo version=$(curl -s https://raw.githubusercontent.com/actions/go-versions/update-versions-manifest-file/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g') >> $GITHUB_OUTPUT
meta:
runs-on: ubuntu-latest
needs: go
env:
REPO: ${{ github.event.inputs.tag1 }}
TAGS: ${{ github.event.inputs.tag4 }}
outputs:
version: ${{steps.meta.outputs.version}}
tags: ${{steps.meta.outputs.tags}}
steps:
- name: setup go
uses: actions/setup-go@v4.1.0
with:
go-version: ${{needs.go.outputs.version}}
- name: get meta version
id: meta
run: |
version=${{ github.event.inputs.tag2 }}
echo version=$version >> $GITHUB_OUTPUT
if [ -z "$TAGS" ];then
echo tags='' >> $GITHUB_OUTPUT
else
echo tags=$TAGS >> $GITHUB_OUTPUT
fi
cross:
strategy:
matrix:
include:
# linux
- name: linux-amd64
goos: linux
goarch: amd64
goamd64: v1
# - name: linux-386
# goos: linux
# goarch: 386
# - name: linux-arm64
# goos: linux
# goarch: arm64
# - name: linux-armv5
# goos: linux
# goarch: arm
# goarm: 5
# - name: linux-armv7
# goos: linux
# goarch: arm
# goarm: 7
# - name: linux-mips-softfloat
# goos: linux
# goarch: mips
# gomips: softfloat
# - name: linux-mipsel-softfloat
# goos: linux
# goarch: mipsle
# gomips: softfloat
# - name: linux-mipsel-hardfloat
# goos: linux
# goarch: mipsle
# gomips: hardfloat
fail-fast: false
runs-on: ubuntu-latest
needs: meta
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOAMD64: ${{ matrix.goamd64 }}
GOARM: ${{ matrix.goarm }}
GOMIPS: ${{ matrix.gomips }}
CGO_ENABLED: 0
TAGS: ${{needs.meta.outputs.tags}}
VERSION: ${{needs.meta.outputs.version}}
steps:
- name: Checkout meta
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
repository: ${{ github.event.inputs.tag1 }}
ref: ${{ github.event.inputs.tag2 }}
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ steps.go.outputs.version }}
- name: build core
id: build
run: go build -v -trimpath -ldflags "-X 'github.com/metacubex/mihomo/constant.Version=${VERSION}' -s -w -buildid=" -tags "${TAGS}" -o meta
- name: Upload file to workspace
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: meta
push_prerelease:
needs:
- cross
- meta
runs-on: ubuntu-latest
env:
RELEASE: ${{ github.event.inputs.tag3 }}
VERSION: ${{needs.meta.outputs.version}}
steps:
- name: Download file from workspace
uses: actions/download-artifact@v4
with:
path: ./tmp
- name: Zip core by tar
run: |
for arch in amd64 ;do
mv -f ./tmp/linux-${arch}/meta ./tmp/CrashCore
chmod +x ./tmp/CrashCore
tar --no-same-owner -zcvf ./tmp/meta-linux-${arch}.tar.gz -C ./tmp CrashCore
done
- name: Create Release and Upload Release Asset
if: ${{ env.RELEASE != '0' }}
uses: softprops/action-gh-release@v1
with:
tag_name: meta_core${{ github.event.inputs.tag3 }}
name: meta_core${{ github.event.inputs.tag3 }}
body: "The ${{env.VERSION}} version of ${{ github.event.inputs.tag1 }} \n这是${{ github.event.inputs.tag1 }}的${{env.VERSION}}版本内核文件\nhttps://github.com/${{ github.event.inputs.tag1 }}/releases \nOnly support for ShellCrash\n仅适配ShellCrash项目使用"
draft: false
prerelease: true
files: |
./tmp/meta*
- name: upload artifact
if: ${{ env.RELEASE == '0' }}
uses: actions/upload-artifact@v4.1.0
with:
name: meta-${{env.VERSION}}-${{matrix.jobs.output}}
path: |
./tmp/meta*
compression-level: 9
- name: Cleanup Workflow
uses: Mattraks/delete-workflow-runs@main
with:
retain_days: 1
keep_minimum_runs: 2

View File

@@ -1,53 +0,0 @@
name: Update Premium latest Core
on:
schedule:
- cron: 0 20 * * 6
workflow_dispatch:
env:
download_version: latest
download_url: https://release.dreamacro.workers.dev
jobs:
Update:
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@main
- name: Init Dependencies
run: |
wget https://github.com/upx/upx/releases/download/v3.96/upx-3.96-amd64_linux.tar.xz
wget https://github.com/upx/upx/releases/download/v3.93/upx-3.93-amd64_linux.tar.xz
tar xf upx-3.96-amd64_linux.tar.xz
tar xf upx-3.93-amd64_linux.tar.xz
- name: Download Core
run: |
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}
chmod +x ./tmp/clash-linux-${arch}
if [ "${arch}" != "armv5" ];then
if [[ ${arch} == mips* ]];then
./upx-3.93-amd64_linux/upx ./tmp/clash-linux-${arch}
else
./upx-3.96-amd64_linux/upx ./tmp/clash-linux-${arch}
fi
fi
done
mv -f ./tmp/clash-linux-arm64 ./tmp/clash-linux-armv8
rm -fr upx*
- name: Create Release and Upload Release Asset
uses: softprops/action-gh-release@v1
with:
tag_name: clash.premium.latest
name: clash.premium.latest
body: "The latest version of clash.premium core \n这是clash.premium的最新版本内核文件\nhttps://github.com/Dreamacro/clash/releases/tag/premium \nZip by upx\n使用了upx进行压缩\nOnly support for ShellClash\n仅限于ShellClash项目使用"
draft: false
prerelease: true
files: |
./tmp/*
- name: Cleanup Workflow
uses: Mattraks/delete-workflow-runs@main
with:
retain_days: 1
keep_minimum_runs: 2

View File

@@ -1,56 +0,0 @@
name: Update Premium Core
on:
workflow_dispatch:
inputs:
version:
description: 'version of Clash Premium, such as 2022.05.18'
required: true
type: string
env:
download_version: ${{ github.event.inputs.version }}
download_url: https://release.dreamacro.workers.dev
jobs:
Update:
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@main
- name: Init Dependencies
run: |
wget https://github.com/upx/upx/releases/download/v3.96/upx-3.96-amd64_linux.tar.xz
wget https://github.com/upx/upx/releases/download/v3.93/upx-3.93-amd64_linux.tar.xz
tar xf upx-3.96-amd64_linux.tar.xz
tar xf upx-3.93-amd64_linux.tar.xz
- name: Download Core
run: |
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}
chmod +x ./tmp/clash-linux-${arch}
if [ "${arch}" != "armv5" ];then
if [[ ${arch} == mips* ]];then
./upx-3.93-amd64_linux/upx ./tmp/clash-linux-${arch}
else
./upx-3.96-amd64_linux/upx ./tmp/clash-linux-${arch}
fi
fi
done
mv -f ./tmp/clash-linux-arm64 ./tmp/clash-linux-armv8
rm -fr upx*
- name: Update
run: |
rm -fr ./bin/clashpre/*
cp ./tmp/* ./bin/clashpre/
rm -fr ./tmp
sed -i "s/clashpre_v=.*/clashpre_v=$(./bin/clashpre/clash-linux-amd64 -v 2>/dev/null | sed 's/ linux.*//;s/.* //')/" bin/version
- name: Commit and push
run: |
git config --global user.email "juewuy@gmail.com" && git config --global user.name "Bot"
git add . && git commit -m "更新Premium内核至${download_version}" || exit 0
git push
- name: Cleanup Workflow
uses: Mattraks/delete-workflow-runs@main
with:
retain_days: 1
keep_minimum_runs: 2

View File

@@ -1,55 +1,136 @@
name: Update Sing-Box Core
on:
workflow_dispatch:
name: Build Sing-Box Core for ShellCrash
env:
download_project: SagerNet/sing-box
on:
workflow_dispatch:
inputs:
tag:
description: 'tag of sing-box, such as v1.7.8'
required: true
type: string
jobs:
Update:
cross:
strategy:
matrix:
include:
# linux
- name: linux-amd64
goos: linux
goarch: amd64
goamd64: v1
- name: linux-386
goos: linux
goarch: 386
- name: linux-arm64
goos: linux
goarch: arm64
- name: linux-armv5
goos: linux
goarch: arm
goarm: 5
- name: linux-armv7
goos: linux
goarch: arm
goarm: 7
- name: linux-mips-softfloat
goos: linux
goarch: mips
gomips: softfloat
- name: linux-mipsel-softfloat
goos: linux
goarch: mipsle
gomips: softfloat
- name: linux-mipsel-hardfloat
goos: linux
goarch: mipsle
gomips: hardfloat
fail-fast: false
runs-on: ubuntu-latest
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOAMD64: ${{ matrix.goamd64 }}
GOARM: ${{ matrix.goarm }}
GOMIPS: ${{ matrix.gomips }}
CGO_ENABLED: 0
TAGS: with_quic,with_wireguard,with_ech,with_utls,with_reality_server,with_acme,with_clash_api
steps:
- name: Checkout sing-box
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
repository: SagerNet/sing-box
ref: ${{ github.event.inputs.tag }}
fetch-depth: 0
- name: Get latest go version
id: version
run: |
echo go_version=$(curl -s https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g') >> $GITHUB_OUTPUT
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ steps.version.outputs.go_version }}
- name: Build
id: build
run: make
- name: Upload file to workspace
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: sing-box
push_ShellCrash:
needs: cross
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@main
- name: Init Dependencies
run: |
wget https://github.com/upx/upx/releases/download/v3.96/upx-3.96-amd64_linux.tar.xz
wget https://github.com/upx/upx/releases/download/v3.93/upx-3.93-amd64_linux.tar.xz
tar xf upx-3.96-amd64_linux.tar.xz
tar xf upx-3.93-amd64_linux.tar.xz
- name: Download Core
run: |
download_version=$(curl -s -L -o /dev/null -w '%{url_effective}' https://github.com/${download_project}/releases/latest | grep -oE "[^/]+$" | awk -F 'v' '{print $2}')
echo "download_version=${download_version}" >> ${GITHUB_ENV}
archs=(386 amd64 armv7 arm64)
new_name=(386 amd64 armv7 armv8)
mkdir tmp
for((i=0;i<4;i++));do
wget "https://github.com/${download_project}/releases/download/v${download_version}/sing-box-${download_version}-linux-${archs[i]}.tar.gz" -O ./tmp/core.tar.gz
tar -zxvf ./tmp/core.tar.gz -C './tmp'
mv -f ./tmp/sing-box-${download_version}-linux-${archs[i]}/sing-box ./tmp/singbox-linux-${new_name[i]}
chmod +x ./tmp/singbox-linux-${new_name[i]}
if [ "${archs[i]}" != "armv5" ];then
if [[ ${archs[i]} = mips* ]];then
./upx-3.93-amd64_linux/upx ./tmp/singbox-linux-${new_name[i]}
else
./upx-3.96-amd64_linux/upx ./tmp/singbox-linux-${new_name[i]}
- name: Checkout ShellCrash
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
repository: juewuy/ShellCrash
ref: dev
- name: Get upx
run: |
wget https://github.com/upx/upx/releases/download/v3.96/upx-3.96-amd64_linux.tar.xz
wget https://github.com/upx/upx/releases/download/v3.93/upx-3.93-amd64_linux.tar.xz
tar xf upx-3.96-amd64_linux.tar.xz
tar xf upx-3.93-amd64_linux.tar.xz
- name: Download file from workspace
uses: actions/download-artifact@v4
with:
path: ./tmp
- name: Zip core by upx
run: |
archs=(amd64 armv5 armv7 arm64 mips-softfloat mipsel-hardfloat mipsel-softfloat)
new_name=(amd64 armv5 armv7 armv8 mips-softfloat mipsle-hardfloat mipsle-softfloat)
for((i=0;i<7;i++));do
mv -f ./tmp/linux-${archs[i]}/sing-box ./tmp/singbox-linux-${new_name[i]}
chmod +x ./tmp/singbox-linux-${new_name[i]}
if [ "${archs[i]}" != "armv5" ];then
if [[ ${archs[i]} = mips* ]];then
./upx-3.93-amd64_linux/upx ./tmp/singbox-linux-${new_name[i]}
else
./upx-3.96-amd64_linux/upx ./tmp/singbox-linux-${new_name[i]}
fi
fi
fi
done
rm -rf ./tmp/LICENSE
rm -fr upx*
- name: Create Release and Upload Release Asset
uses: softprops/action-gh-release@v1
with:
tag_name: singbox_core
name: singbox_core
body: "The alpha version of singbox core \n这是singbox的官方版本内核文件\nhttps://github.com/${download_project}/releases \nZip by upx\n使用了upx进行压缩\nOnly support for ShellCrash\n仅限于ShellCrash项目使用"
draft: false
prerelease: true
files: |
./tmp/*
- name: Cleanup Workflow
uses: Mattraks/delete-workflow-runs@main
with:
retain_days: 1
keep_minimum_runs: 2
done
rm -fr upx*
- name: Update
run: |
mkdir -p ./bin/singbox
rm -fr ./bin/singbox/*
mv -f ./tmp/singbox-linux-* ./bin/singbox/
rm -fr ./tmp
sed -i "s/singbox_v=.*/singbox_v=$(./bin/singbox/singbox-linux-amd64 version 2>/dev/null | grep -Eo 'version .*' | sed 's/version //')/" bin/version
- name: Commit and push
run: |
git config --global user.email "juewuy@gmail.com" && git config --global user.name "Bot"
git add . && git commit -m "更新sing-box内核至${{ github.event.inputs.tag }}" || exit 0
git push
- name: Cleanup Workflow
uses: Mattraks/delete-workflow-runs@main
with:
retain_days: 1
keep_minimum_runs: 2
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sing-box-${{ matrix.name }}
path: sing-box*

View File

@@ -0,0 +1,207 @@
name: Test Sing-Box Core for ShellCrash
on:
workflow_dispatch:
inputs:
tag1:
description: 'project name of sing-box, such as SagerNet/sing-box'
required: true
type: string
tag2:
description: 'tag or branches of sing-box, such as v1.7.8 or dev-next'
required: true
type: string
tag3:
description: 'a new prerelease name or not, if value=0, then only upload-artifact'
required: false
type: string
tag4:
description: 'build tags'
required: false
type: string
jobs:
go:
runs-on: ubuntu-latest
outputs:
version: ${{steps.go.outputs.version}}
steps:
- name: get latest go version
id: go
run: |
echo version=$(curl -s https://raw.githubusercontent.com/actions/go-versions/update-versions-manifest-file/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g') >> $GITHUB_OUTPUT
sing-box:
runs-on: ubuntu-latest
needs: go
env:
REPO: ${{ github.event.inputs.tag1 }}
TAGS: ${{ github.event.inputs.tag4 }}
outputs:
version: ${{steps.sing-box.outputs.version}}
tags: ${{steps.sing-box.outputs.tags}}
steps:
- uses: actions/checkout@v4.1.1
with:
repository: ${{ github.event.inputs.tag1 }}
ref: ${{ github.event.inputs.tag2 }}
fetch-depth: 0
- name: setup go
uses: actions/setup-go@v4.1.0
with:
go-version: ${{needs.go.outputs.version}}
- name: get sing-box version
id: sing-box
run: |
git remote add sekai https://github.com/SagerNet/sing-box.git
git fetch --tags sekai
version=$(CGO_ENABLED=0 go run ./cmd/internal/read_tag)
[ -z "$version" ] && version=${{ github.event.inputs.tag2 }}
echo version=$version >> $GITHUB_OUTPUT
if [ -z "$TAGS" ];then
if [ "$REPO" = 'PuerNya/sing-box' ];then
echo tags=with_quic,with_shadowsocksr,with_ech,with_utls,with_reality_server,with_clash_api >> $GITHUB_OUTPUT
else
echo tags=with_quic,with_ech,with_utls,with_reality_server,with_clash_api >> $GITHUB_OUTPUT
fi
else
echo tags=$TAGS >> $GITHUB_OUTPUT
fi
cross:
strategy:
matrix:
include:
# linux
- name: linux-amd64
goos: linux
goarch: amd64
goamd64: v1
- name: linux-386
goos: linux
goarch: 386
- name: linux-arm64
goos: linux
goarch: arm64
- name: linux-armv5
goos: linux
goarch: arm
goarm: 5
- name: linux-armv7
goos: linux
goarch: arm
goarm: 7
- name: linux-mips-softfloat
goos: linux
goarch: mips
gomips: softfloat
- name: linux-mipsel-softfloat
goos: linux
goarch: mipsle
gomips: softfloat
- name: linux-mipsel-hardfloat
goos: linux
goarch: mipsle
gomips: hardfloat
fail-fast: false
runs-on: ubuntu-latest
needs: sing-box
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOAMD64: ${{ matrix.goamd64 }}
GOARM: ${{ matrix.goarm }}
GOMIPS: ${{ matrix.gomips }}
CGO_ENABLED: 0
TAGS: ${{needs.sing-box.outputs.tags}}
VERSION: ${{needs.sing-box.outputs.version}}
steps:
- name: Checkout sing-box
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
repository: ${{ github.event.inputs.tag1 }}
ref: ${{ github.event.inputs.tag2 }}
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ steps.go.outputs.version }}
- name: build core
id: build
run: go build -v -trimpath -ldflags "-X 'github.com/sagernet/sing-box/constant.Version=${VERSION}' -s -w -buildid=" -tags "${TAGS}" ./cmd/sing-box
- name: Upload file to workspace
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: sing-box
push_prerelease:
needs:
- cross
- sing-box
runs-on: ubuntu-latest
env:
RELEASE: ${{ github.event.inputs.tag3 }}
VERSION: ${{needs.sing-box.outputs.version}}
steps:
- name: Get upx
run: |
wget https://github.com/upx/upx/releases/download/v3.96/upx-3.96-amd64_linux.tar.xz
wget https://github.com/upx/upx/releases/download/v3.93/upx-3.93-amd64_linux.tar.xz
tar xf upx-3.96-amd64_linux.tar.xz
tar xf upx-3.93-amd64_linux.tar.xz
- name: Download file from workspace
uses: actions/download-artifact@v4
with:
path: ./tmp
- name: Zip core by upx
run: |
archs=(amd64 armv5 armv7 arm64 mips-softfloat mipsel-hardfloat mipsel-softfloat)
new_name=(amd64 armv5 armv7 armv8 mips-softfloat mipsle-hardfloat mipsle-softfloat)
for((i=0;i<7;i++));do
mv -f ./tmp/linux-${archs[i]}/sing-box ./tmp/singbox-linux-${new_name[i]}
chmod +x ./tmp/singbox-linux-${new_name[i]}
if [ "${archs[i]}" != "armv5" ];then
if [[ ${archs[i]} = mips* ]];then
./upx-3.93-amd64_linux/upx ./tmp/singbox-linux-${new_name[i]}
else
./upx-3.96-amd64_linux/upx ./tmp/singbox-linux-${new_name[i]}
fi
fi
done
rm -fr upx*
rm -fr ./tmp/core.tar.gz
echo ${VERSION} > ./tmp/version
- name: Create Release and Upload Release Asset
if: ${{ env.RELEASE != '0' }}
uses: softprops/action-gh-release@v1
with:
tag_name: singbox_core${{ github.event.inputs.tag3 }}
name: singbox_core${{ github.event.inputs.tag3 }}
body: "The ${{env.VERSION}} version of ${{ github.event.inputs.tag1 }} \n这是${{ github.event.inputs.tag1 }}的${{env.VERSION}}版本内核文件\nhttps://github.com/${{ github.event.inputs.tag1 }}/releases \nZip by upx\n使用了upx进行压缩\nOnly support for ShellCrash\n仅限于ShellCrash项目使用"
draft: false
prerelease: true
files: |
./tmp/*
- name: upload artifact
if: ${{ env.RELEASE == '0' }}
uses: actions/upload-artifact@v4.1.0
with:
name: sing-box-${{env.VERSION}}-${{matrix.jobs.output}}
path: |
./tmp/sing-box*
compression-level: 9
- name: Cleanup Workflow
uses: Mattraks/delete-workflow-runs@main
with:
retain_days: 1
keep_minimum_runs: 2

View File

@@ -101,9 +101,26 @@ export url='https://fastly.jsdelivr.net/gh/juewuy/ShellCrash@master' && wget -q
export url='http://t.jwsc.eu.org' && wget -q -O /tmp/install.sh $url/install.sh && sh /tmp/install.sh && source /etc/profile &> /dev/null
```
~**DOCKER环境安装:**<br>
~**虚拟机/Docker环境安装:**<br>
虚拟机或Docker环境推荐使用Alpine镜像安装<br>
这里以Docker为例(其他虚拟机请自行查找安装Alpine镜像安装教程)<br>
```shell
#注意,以下命令请分步执行!
#Docker一键启动Alpine镜像
docker run -d --name ShellCrash alpine sleep infinity
#进入容器内sh环境
docker exec -it ShellCrash sh
#安装必要依赖
apk add curl
apk add nftables
#执行安装命令
export url='https://fastly.jsdelivr.net/gh/juewuy/ShellCrash@master' && sh -c "$(curl -kfsSl $url/install.sh)" && source /etc/profile &> /dev/null
```
请参考 [ShellCrash_docker 一键脚本和镜像](https://github.com/echvoyager/shellCrash_docker)
### **本地安装:**<br>

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.

View File

@@ -2,7 +2,6 @@
2001:254::/31
2001:256:100::/48
2001:550:1601::/48
2001:678:d3c::/48
2001:67c:aec::/48
2001:67c:c28::/48
2001:7fa:5::/48
@@ -13,8 +12,8 @@
2001:dd8:1::/48
2001:dd8:5::/48
2001:dd9::/48
2001:df0:2e00::/48
2001:df0:ac40::/48
2001:df1:2b40::/48
2001:df1:5fc0::/48
2001:df1:6b80::/48
2001:df1:bd80::/48
@@ -34,6 +33,7 @@
2400:6000::/32
2400:6460::/40
2400:6600::/32
2400:6e60:1301::/48
2400:70e0:bed::/48
2400:72e0:9f00::/40
2400:73e0:201::/48
@@ -64,7 +64,6 @@
2400:9380:8001::/48
2400:9380:8003::/48
2400:9380:8021::/48
2400:9380:8030::/48
2400:9380:8040::/48
2400:9380:8140::/48
2400:9380:8201::/48
@@ -75,7 +74,6 @@
2400:9380:9009::/48
2400:9380:900a::/48
2400:9380:9020::/47
2400:9380:9030::/47
2400:9380:9040::/47
2400:9380:9050::/47
2400:9380:9060::/48
@@ -88,7 +86,6 @@
2400:9380:9201::/48
2400:9380:9202::/48
2400:9380:9220::/47
2400:9380:9230::/47
2400:9380:9240::/47
2400:9380:9250::/47
2400:9380:9252::/48
@@ -110,7 +107,7 @@
2400:be00::/48
2400:da00::/32
2400:dd00::/28
2400:ebc0::/32
2400:f6e0::/32
2400:f720::/32
2400:f7c0::/32
2400:fb40::/32
@@ -119,6 +116,8 @@
2401:800::/32
2401:1160::/32
2401:11a0:150::/44
2401:11a0:1500::/40
2401:1200::/48
2401:1320::/32
2401:13a0:1::/48
2401:1740:2000::/48
@@ -132,6 +131,7 @@
2401:3800::/32
2401:5960:5960::/48
2401:7700::/32
2401:7d40::/32
2401:7e00::/32
2401:8d00::/46
2401:8d00:7::/48
@@ -156,7 +156,6 @@
2401:cb80::/32
2401:cc00::/32
2401:ce00::/32
2401:cec0::/32
2401:d180::/46
2401:d180:10::/47
2401:d180:2120::/48
@@ -175,6 +174,7 @@
2402:4440::/32
2402:4b80::/32
2402:4e00::/32
2402:5e40::/32
2402:5ec0::/32
2402:6e80::/32
2402:6f40::/48
@@ -198,6 +198,11 @@
2402:dfc0::/44
2402:dfc0:50::/44
2402:e380:100::/40
2402:e380:302::/48
2402:e380:306::/48
2402:e380:308::/48
2402:e380:30c::/48
2402:e380:312::/48
2402:e480::/32
2402:e740::/32
2402:e7c0::/32
@@ -215,6 +220,7 @@
2403:1ec0:1400::/48
2403:1ec0:1610::/48
2403:2040::/32
2403:27c0:c03::/48
2403:27c0:1000::/48
2403:2b40::/32
2403:3140::/32
@@ -281,6 +287,7 @@
2404:2280:1d8::/45
2404:2280:1e0::/48
2404:2280:1e2::/47
2404:2280:1e4::/47
2404:6380::/48
2404:6380:1000::/48
2404:6380:8001::/48
@@ -294,8 +301,6 @@
2404:7180:b001::/48
2404:7180:b002::/48
2404:7180:b010::/48
2404:7180:b021::/48
2404:7180:b022::/48
2404:7180:c001::/48
2404:7180:c002::/48
2404:7180:c011::/48
@@ -321,6 +326,7 @@
2404:e280::/47
2404:e5c0::/32
2404:e8c0::/32
2404:ea80:400:129::/64
2404:ea80:400:2116::/64
2404:ea80:500:575::/64
2404:ea80:600:623::/64
@@ -348,6 +354,8 @@
2405:6f00:c602::/48
2405:7040:6000::/47
2405:78c0:6e00::/43
2405:8280::/32
2405:84c0:ff80::/44
2405:8a40::/32
2405:a900:ffee::/48
2405:a900:fffe::/48
@@ -370,7 +378,7 @@
2406:840:100::/48
2406:840:1c0::/48
2406:840:301::/48
2406:840:380::/48
2406:840:410::/48
2406:840:800::/42
2406:840:840::/47
2406:840:860::/48
@@ -383,7 +391,6 @@
2406:840:2800::/48
2406:840:3800::/48
2406:840:4100::/47
2406:840:4380::/47
2406:840:4800::/47
2406:840:4880::/47
2406:840:5100::/47
@@ -391,7 +398,7 @@
2406:840:5860::/47
2406:840:5880::/47
2406:840:8100::/40
2406:840:9000::/46
2406:840:9000::/44
2406:840:9100::/47
2406:840:9102::/48
2406:840:9200::/40
@@ -419,12 +426,11 @@
2406:840:e180::/44
2406:840:e20f::/48
2406:840:e230::/48
2406:840:e280::/47
2406:840:e280::/48
2406:840:e300::/47
2406:840:e340::/44
2406:840:e36f::/48
2406:840:e501::/48
2406:840:e571::/48
2406:840:e500::/47
2406:840:e576::/48
2406:840:e57b::/48
2406:840:e57f::/48
@@ -440,16 +446,16 @@
2406:840:e84c::/47
2406:840:e84f::/48
2406:840:e880::/44
2406:840:eab0::/48
2406:840:eab2::/47
2406:840:eabf::/48
2406:840:eab0::/46
2406:840:eab4::/48
2406:840:eab6::/48
2406:840:eb00::/46
2406:840:eb04::/47
2406:840:eb07::/48
2406:840:eb08::/47
2406:840:eb0b::/48
2406:840:eb0f::/48
2406:840:eb80::/42
2406:840:eeee::/48
2406:840:efa0::/44
2406:840:f0a1::/48
2406:840:f0aa::/48
2406:840:f100::/47
@@ -472,11 +478,12 @@
2406:840:fd06::/48
2406:840:fd1f::/48
2406:840:fe27::/48
2406:840:fe40::/48
2406:840:fe4a::/48
2406:840:fe50::/48
2406:840:fe60::/48
2406:840:fe72::/47
2406:840:fec0::/47
2406:840:fec4::/48
2406:840:fec8::/48
2406:840:fed1::/48
2406:840:fed2::/47
@@ -501,6 +508,7 @@
2406:52c0::/32
2406:5340:6666::/48
2406:5340:8888::/48
2406:5ac0::/32
2406:94c0::/48
2406:b640:100::/48
2406:b640:4100::/48
@@ -511,6 +519,7 @@
2406:d440:300::/44
2406:d440:500::/48
2406:d440:600::/48
2406:e3c0::/32
2406:e500::/33
2407:2840::/48
2407:3740::/48
@@ -522,6 +531,7 @@
2407:6c40:1500::/48
2407:6c40:1810::/48
2407:7d00:1::/48
2407:8f40:2::/48
2407:9f00::/32
2407:ad80::/32
2407:ae80::/32
@@ -993,8 +1003,7 @@
2408:8962::/31
2408:8964::/31
2408:8966::/32
2408:896c::/32
2408:896e::/31
2408:896c::/30
2408:8978::/30
2408:897e::/32
2408:8a00:c000::/36
@@ -1108,14 +1117,15 @@
240e::/20
2602:2a3::/40
2602:2a4:ff::/48
2602:f9a9:101::/48
2602:f9ba:a9::/48
2602:f9df:400::/48
2602:f9df:410::/48
2602:f9df:420::/48
2602:f9df:500::/48
2602:f9df:505::/48
2602:f9df:510::/47
2602:f9f6::/40
2602:f9f6:400::/44
2602:f9f6:c01::/48
2602:f9f6:f00::/40
2602:fa1c:121::/48
2602:fab0:11::/48
2602:fbda:600::/48
@@ -1124,7 +1134,6 @@
2602:fc52:311::/48
2602:fc52:312::/48
2602:fc52:315::/48
2602:fd50:20::/48
2602:fd92:800::/40
2602:fe69:f26::/47
2602:fed2:7020::/46
@@ -1148,6 +1157,7 @@
2602:feda:ca1::/48
2602:feda:d80::/48
2602:feda:d83::/48
2602:ffe4:c5f::/48
2605:640f:bcd7::/48
2605:9d80:8001::/48
2605:9d80:8011::/48
@@ -1167,7 +1177,6 @@
2605:f440:cafe::/48
2607:7640::/48
2804:1e48::/32
2a03:5840:f3::/48
2a03:5840:290::/48
2a04:3e00:1002::/48
2a04:f580:8010::/47
@@ -1203,6 +1212,7 @@
2a05:1087::/32
2a05:dfc1:1602::/48
2a05:dfc1:16ff::/48
2a05:dfc1:5900::/41
2a05:dfc1:5a00::/40
2a05:dfc1:6601::/48
2a05:dfc1:6607::/48
@@ -1222,6 +1232,7 @@
2a05:dfc1:8c24::/48
2a05:dfc1:8c40::/48
2a05:dfc1:8c90::/47
2a05:dfc1:8c94::/47
2a05:dfc1:8c98::/47
2a05:dfc1:8d00::/48
2a05:dfc1:8d02::/48
@@ -1232,7 +1243,9 @@
2a06:a005:486::/48
2a06:a005:8d0::/47
2a06:a005:8da::/48
2a06:a005:910::/44
2a06:a005:9c0::/48
2a06:a005:a13::/48
2a06:a005:b69::/48
2a06:a005:d22::/48
2a06:a005:f80::/44
@@ -1247,8 +1260,12 @@
2a06:a005:1700::/44
2a06:a005:1800::/48
2a06:a005:1b60::/47
2a06:a005:1c40::/44
2a06:a005:1ee1::/48
2a06:a005:1eee::/48
2a06:a005:2040::/44
2a06:a005:2100::/44
2a06:a005:2200::/44
2a06:a005:2510::/48
2a06:a005:28f3::/48
2a06:a005:28f4::/48
@@ -1260,31 +1277,34 @@
2a06:a005:2980::/44
2a06:a005:29d1::/48
2a06:de00:de04::/48
2a06:de00:de0e::/48
2a06:de01:809::/48
2a06:de01:814::/48
2a06:de01:83c::/48
2a06:de01:85c::/48
2a06:de01:87e::/48
2a06:de01:8a3::/48
2a06:de01:8a9::/48
2a06:de01:8bb::/48
2a06:de01:8c9::/48
2a06:de01:8ca::/48
2a06:de01:8dd::/48
2a06:de01:928::/48
2a06:de01:92d::/48
2a06:de01:92f::/48
2a06:de01:952::/48
2a06:de01:964::/48
2a06:de01:987::/48
2a06:de01:9a1::/48
2a06:de00:de0e::/47
2a06:de01:804::/48
2a06:de01:81e::/48
2a06:de01:824::/48
2a06:de01:861::/48
2a06:de01:869::/48
2a06:de01:876::/48
2a06:de01:885::/48
2a06:de01:8a1::/48
2a06:de01:8bd::/48
2a06:de01:8cb::/48
2a06:de01:8ce::/48
2a06:de01:8f5::/48
2a06:de01:907::/48
2a06:de01:912::/48
2a06:de01:927::/48
2a06:de01:942::/48
2a06:de01:947::/48
2a06:de01:959::/48
2a06:de01:9a9::/48
2a06:de01:ae0::/48
2a06:de01:aec::/48
2a06:de01:af2::/48
2a06:de01:b18::/48
2a06:de01:b3f::/48
2a06:de01:9aa::/48
2a06:de01:9be::/48
2a06:de01:ac1::/48
2a06:de01:ad6::/48
2a06:de01:aef::/48
2a06:de01:afe::/48
2a06:de01:b12::/48
2a06:de01:b26::/48
2a06:e881:2509::/48
2a06:e881:5501::/48
2a06:e881:5502::/48
@@ -1292,7 +1312,6 @@
2a06:e881:6600::/48
2a06:e881:6602::/47
2a06:e881:6606::/48
2a07:54c7:3010::/48
2a09:b280:ff80::/47
2a09:b280:ff83::/48
2a09:b280:ff84::/47
@@ -1308,7 +1327,7 @@
2a0a:6040:e02::/47
2a0a:6040:ea0::/48
2a0a:6040:f00::/48
2a0a:6040:f10::/47
2a0a:6040:f11::/48
2a0a:6040:1b00::/40
2a0a:6040:2211::/48
2a0a:6040:2222::/48
@@ -1328,10 +1347,9 @@
2a0a:6040:6c40::/44
2a0a:6040:a430::/48
2a0a:6040:a450::/47
2a0a:6040:a720::/48
2a0a:6040:a730::/48
2a0a:6040:a740::/48
2a0a:6040:a900::/47
2a0a:6040:a901::/48
2a0a:6040:b770::/44
2a0a:6040:c601::/48
2a0a:6040:c700::/42
@@ -1345,10 +1363,9 @@
2a0a:6040:d0fe::/48
2a0a:6040:d401::/48
2a0a:6040:d600::/44
2a0a:6040:d610::/48
2a0a:6040:d610::/47
2a0a:6040:d612::/48
2a0a:6040:d615::/48
2a0a:6040:d616::/48
2a0a:6040:d614::/46
2a0a:6040:d710::/44
2a0a:6040:e100::/40
2a0a:6040:e541::/48
@@ -1360,6 +1377,7 @@
2a0a:6040:e900::/40
2a0a:6040:ec00::/40
2a0b:b86:ffe0::/48
2a0b:b87:ffb5::/48
2a0b:2542::/48
2a0b:2542:300::/40
2a0b:4340:6::/48
@@ -1389,13 +1407,15 @@
2a0c:b641:210::/47
2a0c:b641:24f::/48
2a0c:b641:312::/48
2a0c:b641:510::/48
2a0c:b641:570::/47
2a0c:b641:730::/44
2a0c:b641:a11::/48
2a0c:b641:a60::/44
2a0c:b641:b21::/48
2a0c:b641:b25::/48
2a0c:b642:4101::/48
2a0c:b642:4102::/47
2a0c:b642:4104::/47
2a0d:2146:8040::/48
2a0d:2406:510::/46
2a0d:2580:ff00::/45
@@ -1407,6 +1427,7 @@
2a0d:2683:2::/48
2a0d:2687::/32
2a0d:2904::/44
2a0d:2906:f000::/44
2a0d:c7c7::/32
2a0e:800:ff00::/48
2a0e:800:ff04::/48
@@ -1426,6 +1447,7 @@
2a0e:aa06:440::/48
2a0e:aa06:470::/44
2a0e:aa06:490::/44
2a0e:aa06:4e0::/44
2a0e:aa07:e00e::/48
2a0e:aa07:e01b::/48
2a0e:aa07:e024::/46
@@ -1434,7 +1456,6 @@
2a0e:aa07:e039::/48
2a0e:aa07:e03a::/48
2a0e:aa07:e043::/48
2a0e:aa07:e044::/48
2a0e:aa07:e050::/44
2a0e:aa07:e060::/48
2a0e:aa07:e073::/48
@@ -1443,12 +1464,13 @@
2a0e:aa07:e120::/44
2a0e:aa07:e130::/47
2a0e:aa07:e141::/48
2a0e:aa07:e142::/47
2a0e:aa07:e143::/48
2a0e:aa07:e145::/48
2a0e:aa07:e16a::/48
2a0e:aa07:e200::/44
2a0e:aa07:f000::/48
2a0e:aa07:f004::/48
2a0e:aa07:f009::/48
2a0e:aa07:f008::/48
2a0e:aa07:f041::/48
2a0e:aa07:f042::/48
2a0e:aa07:f0d0::/47
@@ -1475,17 +1497,20 @@
2a0e:b107:1b6f::/48
2a0e:b107:1d20::/47
2a0e:b107:1d25::/48
2a0e:b107:2222::/48
2a0e:b107:1e85::/48
2a0f:1440::/29
2a0f:2100::/29
2a0f:5707:ac01::/48
2a0f:5707:fe01::/48
2a0f:5707:fff4::/47
2a0f:7803:fc00::/39
2a0f:7803:fe81::/48
2a0f:7803:fc00::/44
2a0f:7803:fc30::/44
2a0f:7803:fd00::/40
2a0f:7803:fe23::/48
2a0f:7803:fe80::/47
2a0f:7803:fe82::/48
2a0f:7803:ff10::/48
2a0f:7803:ffd0::/47
2a0f:7980::/44
2a0f:85c1:30::/47
2a0f:85c1:100::/47
2a0f:9400:6110::/48
2a0f:9400:7700::/48
@@ -1494,7 +1519,7 @@
2a10:2f00:15a::/48
2a10:2f00:18e::/48
2a10:2f01:100::/48
2a10:cc40:180::/48
2a10:cc40:180::/47
2a10:cc40:188::/48
2a10:cc40:190::/48
2a10:cc42:120::/43
@@ -1503,13 +1528,13 @@
2a10:ccc0:ccc::/48
2a10:ccc0:ccc6::/48
2a10:ccc0:cccc::/46
2a10:ccc1:105::/48
2a11:f2c0:ffc4::/48
2a12:3fc2:6600::/48
2a12:3fc2:6666::/48
2a12:3fc2:aa10::/44
2a12:3fc2:aa40::/44
2a12:3fc2:ab50::/48
2a12:3fc2:e500::/40
2a12:3fc2:e72e::/48
2a12:3fc2:e810::/44
2a12:3fc7::/48
@@ -1526,23 +1551,17 @@
2a13:1800:300::/44
2a13:1801:180::/43
2a13:1802::/44
2a13:a5c3:1000::/36
2a13:a5c3:2000::/35
2a13:a5c3:4000::/36
2a13:a5c3:f000::/40
2a13:a5c4:1000::/38
2a13:a5c4:1400::/39
2a13:a5c7:1200::/40
2a13:a5c7:1500::/40
2a13:a5c7:1600::/45
2a13:a5c7:1608::/47
2a13:a5c7:160a::/48
2a13:a5c7:1802::/48
2a13:b487:1200::/43
2a13:b487:1b86::/48
2a13:b487:1bb2::/48
2a13:b487:1bb7::/48
2a13:b487:1bbb::/48
2a13:b487:1f00::/47
2a13:b487:4100::/40
2a13:b487:1f00::/45
2a13:b487:4200::/47
2a13:b487:4210::/44
2a13:b487:4220::/43
@@ -1550,10 +1569,10 @@
2a13:b487:42d0::/44
2a13:df80:6808::/48
2a13:df85:be00::/48
2a13:df85:be10::/48
2a13:df85:be80::/48
2a13:df85:be88::/48
2a13:df85:be90::/48
2a13:df85:beaa::/48
2a13:df85:befe::/48
2c0f:f7a8:8011::/48
2c0f:f7a8:8050::/48

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 124 KiB

BIN
bin/geodata/geoip_cn.db Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 KiB

File diff suppressed because one or more lines are too long

BIN
bin/geodata/geosite_cn.db Normal file

Binary file not shown.

BIN
bin/meta/clash-linux-amd64 Normal file → Executable file

Binary file not shown.

BIN
bin/meta/clash-linux-armv5 Normal file → Executable file

Binary file not shown.

BIN
bin/meta/clash-linux-armv7 Normal file → Executable file

Binary file not shown.

BIN
bin/meta/clash-linux-armv8 Normal file → Executable file

Binary file not shown.

BIN
bin/meta/clash-linux-mips-softfloat Normal file → Executable file

Binary file not shown.

BIN
bin/meta/clash-linux-mipsle-hardfloat Normal file → Executable file

Binary file not shown.

BIN
bin/meta/clash-linux-mipsle-softfloat Normal file → Executable file

Binary file not shown.

Binary file not shown.

BIN
bin/singbox/singbox-linux-amd64 Executable file

Binary file not shown.

BIN
bin/singbox/singbox-linux-armv5 Executable file

Binary file not shown.

BIN
bin/singbox/singbox-linux-armv7 Executable file

Binary file not shown.

BIN
bin/singbox/singbox-linux-armv8 Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,6 +1,8 @@
clashnet_v=v1.7.6
clashpre_v=2022.11.25
clash_v=v1.7.1
meta_v=v1.17.0
GeoIP_v=20231230
versionsh=1.8.3c
meta_v=v1.18.0
singbox_v=1.8.4
GeoIP_v=20240127
versionsh=1.8.9d

View File

@@ -1,12 +1,14 @@
#! /bin/bash
# Copyright (C) Juewuy
[ -z "$url" ] && url="https://fastly.jsdelivr.net/gh/juewuy/ShellCrash@master"
type bash &>/dev/null && shtype=bash || shtype=sh
echo='echo -e'
[ -n "$(echo -e|grep e)" ] && {
echo "\033[31m不支持dash环境安装请先输入bash命令后再运行安装命令\033[0m"
exit
}
echo "***********************************************"
echo "** 欢迎使用 **"
echo "** ShellCrash **"
@@ -47,7 +49,7 @@ error_down(){
}
#安装及初始化
gettar(){
webget /tmp/ShellCrash.tar.gz $tarurl
webget /tmp/ShellCrash.tar.gz "$url/bin/ShellCrash.tar.gz"
if [ "$result" != "200" ];then
$echo "\033[33m文件下载失败\033[0m"
error_down
@@ -174,7 +176,7 @@ if [ ! -w $dir ];then
else
$echo "目标目录\033[32m$dir\033[0m空间剩余$(dir_avail $dir -h)"
read -p "确认安装?(1/0) > " res
[ "$res" = "1" ] && CRASHDIR=$dir/clash || setdir
[ "$res" = "1" ] && CRASHDIR=$dir/ShellCrash || setdir
fi
}
install(){
@@ -190,7 +192,25 @@ echo -----------------------------------------------
$echo "\033[33m输入\033[30;47m crash \033[0;33m命令即可管理\033[0m"
echo -----------------------------------------------
}
setversion(){
echo -----------------------------------------------
$echo "\033[33m请选择想要安装的版本\033[0m"
$echo " 1 \033[32m公测版(推荐)\033[0m"
$echo " 2 \033[36m稳定版\033[0m"
$echo " 3 \033[31m开发版\033[0m"
echo -----------------------------------------------
read -p "请输入相应数字 > " num
case "$num" in
2)
url=$(echo $url | sed 's/master/stable/')
;;
3)
url=$(echo $url | sed 's/master/dev/')
;;
*)
;;
esac
}
#特殊固件识别及标记
[ -f "/etc/storage/started_script.sh" ] && {
systype=Padavan #老毛子固件
@@ -213,36 +233,16 @@ if [ "$USER" != "root" -a -z "$systype" ];then
[ "$res" != "1" ] && exit 1
fi
#检查更新
url_cdn="https://fastly.jsdelivr.net/gh/juewuy/ShellCrash"
[ -z "$url" ] && url=$url_cdn
echo -----------------------------------------------
$echo "\033[33m请选择想要安装的版本\033[0m"
$echo " 1 \033[32mShellCrash公测版\033[0m"
$echo " 2 \033[36mShellCrash稳定版\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
if [ -n "$(echo $url | grep master)" ];then
setversion
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/ShellCrash.tar.gz
#获取版本信息
webget /tmp/version "$url/bin/version" echooff
[ "$result" = "200" ] && versionsh=$(cat /tmp/version | grep "versionsh" | awk -F "=" '{print $2}')
rm -rf /tmp/version
#输出
$echo "最新版本:\033[32m$release_new\033[0m"
$echo "最新版本:\033[32m$versionsh\033[0m"
echo -----------------------------------------------
$echo "\033[44m如遇问题请加TG群反馈\033[42;30m t.me/ShellClash \033[0m"
$echo "\033[37m支持各种基于openwrt的路由器设备"

View File

@@ -1,32 +1,30 @@
# ID&类型 说明 地址 其他说明 (类型100-稳定源;200-测试源;300-基础sub;400-meta_sub;500-规则地址)
# ID&类型 说明 地址 其他说明 (类型100-三版全通源;200-单一源;300-基础sub;400-meta_sub;500-规则地址)
101 Jsdelivr-CDN源 https://fastly.jsdelivr.net/gh/juewuy/ShellClash 稳定版
102 Github源(须clash服务启用) https://raw.githubusercontent.com/juewuy/ShellClash 稳定版
101 Jsdelivr_CDN源 https://fastly.jsdelivr.net/gh/juewuy/ShellCrash
102 Github直连源(请注意网络环境) https://raw.githubusercontent.com/juewuy/ShellCrash
103 ShellClash自建源(请勿滥用!) https://gh.jwsc.eu.org
104 Cloudflare_CDN源 https://testingcf.jsdelivr.net/gh/juewuy/ShellCrash
201 Jsdelivr-CDN源 https://fastly.jsdelivr.net/gh/juewuy/ShellClash@master 公测版
202 ShellClash自建源 https://gh.jwsc.eu.org/master 公测版
203 ShellClash-cfworkers源 https://gh.shellclash.workers.dev/https://raw.githubusercontent.com/juewuy/ShellClash 公测版
204 Github源(须clash服务启用) https://raw.githubusercontent.com/juewuy/ShellClash/master 公测版
205 (请加讨论组-https://t.me/ShellClash) http://t.jwsc.eu.org 内测版
206 wwng2333自建CN源 https://mirrors.csgo.ovh/ShellClash 公测版
201 wwng2333自建CN源(请勿滥用!) https://mirrors.csgo.ovh/ShellClash 公测版
202 http私人内测源(危险!非必要请勿使用) http://t.jwsc.eu.org 开发版
301 墙洞提供 https://api.dler.io
302 SUB作者提供 https://sub.xeton.dev
303 猫熊提供 https://sub.maoxiongnet.com
301 墙洞提供,不支持vless|hy https://api.dler.io
302 SUB作者提供,不支持vless|hy https://sub.xeton.dev
303 品云提供,不支持vless|hy https://sub.id9.cc
401 肥羊提供(有广告),支持vless|hy https://sub.d1.mk
402 品云提供,支持vless|hy https://v.id9.cc
403 作者提供,支持vless|hy https://sub.jwsc.eu.org
401 肥羊提供(有广告),支持vless|hy2 https://sub.d1.mk
402 作者提供,支持vless|hy2 https://sub.jwsc.eu.org
403 肥羊提供(有广告),支持vless|hy2 https://api.v1.mk
497 作者提供,未加密仅备用 http://sub2.jwsc.eu.org
498 本地服务器 http://127.0.0.1:25500
501 Acl4SSR全能优化版 https://github.com/juewuy/ShellClash/raw/master/rules/ShellClash.ini (推荐)
502 Acl4SSR精简优化版 https://github.com/juewuy/ShellClash/raw/master/rules/ShellClash_Mini.ini (推荐)
503 Acl4SSR全能优化+去广告增强 https://github.com/juewuy/ShellClash/raw/master/rules/ShellClash_Block.ini
504 Acl4SSR极简版 https://github.com/juewuy/ShellClash/raw/master/rules/ShellClash_Nano.ini (适合自建节点)
505 Acl4SSR分流&游戏增强 https://github.com/juewuy/ShellClash/raw/master/rules/ShellClash_Full.ini
506 Acl4SSR分流&游戏&去广告增强 https://github.com/juewuy/ShellClash/raw/master/rules/ShellClash_Full_Block.ini (低性能设备慎用)
501 Acl4SSR全能优化版 https://github.com/juewuy/ShellCrash/raw/master/rules/ShellClash.ini (推荐)
502 Acl4SSR精简优化版 https://github.com/juewuy/ShellCrash/raw/master/rules/ShellClash_Mini.ini (推荐)
503 Acl4SSR全能优化+去广告增强 https://github.com/juewuy/ShellCrash/raw/master/rules/ShellClash_Block.ini
504 Acl4SSR极简版 https://github.com/juewuy/ShellCrash/raw/master/rules/ShellClash_Nano.ini (适合自建节点)
505 Acl4SSR分流&游戏增强 https://github.com/juewuy/ShellCrash/raw/master/rules/ShellClash_Full.ini
506 Acl4SSR分流&游戏&去广告增强 https://github.com/juewuy/ShellCrash/raw/master/rules/ShellClash_Full_Block.ini (低性能设备慎用)
507 洞主规则精简版 https://gist.githubusercontent.com/tindy2013/1fa08640a9088ac8652dbd40c5d2715b/raw/lhie1_clash.ini
508 洞主规则重度完整版 https://gist.githubusercontent.com/tindy2013/1fa08640a9088ac8652dbd40c5d2715b/raw/lhie1_dler.ini
509 Acl4SSR多国精简 https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini_MultiCountry.ini

View File

@@ -3,14 +3,16 @@
101#$CRASHDIR/start.sh start#启动clash服务
102#$CRASHDIR/start.sh stop#停止clash服务
103#$CRASHDIR/start.sh restart#重启clash服务
104#$CRASHDIR/start.sh getyaml && $CRASHDIR/start.sh restart#更新订阅并重启服务
105#$CRASHDIR/start.sh updateyaml#热更新订阅
104#$CRASHDIR/start.sh update_config#更新订阅并重启服务
105#$CRASHDIR/start.sh hotupdate#热更新订阅
106#$CRASHDIR/start.sh web_save#自动保存面板配置
107#$CRASHDIR/start.sh ntp#自动同步ntp时间
107#$CRASHDIR/task/task.sh ntp#自动同步ntp时间
111#$CRASHDIR/task/task.sh update_core#自动更新内核
112#$CRASHDIR/task/task.sh update_shellclash#自动更新脚本
113#$CRASHDIR/task/task.sh update_mmdb#自动更新数据库文件
121#$CRASHDIR/task/task.sh reset_firewall#重设透明路由防火墙
122#reboot#重启路由设备(慎用)

View File

@@ -6,6 +6,7 @@ ruleset=🛑 广告拦截,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/mast
ruleset=🎥 奈飞解锁,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Netflix.list
ruleset=🎥 奈飞解锁,https://raw.githubusercontent.com/LM-Firefly/Rules/master/Global-Services/Netflix.list
ruleset=🎥 奈飞解锁,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/DisneyPlus.list
ruleset=🤖 人工智能,https://raw.githubusercontent.com/juewuy/ShellClash/master/rules/ai.list
ruleset=🚀 节点选择,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/ProxyLite.list
ruleset=🚀 节点选择,https://raw.githubusercontent.com/juewuy/ShellClash/master/rules/ai.list
ruleset=🎯 全球直连,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/ChinaDomain.list
@@ -18,6 +19,7 @@ custom_proxy_group=♻️ 自动选择`url-test`.*`http://www.gstatic.com/genera
custom_proxy_group=🔯 故障转移首选`select`.*
custom_proxy_group=🔯 故障转移`fallback`[]🔯 故障转移首选`[]👍 高级节点`[]♻️ 自动选择`http://www.gstatic.com/generate_204`180
custom_proxy_group=🛑 广告拦截`select`[]DIRECT`[]REJECT
custom_proxy_group=🤖 人工智能`select`[]🔯 故障转移`[]🔯 故障转移首选
custom_proxy_group=🎥 奈飞解锁`select`[]🎥 流媒体解锁`[]👍 高级节点`[]🔯 故障转移`[]🚀 节点选择
custom_proxy_group=🎯 全球直连`select`[]DIRECT`[]🚀 节点选择`[]♻️ 自动选择
custom_proxy_group=🐟 漏网之鱼`select`[]🔯 故障转移`[]🚀 节点选择`[]📺 省流节点`[]♻️ 自动选择`[]DIRECT

View File

@@ -1,17 +0,0 @@
[Unit]
Description=clash
After=network.target
[Service]
Type=simple
User=root
ExecStartPre=/etc/clash/start.sh bfstart
ExecStart=/etc/clash/clash -d /etc/clash >/dev/null
ExecStartPost=/etc/clash/start.sh afstart
Restart=on-failure
RestartSec=3s
LimitNOFILE=999999
[Install]
WantedBy=multi-user.target

View File

@@ -1,45 +0,0 @@
#!/bin/sh /etc/rc.common
START=99
SERVICE_DAEMONIZE=1
SERVICE_WRITE_PID=1
USE_PROCD=1
#获取目录
DIR=$(cat /etc/profile | grep CRASHDIR | awk -F "\"" '{print $2}')
[ -z "$DIR" ] && DIR=$(cat ~/.bashrc | grep CRASHDIR | awk -F "\"" '{print $2}')
BINDIR=$(cat $DIR/configs/ShellCrash.cfg | grep bindir | awk -F "=" '{print $2}')
[ -z "$BINDIR" ] && BINDIR=$DIR
start_service() {
#检测必须文件
$DIR/start.sh bfstart
if [ "$?" = "0" ];then
#使用procd创建clash后台进程
procd_open_instance
procd_set_param respawn
procd_set_param stderr 0
procd_set_param stdout 0
procd_set_param command $BINDIR/clash -d $BINDIR
procd_close_instance
#其他设置
$DIR/start.sh afstart
fi
}
start() {
if [ -z "$(pidof procd)" ];then
#检测必须文件
$DIR/start.sh bfstart
if [ "$?" = "0" ];then
#创建后台进程
service_start $BINDIR/clash -d $BINDIR
#其他设置
$DIR/start.sh afstart
#设置守护进程
$DIR/start.sh daemon
fi
else
start_service
fi
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Copyright (C) Juewuy
version=1.8.3c
version=1.8.9d
setdir(){
dir_avail(){
@@ -119,16 +119,14 @@ if [ ! -w $dir ];then
else
echo -e "目标目录\033[32m$dir\033[0m空间剩余$(dir_avail $dir -h)"
read -p "确认安装?(1/0) > " res
[ "$res" = "1" ] && CRASHDIR=$dir/clash || setdir
[ "$res" = "1" ] && CRASHDIR=$dir/ShellCrash || setdir
fi
}
setconfig(){
setconfig(){
#参数1代表变量名参数2代表变量值,参数3即文件路径
[ -z "$3" ] && configpath=$CRASHDIR/configs/ShellCrash.cfg || configpath=$3
[ -n "$(grep -E "^${1}=" $configpath)" ] && sed -i "s#^${1}=\(.*\)#${1}=${2}#g" $configpath || echo "${1}=${2}" >> $configpath
[ -z "$3" ] && configpath=${CRASHDIR}/configs/ShellCrash.cfg || configpath="${3}"
[ -n "$(grep "${1}=" "$configpath")" ] && sed -i "s#${1}=.*#${1}=${2}#g" $configpath || echo "${1}=${2}" >> $configpath
}
$CRASHDIR/start.sh stop 2>/dev/null #防止进程冲突
#特殊固件识别及标记
[ -f "/etc/storage/started_script.sh" ] && {
systype=Padavan #老毛子固件
@@ -144,41 +142,62 @@ $CRASHDIR/start.sh stop 2>/dev/null #防止进程冲突
#检查环境变量
[ -z "$CRASHDIR" -a -n "$clashdir" ] && CRASHDIR=$clashdir
[ -z "$CRASHDIR" -a -d /tmp/SC_tmp ] && {
setdir
}
[ -z "$CRASHDIR" -a -d /tmp/SC_tmp ] && setdir
#移动文件
mkdir -p $CRASHDIR
mv -f /tmp/SC_tmp/* $CRASHDIR 2>/dev/null
mkdir -p ${CRASHDIR}
mv -f /tmp/SC_tmp/* ${CRASHDIR} 2>/dev/null
#初始化
mkdir -p $CRASHDIR/configs
[ -f "$CRASHDIR/configs/ShellCrash.cfg" ] || echo '#ShellCrash配置文件不明勿动' > $CRASHDIR/configs/ShellCrash.cfg
#本地安装跳过新手引导
#[ -z "$url" ] && setconfig userguide 1
mkdir -p ${CRASHDIR}/configs
[ -f "${CRASHDIR}/configs/ShellCrash.cfg" ] || echo '#ShellCrash配置文件不明勿动' > ${CRASHDIR}/configs/ShellCrash.cfg
#判断系统类型写入不同的启动文件
if [ -f /etc/rc.common ];then
if [ -f /etc/rc.common -a "$(cat /proc/1/comm)" = "procd" ];then
#设为init.d方式启动
cp -f $CRASHDIR/clashservice /etc/init.d/clash
chmod 755 /etc/init.d/clash
cp -f ${CRASHDIR}/shellcrash.procd /etc/init.d/shellcrash
chmod 755 /etc/init.d/shellcrash
else
[ -w /etc/systemd/system ] && sysdir=/etc/systemd/system
[ -w /usr/lib/systemd/system ] && sysdir=/usr/lib/systemd/system
if [ -n "$sysdir" -a -z "$WSL_DISTRO_NAME" ];then #wsl环境不使用systemd
#设为systemd方式启动
mv -f $CRASHDIR/clash.service $sysdir/clash.service 2>/dev/null
sed -i "s%/etc/clash%$CRASHDIR%g" $sysdir/clash.service
[ -w /etc/systemd/system ] && sysdir=/etc/systemd/system
if [ -n "$sysdir" -a "$USER" = "root" -a "$(cat /proc/1/comm)" = "systemd" ];then
#创建shellcrash用户
sed -i '/0:7890/d' /etc/passwd
sed -i '/x:7890/d' /etc/group
if type useradd &>/dev/null; then
useradd shellcrash -u 7890
sed -Ei s/7890:7890/0:7890/g /etc/passwd
else
echo "shellcrash:x:0:7890::/home/shellcrash:/bin/sh" >> /etc/passwd
fi
#配置systemd
mv -f ${CRASHDIR}/shellcrash.service $sysdir/shellcrash.service 2>/dev/null
sed -i "s%/etc/ShellCrash%$CRASHDIR%g" $sysdir/shellcrash.service
rm -rf $sysdir/clash.service #旧版文件清理
systemctl daemon-reload
else
fi
#设为保守模式启动
setconfig start_old 已开启
fi
fi
#修饰文件及版本号
type bash &>/dev/null && shtype=bash || shtype=sh
sed -i "s|/bin/sh|/bin/$shtype|" $CRASHDIR/start.sh
chmod 755 $CRASHDIR/start.sh
command -v bash &>/dev/null && shtype=bash || shtype=sh
for file in start.sh task.sh ;do
sed -i "s|/bin/sh|/bin/$shtype|" ${CRASHDIR}/${file}
chmod 755 ${CRASHDIR}/${file}
done
setconfig versionsh_l $version
#生成用于执行systemd及procd服务的变量文件
[ ! -f ${CRASHDIR}/configs/command.env ] && {
TMPDIR='/tmp/ShellCrash'
BINDIR=${CRASHDIR}
touch ${CRASHDIR}/configs/command.env
setconfig TMPDIR ${TMPDIR} ${CRASHDIR}/configs/command.env
setconfig BINDIR ${BINDIR} ${CRASHDIR}/configs/command.env
}
if [ -x ${CRASHDIR}/CrashCore ] && [ -n "$(grep 'crashcore=singbox' ${CRASHDIR}/configs/ShellCrash.cfg)" ];then
COMMAND='"$BINDIR/CrashCore run -D $BINDIR -C $TMPDIR/jsons"'
else
COMMAND='"$BINDIR/CrashCore -d $BINDIR -f $TMPDIR/config.yaml"'
fi
setconfig COMMAND "$COMMAND" ${CRASHDIR}/configs/command.env
#设置更新地址
[ -n "$url" ] && setconfig update_url $url
#设置环境变量
@@ -188,13 +207,20 @@ setconfig versionsh_l $version
[ -w /etc/profile ] && profile=/etc/profile
if [ -n "$profile" ];then
sed -i '/alias crash=*/'d $profile
echo "alias crash=\"$shtype $CRASHDIR/clash.sh\"" >> $profile #设置快捷命令环境变量
echo "alias crash=\"$shtype $CRASHDIR/menu.sh\"" >> $profile #设置快捷命令环境变量
sed -i '/alias clash=*/'d $profile
echo "alias clash=\"$shtype $CRASHDIR/menu.sh\"" >> $profile #设置快捷命令环境变量
sed -i '/export CRASHDIR=*/'d $profile
echo "export CRASHDIR=\"$CRASHDIR\"" >> $profile #设置clash路径环境变量
echo "export CRASHDIR=\"$CRASHDIR\"" >> $profile #设置路径环境变量
source $profile &>/dev/null || echo 运行错误请使用bash而不是dash运行安装命令
#适配zsh环境变量
[ -n "$(ls -l /bin/sh|grep -oE 'zsh')" ] && [ -z "$(cat ~/.zshrc 2>/dev/null|grep CRASHDIR)" ] && {
echo "alias crash=\"$shtype $CRASHDIR/clash.sh\"" >> ~/.zshrc
[ -n "$(cat /etc/shells 2>/dev/null|grep -oE 'zsh')" ] && [ -z "$(cat ~/.zshrc 2>/dev/null|grep CRASHDIR)" ] && {
sed -i '/alias crash=*/'d ~/.zshrc
echo "alias crash=\"$shtype $CRASHDIR/menu.sh\"" >> ~/.zshrc
# 兼容 clash 命令
sed -i '/alias clash=*/'d ~/.zshrc
echo "alias clash=\"$shtype $CRASHDIR/menu.sh\"" >> ~/.zshrc
sed -i '/export CRASHDIR=*/'d ~/.zshrc
echo "export CRASHDIR=\"$CRASHDIR\"" >> ~/.zshrc
source ~/.zshrc &>/dev/null
}
@@ -212,7 +238,7 @@ fi
}
#镜像化OpenWrt(snapshot)额外设置
if [ "$systype" = "mi_snapshot" -o "$systype" = "ng_snapshot" ];then
chmod 755 $CRASHDIR/misnap_init.sh
chmod 755 ${CRASHDIR}/misnap_init.sh
uci delete firewall.ShellClash 2>/dev/null
uci delete firewall.ShellCrash 2>/dev/null
uci set firewall.ShellCrash=include
@@ -222,44 +248,54 @@ if [ "$systype" = "mi_snapshot" -o "$systype" = "ng_snapshot" ];then
uci commit firewall
setconfig systype $systype
else
rm -rf $CRASHDIR/misnap_init.sh
rm -rf ${CRASHDIR}/misnap_init.sh
fi
#华硕USB启动额外设置
[ "$usb_status" = "1" ] && {
echo "$CRASHDIR/start.sh init #ShellCrash初始化脚本" > $CRASHDIR/asus_usb_mount.sh
echo "$CRASHDIR/start.sh init #ShellCrash初始化脚本" > ${CRASHDIR}/asus_usb_mount.sh
nvram set script_usbmount="$CRASHDIR/asus_usb_mount.sh"
nvram commit
}
#删除临时文件
rm -rf /tmp/*lash*gz
rm -rf /tmp/*rash*gz
rm -rf /tmp/SC_tmp
#转换&清理旧版本文件
mkdir -p $CRASHDIR/yamls
mkdir -p $CRASHDIR/tools
mkdir -p $CRASHDIR/task
mkdir -p ${CRASHDIR}/yamls
mkdir -p ${CRASHDIR}/jsons
mkdir -p ${CRASHDIR}/tools
mkdir -p ${CRASHDIR}/task
for file in config.yaml.bak user.yaml proxies.yaml proxy-groups.yaml rules.yaml others.yaml ;do
mv -f $CRASHDIR/$file $CRASHDIR/yamls/$file 2>/dev/null
mv -f ${CRASHDIR}/$file ${CRASHDIR}/yamls/$file 2>/dev/null
done
[ ! -L $CRASHDIR/config.yaml ] && mv -f $CRASHDIR/config.yaml $CRASHDIR/yamls/config.yaml 2>/dev/null
[ ! -L ${CRASHDIR}/config.yaml ] && mv -f ${CRASHDIR}/config.yaml ${CRASHDIR}/yamls/config.yaml 2>/dev/null
for file in fake_ip_filter mac web_save servers.list fake_ip_filter.list fallback_filter.list;do
mv -f $CRASHDIR/$file $CRASHDIR/configs/$file 2>/dev/null
mv -f ${CRASHDIR}/$file ${CRASHDIR}/configs/$file 2>/dev/null
done
#配置文件改名
mv -f $CRASHDIR/mark $CRASHDIR/configs/ShellCrash.cfg 2>/dev/null
mv -f $CRASHDIR/configs/ShellClash.cfg $CRASHDIR/configs/ShellCrash.cfg 2>/dev/null
mv -f ${CRASHDIR}/mark ${CRASHDIR}/configs/ShellCrash.cfg 2>/dev/null
mv -f ${CRASHDIR}/configs/ShellClash.cfg ${CRASHDIR}/configs/ShellCrash.cfg 2>/dev/null
#内核改名
mv -f ${CRASHDIR}/clash ${CRASHDIR}/CrashCore 2>/dev/null
for file in dropbear_rsa_host_key authorized_keys tun.ko ShellDDNS.sh;do
mv -f $CRASHDIR/$file $CRASHDIR/tools/$file 2>/dev/null
mv -f ${CRASHDIR}/$file ${CRASHDIR}/tools/$file 2>/dev/null
done
for file in cron task.sh task.list;do
mv -f $CRASHDIR/$file $CRASHDIR/task/$file 2>/dev/null
mv -f ${CRASHDIR}/$file ${CRASHDIR}/task/$file 2>/dev/null
done
chmod 755 $CRASHDIR/task/task.sh
for file in log clash.service mark? mark.bak;do
rm -rf $CRASHDIR/$file
chmod 755 ${CRASHDIR}/task/task.sh
#旧版文件清理
userdel shellclash &>/dev/null
sed -i '/shellclash/d' /etc/passwd
sed -i '/shellclash/d' /etc/group
rm -rf /etc/init.d/clash
[ "$systype" = "mi_snapshot" -a "$CRASHDIR" != '/data/clash' ] && rm -rf /data/clash
for file in clash.sh shellcrash.rc core.new clashservice log shellcrash.service mark? mark.bak;do
rm -rf ${CRASHDIR}/$file
done
#旧版任务清理
$CRASHDIR/start.sh cronset "clash服务" 2>/dev/null
$CRASHDIR/start.sh cronset "订阅链接" 2>/dev/null
$CRASHDIR/start.sh cronset "ShellCrash初始化" 2>/dev/null
sleep 1
#旧版变量改名
sed -i "s/clashcore/crashcore/g" $configpath
sed -i "s/clash_v/core_v/g" $configpath
sed -i "s/clash.meta/meta/g" $configpath
sed -i "s/ShellClash/ShellCrash/g" $configpath
echo -e "\033[32m脚本初始化完成,请输入\033[30;47m crash \033[0;33m命令开始使用\033[0m"

File diff suppressed because it is too large Load Diff

View File

@@ -51,14 +51,16 @@ init(){
done
#初始化环境变量
sed -i "/alias crash/d" $profile
sed -i "/alias clash/d" $profile
sed -i "/export CRASHDIR/d" $profile
echo "alias crash=\"$CRASHDIR/clash.sh\"" >>$profile
echo "alias crash=\"sh $CRASHDIR/menu.sh\"" >>$profile
echo "alias clash=\"sh $CRASHDIR/menu.sh\"" >>$profile
echo "export CRASHDIR=\"$CRASHDIR\"" >>$profile
#软固化功能
autoSSH
#设置init.d服务
cp -f $CRASHDIR/clashservice /etc/init.d/clash
chmod 755 /etc/init.d/clash
cp -f $CRASHDIR/shellcrash.procd /etc/init.d/shellcrash
chmod 755 /etc/init.d/shellcrash
#启动服务
if [ ! -f $CRASHDIR/.dis_startup ]; then
#AX6S/AX6000修复tun功能
@@ -66,8 +68,8 @@ init(){
#小米7000/小米万兆修复tproxy
[ -f /etc/init.d/qca-nss-ecm ] && [ -n "$(grep 'redir_mod=Tproxy' $CRASHDIR/configs/ShellCrash.cfg )" ] && tproxyfix
#启动服务
/etc/init.d/clash start
/etc/init.d/clash enable
/etc/init.d/shellcrash start
/etc/init.d/shellcrash enable
fi
}
@@ -76,7 +78,7 @@ case "$1" in
tproxyfix) tproxyfix ;;
init) init ;;
*)
if [ -z $(pidof clash) ];then
if [ -z $(pidof CrashCore) ];then
init &
fi
;;

35
scripts/shellcrash.procd Normal file
View File

@@ -0,0 +1,35 @@
#!/bin/sh /etc/rc.common
START=99
SERVICE_DAEMONIZE=1
SERVICE_WRITE_PID=1
USE_PROCD=1
#获取目录
CRASHDIR=$(cat /etc/profile | grep CRASHDIR | awk -F "\"" '{print $2}')
[ -z "$CRASHDIR" ] && CRASHDIR=$(cat ~/.bashrc | grep CRASHDIR | awk -F "\"" '{print $2}')
source ${CRASHDIR}/configs/command.env #加载启动命令和启动目录
start_service() {
#检测必须文件
$CRASHDIR/start.sh bfstart
#本机代理用户
[ -n "$(grep -E 'local_type.*增强模式' ${CRASHDIR}/configs/ShellCrash.cfg)" ] && USER=shellcrash || USER=root
if [ "$?" = "0" ];then
#使用procd创建clash后台进程
procd_open_instance
procd_set_param user $USER
procd_set_param respawn
procd_set_param command $COMMAND
procd_set_param stderr 0
procd_set_param stdout 0
procd_close_instance
#启动结束执行
$CRASHDIR/start.sh afstart
fi
}
stop_service(){
procd_close_instance
$CRASHDIR/start.sh stop_firewall
$CRASHDIR/start.sh unset_proxy
}

View File

@@ -0,0 +1,17 @@
[Unit]
Description=ShellCrash Core
After=network.target
[Service]
Type=simple
User=shellcrash
ExecStart=/etc/ShellCrash/CrashCore run -D /etc/ShellCrash -C /tmp/ShellCrash/jsons
ExecStartPost=/etc/ShellCrash/start.sh afstart >/dev/null &
ExecStopPost=/etc/ShellCrash/start.sh stop_firewall ; /etc/ShellCrash/start.sh unset_proxy
Restart=on-abnormal
RestartSec=10s
LimitNOFILE=infinity
[Install]
WantedBy=multi-user.target

File diff suppressed because it is too large Load Diff

View File

@@ -2,80 +2,86 @@
# Copyright (C) Juewuy
#加载全局变量
[ -d "/etc/storage/clash" ] && CRASHDIR=/etc/storage/clash
[ -d "/jffs/clash" ] && CRASHDIR=/jffs/clash
[ -z "$CRASHDIR" ] && CRASHDIR=$(cat /etc/profile | grep CRASHDIR | awk -F "\"" '{print $2}')
[ -z "$CRASHDIR" ] && CRASHDIR=$(cat ~/.bashrc | grep CRASHDIR | awk -F "\"" '{print $2}')
[ -z "$bindir" ] && bindir=$CRASHDIR
CFG_PATH=$CRASHDIR/configs/ShellCrash.cfg
TMPDIR=/tmp/ShellCrash && [ ! -f $TMPDIR ] && mkdir -p $TMPDIR
[ -z "$CRASHDIR" ] && CRASHDIR=$(cd "$(dirname "$(dirname "$0")")"; pwd)
[ -z "$BINDIR" ] && BINDIR=${CRASHDIR}
CFG_PATH=${CRASHDIR}/configs/ShellCrash.cfg
TMPDIR=/tmp/ShellCrash && [ ! -f ${TMPDIR} ] && mkdir -p ${TMPDIR}
source $CFG_PATH &> /dev/null
setconfig(){
#参数1代表变量名参数2代表变量值,参数3即文件路径
[ -z "$3" ] && configpath=$CFG_PATH || configpath=$3
[ -n "$(grep ${1} $configpath)" ] && sed -i "s#${1}=.*#${1}=${2}#g" $configpath || echo "${1}=${2}" >> $configpath
}
ckcmd(){ #检查命令是否存在
command -v sh &>/dev/null && command -v $1 &>/dev/null || type $1 &>/dev/null
}
#任务命令
check_update(){ #检查更新工具
$CRASHDIR/start.sh webget $TMPDIR/clashversion "$update_url/bin/version" echooff
[ "$?" = "0" ] && source $TMPDIR/clashversion 2>/dev/null
rm -rf $TMPDIR/clashversion
${CRASHDIR}/start.sh get_bin ${TMPDIR}/crashversion "bin/version" echooff
[ "$?" = "0" ] && source ${TMPDIR}/crashversion 2>/dev/null
rm -rf ${TMPDIR}/crashversion
}
update_core(){ #自动更新内核
#检查版本
check_update
clash_v_new=$(eval echo \$${clashcore}_v)
clash_v_now=$($bindir/clash -v 2>/dev/null | head -n 1 | sed 's/ linux.*//;s/.* //')
if [ -z "$clash_v_new" -o "$clash_v_new" = "clash_v_now" ];then
crash_v_new=$(eval echo \$${crashcore}_v)
if [ -z "$crash_v_new" -o "$crash_v_new" = "core_v" ];then
logger "任务【自动更新内核】中止-未检测到版本更新"
exit 1
else
#更新内核
$CRASHDIR/start.sh webget $TMPDIR/clash.new "$update_url/bin/$clashcore/clash-linux-$cpucore"
[ "$crashcore" = singbox ] && core_new=singbox || core_new=clash
${CRASHDIR}/start.sh get_bin ${TMPDIR}/core.new "bin/${crashcore}/${core_new}-linux-${cpucore}"
if [ "$?" != "0" ];then
logger "任务【自动更新内核】出错-下载失败!"
rm -rf $TMPDIR/clash.new
rm -rf ${TMPDIR}/core.new
return 1
else
chmod +x $TMPDIR/clash.new
$CRASHDIR/start.sh stop
clashv=$($TMPDIR/clash.new -v 2>/dev/null | sed 's/ linux.*//;s/.* //')
if [ -z "$clashv" ];then
logger "任务【自动更新内核】出错-下载失败!"
rm -rf $TMPDIR/clash.new
[ $clashcore = meta ] && $CRASHDIR/start.sh start
chmod +x ${TMPDIR}/core.new
${CRASHDIR}/start.sh stop
if [ "$crashcore" = singbox ];then
core_v=$(${TMPDIR}/core.new version 2>/dev/null | grep version | awk '{print $3}')
else
core_v=$(${TMPDIR}/core.new -v 2>/dev/null | sed 's/ linux.*//;s/.* //')
fi
if [ -z "$core_v" ];then
logger "任务【自动更新内核】出错-内核校验失败!"
rm -rf ${TMPDIR}/core.new
${CRASHDIR}/start.sh start
return 1
else
mv -f $TMPDIR/clash.new $bindir/clash
mv -f ${TMPDIR}/core.new ${BINDIR}/CrashCore
logger "任务【自动更新内核】下载完成,正在重启服务!"
$CRASHDIR/start.sh start
setconfig core_v $core_v
${CRASHDIR}/start.sh start
return 0
fi
fi
fi
}
update_shellclash(){ #自动更新脚本
update_shellcrash(){ #自动更新脚本
#检查版本
check_update
if [ -z "$versionsh" -o "$versionsh" = "versionsh_l" ];then
logger "任务【自动更新脚本】中止-未检测到版本更新"
exit 1
else
$CRASHDIR/start.sh webget $TMPDIR/clashfm.tar.gz "$update_url/bin/clashfm.tar.gz"
${CRASHDIR}/start.sh get_bin ${TMPDIR}/update.tar.gz "bin/update.tar.gz"
if [ "$?" != "0" ];then
rm -rf $TMPDIR/clashfm.tar.gz
rm -rf ${TMPDIR}/update.tar.gz
logger "任务【自动更新内核】出错-下载失败!"
return 1
else
#解压
tar -zxvf "$TMPDIR/clashfm.tar.gz" -C $CRASHDIR/ || tar -zxvf "$TMPDIR/clashfm.tar.gz" --no-same-owner -C $CRASHDIR/
tar -zxvf "${TMPDIR}/update.tar.gz" -C ${CRASHDIR}/ || tar -zxvf "${TMPDIR}/update.tar.gz" --no-same-owner -C ${CRASHDIR}/
if [ $? -ne 0 ];then
rm -rf $TMPDIR/clashfm.tar.gz
rm -rf ${TMPDIR}/update.tar.gz
logger "任务【自动更新内核】出错-解压失败!"
return 1
else
source $CRASHDIR/init.sh >/dev/null
source ${CRASHDIR}/init.sh >/dev/null
return 0
fi
fi
@@ -92,13 +98,13 @@ update_mmdb(){ #自动更新数据库
logger "任务【自动更新数据库文件】跳过-未检测到$2版本更新"
else
#更新文件
$CRASHDIR/start.sh webget $TMPDIR/$1 "$update_url/bin/geodata/$2"
${CRASHDIR}/start.sh get_bin ${TMPDIR}/$1 "bin/geodata/$2"
if [ "$?" != "0" ];then
logger "任务【自动更新数据库文件】更新【$2】下载失败!"
rm -rf $TMPDIR/$1
rm -rf ${TMPDIR}/$1
return 1
else
mv -f $TMPDIR/$1 $bindir/$1
mv -f ${TMPDIR}/$1 ${BINDIR}/$1
setconfig $geo_v $GeoIP_v
logger "任务【自动更新数据库文件】更新【$2】成功!"
return 0
@@ -110,10 +116,15 @@ update_mmdb(){ #自动更新数据库
[ -n "${china_ip_list_v}" ] && getgeo cn_ip.txt china_ip_list.txt
[ -n "${china_ipv6_list_v}" ] && getgeo cn_ipv6.txt china_ipv6_list.txt
[ -n "${geosite_v}" ] && getgeo GeoSite.dat geosite.dat
[ -n "${geoip_cn_v}" ] && getgeo geoip.db geoip_cn.db
[ -n "${geosite_cn_v}" ] && getgeo geosite.db geosite_cn.db
}
reset_firewall(){ #重设透明路由防火墙
$CRASHDIR/start.sh stop_firewall
$CRASHDIR/start.sh afstart
${CRASHDIR}/start.sh stop_firewall
${CRASHDIR}/start.sh afstart
}
ntp(){
[ "$crashcore" != singbox ] && ckcmd ntpd && ntpd -n -q -p 203.107.6.88 &>/dev/null || exit 0 &
}
#任务工具
@@ -121,7 +132,7 @@ logger(){
[ "$task_push" = 1 ] && push= || push=off
[ -n "$2" -a "$2" != 0 ] && echo -e "\033[$2m$1\033[0m"
[ "$3" = 'off' ] && push=off
$CRASHDIR/start.sh logger $1 0 $push
${CRASHDIR}/start.sh logger $1 0 $push
}
croncmd(){
if [ -n "$(crontab -h 2>&1 | grep '\-l')" ];then
@@ -131,21 +142,24 @@ croncmd(){
[ ! -w "$crondir" ] && crondir="/etc/storage/cron/crontabs"
[ ! -w "$crondir" ] && crondir="/var/spool/cron/crontabs"
[ ! -w "$crondir" ] && crondir="/var/spool/cron"
[ ! -w "$crondir" ] && echo "你的设备不支持定时任务配置,脚本大量功能无法启用,请前往 https://t.me/ShellCrash 申请适配!"
[ "$1" = "-l" ] && cat $crondir/$USER 2>/dev/null
[ -f "$1" ] && cat $1 > $crondir/$USER
if [ -w "$crondir" ];then
[ "$1" = "-l" ] && cat $crondir/$USER 2>/dev/null
[ -f "$1" ] && cat $1 > $crondir/$USER
else
echo "你的设备不支持定时任务配置,脚本大量功能无法启用,请尝试使用搜索引擎查找安装方式!"
fi
fi
}
cronset(){
# 参数1代表要移除的关键字,参数2代表要添加的任务语句
tmpcron=$TMPDIR/cron_$USER
croncmd -l > $tmpcron
tmpcron=${TMPDIR}/cron_$USER
croncmd -l > $tmpcron 2>/dev/null
sed -i "/$1/d" $tmpcron
sed -i '/^$/d' $tmpcron
echo "$2" >> $tmpcron
croncmd $tmpcron
#华硕/Padavan固件存档在本地,其他则删除
[ "$CRASHDIR" = "/jffs/clash" -o "$CRASHDIR" = "/etc/storage/clash" ] && mv -f $tmpcron $CRASHDIR/task/cron || rm -f $tmpcron
[ -d /jffs -o -d /etc/storage/clash -o -d /etc/storage/ShellCrash ] && mv -f $tmpcron ${CRASHDIR}/task/cron || rm -f $tmpcron
}
set_cron(){
[ -z $week ] && week=*
@@ -157,20 +171,20 @@ set_cron(){
if [ "$res" = '1' ]; then
task_txt="$min $hour * * $week $CRASHDIR/task/task.sh $task_id $cron_time$task_name"
cronset "$cron_time$task_name" "$task_txt"
echo -e "任务【$cron_time$task_name】\033[32m已添加\033[0m"
fi
unset week hour min
echo -e "任务【$cron_time$task_name】\033[32m添加成功\033[0m"
sleep 1
}
set_service(){
# 参数1代表要任务类型,参数2代表任务ID,参数3代表任务描述,参数4代表running任务cron时间
task_file=$CRASHDIR/task/$1
task_file=${CRASHDIR}/task/$1
[ -s $task_file ] && sed -i "/$3/d" $task_file
#运行时每分钟执行的任务特殊处理
if [ "$1" = "running" ];then
task_txt="$4 $CRASHDIR/task/task.sh $2 $3"
echo "$task_txt" >> $task_file
[ -n "$(pidof clash)" ] && cronset "$3" "$task_txt"
[ -n "$(pidof CrashCore)" ] && cronset "$3" "$task_txt"
else
echo "$CRASHDIR/task/task.sh $2 $3" >> $task_file
fi
@@ -181,18 +195,18 @@ set_service(){
task_user_add(){ #自定义命令添加
echo -----------------------------------------------
echo -e "\033[33m命令可包含空格请确保命令可执行\033[0m"
echo -e "也可以手动编辑\033[32m$CRASHDIR/task/task.user\033[0m添加"
echo -e "也可以手动编辑\033[32m${CRASHDIR}/task/task.user\033[0m添加"
read -p "请输入命令语句 > " script
if [ -n "$script" ];then
task_command=$script
echo -e "请检查输入:\033[32m$task_command\033[0m"
#获取本任务ID
task_max_id=$(awk -F'#' '{print $1}' $CRASHDIR/task/task.user | sort -n | tail -n 1)
task_max_id=$(awk -F '#' '{print $1}' ${CRASHDIR}/task/task.user 2>/dev/null | sort -n | tail -n 1)
[ -z "$task_max_id" ] && task_max_id=200
task_id=$((task_max_id + 1))
read -p "请输入任务备注 > " txt
[ -n "$txt" ] && task_name=$txt || task_name=自定义任务$task_id
echo "$task_id#$task_command#$task_name" >> $CRASHDIR/task/task.user
echo "$task_id#$task_command#$task_name" >> ${CRASHDIR}/task/task.user
echo -e "\033[32m自定义任务已添加\033[0m"
sleep 1
else
@@ -203,15 +217,15 @@ task_user_add(){ #自定义命令添加
task_user_del(){ #自定义命令删除
echo -----------------------------------------------
echo -e "请输入对应ID移除对应自定义任务(不会影响内置任务)"
echo -e "也可以手动编辑\033[32m$CRASHDIR/task/task.user\033[0m"
echo -e "也可以手动编辑\033[32m${CRASHDIR}/task/task.user\033[0m"
echo -----------------------------------------------
cat $CRASHDIR/task/task.user 2>/dev/null | grep -Ev '^#' | awk -F '#' '{print $1" "$3}'
cat ${CRASHDIR}/task/task.user 2>/dev/null | grep -Ev '^#' | awk -F '#' '{print $1" "$3}'
echo -----------------------------------------------
echo 0 返回上级菜单
echo -----------------------------------------------
read -p "请输入对应数字 > " num
if [ -n "$num" ];then
sed -i "/^$num#/d" $CRASHDIR/task/task.user 2>/dev/null
sed -i "/^$num#/d" ${CRASHDIR}/task/task.user 2>/dev/null
[ "$num" != 0 ] && task_user_del
else
echo -e "\033[31m输入错误请重新输入\033[0m"
@@ -222,10 +236,8 @@ task_add(){ #任务添加
echo -----------------------------------------------
echo -e "\033[36m请选择需要添加的任务\033[0m"
echo -----------------------------------------------
#检测并创建自定义任务文件
[ -f $CRASHDIR/task/task.user ] || echo '#任务ID(必须>200并顺序排列)#任务命令#任务说明(#号隔开,任务命令和说明中都不允许包含#号)' > $CRASHDIR/task/task.user
#输出任务列表
cat $CRASHDIR/task/task.list $CRASHDIR/task/task.user 2>/dev/null | grep -Ev '^(#|$)' | awk -F '#' '{print " "NR" "$3}'
cat ${CRASHDIR}/task/task.list ${CRASHDIR}/task/task.user 2>/dev/null | grep -Ev '^(#|$)' | awk -F '#' '{print " "NR" "$3}'
echo -----------------------------------------------
echo -e " 0 返回上级菜单"
read -p "请输入对应数字 > " num
@@ -233,9 +245,9 @@ task_add(){ #任务添加
0)
;;
[1-9]|[1-9][0-9])
if [ "$num" -le "$(cat $CRASHDIR/task/task.list $CRASHDIR/task/task.user 2>/dev/null | wc -l)" ];then
task_id=$(cat $CRASHDIR/task/task.list $CRASHDIR/task/task.user 2>/dev/null | grep -Ev '^(#|$)' | sed -n "$num p" | awk -F '#' '{print $1}')
task_name=$(cat $CRASHDIR/task/task.list $CRASHDIR/task/task.user 2>/dev/null | grep -Ev '^(#|$)' | sed -n "$num p" | awk -F '#' '{print $3}')
if [ "$num" -le "$(cat ${CRASHDIR}/task/task.list ${CRASHDIR}/task/task.user 2>/dev/null | wc -l)" ];then
task_id=$(cat ${CRASHDIR}/task/task.list ${CRASHDIR}/task/task.user 2>/dev/null | grep -Ev '^(#|$)' | sed -n "$num p" | awk -F '#' '{print $1}')
task_name=$(cat ${CRASHDIR}/task/task.list ${CRASHDIR}/task/task.user 2>/dev/null | grep -Ev '^(#|$)' | sed -n "$num p" | awk -F '#' '{print $3}')
task_type
else
errornum
@@ -248,14 +260,14 @@ task_add(){ #任务添加
}
task_del(){ #任务删除
#删除定时任务
croncmd -l > $TMPDIR/cron && sed -i "/$1/d" $TMPDIR/cron && croncmd $TMPDIR/cron
rm -f $TMPDIR/cron
croncmd -l > ${TMPDIR}/cron && sed -i "/$1/d" ${TMPDIR}/cron && croncmd ${TMPDIR}/cron
rm -f ${TMPDIR}/cron
#删除条件任务
sed -i "/$1/d" $CRASHDIR/task/cron 2>/dev/null
sed -i "/$1/d" $CRASHDIR/task/bfstart 2>/dev/null
sed -i "/$1/d" $CRASHDIR/task/afstart 2>/dev/null
sed -i "/$1/d" $CRASHDIR/task/running 2>/dev/null
sed -i "/$1/d" $CRASHDIR/task/affirewall 2>/dev/null
sed -i "/$1/d" ${CRASHDIR}/task/cron 2>/dev/null
sed -i "/$1/d" ${CRASHDIR}/task/bfstart 2>/dev/null
sed -i "/$1/d" ${CRASHDIR}/task/afstart 2>/dev/null
sed -i "/$1/d" ${CRASHDIR}/task/running 2>/dev/null
sed -i "/$1/d" ${CRASHDIR}/task/affirewall 2>/dev/null
}
task_type(){ #任务条件选择菜单
echo -----------------------------------------------
@@ -294,7 +306,7 @@ task_type(){ #任务条件选择菜单
echo -e " 输入 6-18 代表\033[36m早6点至晚18点间每小时\033[0m运行"
read -p "想在每日的具体哪个小时执行0-23 > " hour
echo -----------------------------------------------
read -p "想在具体哪分钟执行?(1-59的整数 > " min
read -p "想在具体哪分钟执行?(0-59的整数 > " min
cron_time="在每日的$hour点$min分"
set_cron
;;
@@ -348,25 +360,32 @@ task_type(){ #任务条件选择菜单
task_manager(){ #任务管理列表
echo -----------------------------------------------
#抽取并生成临时列表
croncmd -l > $TMPDIR/task_cronlist
cat $TMPDIR/task_cronlist $CRASHDIR/task/running 2>/dev/null | sort -u | grep -oE "task/task.sh .*" | awk -F ' ' '{print $2" "$3}' > $TMPDIR/task_list
cat $CRASHDIR/task/bfstart $CRASHDIR/task/afstart $CRASHDIR/task/affirewall 2>/dev/null | awk -F ' ' '{print $2" "$3}' >> $TMPDIR/task_list
rm -rf $TMPDIR/task_cronlist
croncmd -l > ${TMPDIR}/task_cronlist
cat ${TMPDIR}/task_cronlist ${CRASHDIR}/task/running 2>/dev/null | sort -u | grep -oE "task/task.sh .*" | awk -F ' ' '{print $2" "$3}' > ${TMPDIR}/task_list
cat ${CRASHDIR}/task/bfstart ${CRASHDIR}/task/afstart ${CRASHDIR}/task/affirewall 2>/dev/null | awk -F ' ' '{print $2" "$3}' >> ${TMPDIR}/task_list
cat ${TMPDIR}/task_cronlist 2>/dev/null | sort -u | grep -oE " #.*" | grep -v "守护" | awk -F '#' '{print "0 旧版任务-"$2}' >> ${TMPDIR}/task_list
rm -rf ${TMPDIR}/task_cronlist
#判断为空则返回
if [ ! -s $TMPDIR/task_list ];then
if [ ! -s ${TMPDIR}/task_list ];then
echo -e "\033[31m当前没有可供管理的任务\033[36m"
sleep 1
else
echo -e "\033[33m已添加的任务:\033[0m"
echo -----------------------------------------------
cat $TMPDIR/task_list | awk '{print " " NR " " $2}'
cat ${TMPDIR}/task_list | awk '{print " " NR " " $2}'
echo -----------------------------------------------
echo -e " d 清空任务列表"
echo -e " a 清空旧版任务"
echo -e " d 清空任务列表"
echo -e " 0 返回上级菜单"
read -p "请输入对应数字 > " num
case "$num" in
0)
;;
a)
task_del "#"
echo -e "\033[31m旧版任务已清空\033[36m"
sleep 1
;;
d)
task_del "task.sh"
echo -e "\033[31m全部任务已清空\033[36m"
@@ -374,48 +393,57 @@ task_manager(){ #任务管理列表
;;
[1-9]|[1-9][0-9])
task_txt=$(sed -n "$num p" $TMPDIR/task_list)
task_txt=$(sed -n "$num p" ${TMPDIR}/task_list)
task_id=$(echo $task_txt | awk '{print $1}')
task_des=$(echo $task_txt | awk '{print $2}')
task_name=$(cat $CRASHDIR/task/task.list $CRASHDIR/task/task.user 2>/dev/null | grep "$task_id" | awk -F '#' '{print $3}')
echo -----------------------------------------------
echo -e "当前任务为:\033[36m $task_des\033[0m"
echo -e " 1 \033[33m修改\033[0m当前任务"
echo -e " 2 \033[31m删除\033[0m当前任务"
echo -e " 3 \033[32m立即执行\033[0m一次"
echo -e " 4 查看\033[33m执行记录\033[0m"
echo -----------------------------------------------
echo -e " 0 返回上级菜单"
read -p "请选择需要执行的操作 > " num
case "$num" in
0)
;;
1)
task_type && task_del $task_des
;;
2)
task_del $task_des
;;
3)
task_command=$(cat $CRASHDIR/task/task.list $CRASHDIR/task/task.user 2>/dev/null | grep "$task_id" | awk -F '#' '{print $2}')
eval $task_command && task_res='执行成功!' || task_res='执行失败!'
logger "任务【$task_des$task_res" 33 off
sleep 1
;;
4)
if [ "$task_id" = 0 ];then
read -p "旧版任务不支持管理,是否移除?(1/0) > " res
[ "$res" = 1 ] && {
cronname=$(echo $task_txt | awk -F '-' '{print $2}')
croncmd -l > $TMPDIR/conf && sed -i "/$cronname/d" $TMPDIR/conf && croncmd $TMPDIR/conf
sed -i "/$cronname/d" $clashdir/tools/cron 2>/dev/null
rm -f $TMPDIR/conf
}
else
task_des=$(echo $task_txt | awk '{print $2}')
task_name=$(cat ${CRASHDIR}/task/task.list ${CRASHDIR}/task/task.user 2>/dev/null | grep "$task_id" | awk -F '#' '{print $3}')
echo -----------------------------------------------
if [ -n "$(cat $TMPDIR/ShellCrash.log | grep "$task_name")" ];then
cat $TMPDIR/ShellCrash.log | grep "$task_name"
else
echo -e "\033[31m未找到相关执行记录\033[0m"
fi
sleep 1
;;
*)
errornum
;;
esac
echo -e "当前任务为:\033[36m $task_des\033[0m"
echo -e " 1 \033[33m修改\033[0m当前任务"
echo -e " 2 \033[31m删除\033[0m当前任务"
echo -e " 3 \033[32m立即执行\033[0m一次"
echo -e " 4 查看\033[33m执行记录\033[0m"
echo -----------------------------------------------
echo -e " 0 返回上级菜单"
read -p "请选择需要执行的操作 > " num
case "$num" in
0)
;;
1)
task_type && task_del $task_des
;;
2)
task_del $task_des
;;
3)
task_command=$(cat ${CRASHDIR}/task/task.list ${CRASHDIR}/task/task.user 2>/dev/null | grep "$task_id" | awk -F '#' '{print $2}')
eval $task_command && task_res='执行成功!' || task_res='执行失败!'
logger "任务【$task_des$task_res" 33 off
sleep 1
;;
4)
echo -----------------------------------------------
if [ -n "$(cat ${TMPDIR}/ShellCrash.log | grep "$task_name")" ];then
cat ${TMPDIR}/ShellCrash.log | grep "$task_name"
else
echo -e "\033[31m未找到相关执行记录\033[0m"
fi
sleep 1
;;
*)
errornum
;;
esac
fi
task_manager
;;
*)
@@ -434,13 +462,15 @@ task_recom(){ #任务推荐
echo -----------------------------------------------
read -p "是否启用?(1/0) > " res
[ "$res" = 1 ] && {
set_service running "106" "运行时每10分钟自动保存面板配置" "*/10"
set_service running "106" "运行时每10分钟自动保存面板配置" "*/10 * * * *"
set_service afstart "107" "服务启动后自动同步ntp时间"
cronset "在每周3的3点整更新订阅并重启服务" "0 3 * * 3 $CRASHDIR/task/task.sh 104 在每周3的3点整更新订阅并重启服务" && \
cronset "在每周3的3点整更新订阅并重启服务" "0 3 * * 3 ${CRASHDIR}/task/task.sh 104 在每周3的3点整更新订阅并重启服务" && \
echo -e "任务【在每周3的3点整更新订阅并重启服务】\033[32m添加成功\033[0m"
}
}
task_menu(){ #任务菜单
#检测并创建自定义任务文件
[ -f ${CRASHDIR}/task/task.user ] || echo '#任务ID(必须>200并顺序排列)#任务命令#任务说明(#号隔开,任务命令和说明中都不允许包含#号)' > ${CRASHDIR}/task/task.user
echo -----------------------------------------------
echo -e "\033[30;47m欢迎使用自动任务功能\033[0m"
echo -----------------------------------------------
@@ -463,13 +493,13 @@ task_menu(){ #任务菜单
;;
2)
task_manager
rm -rf $TMPDIR/task_list
rm -rf ${TMPDIR}/task_list
task_menu
;;
3)
if [ -n "$(cat $TMPDIR/ShellCrash.log | grep '任务【')" ];then
if [ -n "$(cat ${TMPDIR}/ShellCrash.log | grep '任务【')" ];then
echo -----------------------------------------------
cat $TMPDIR/ShellCrash.log | grep '任务【'
cat ${TMPDIR}/ShellCrash.log | grep '任务【'
else
echo -e "\033[31m未找到任务相关执行日志\033[0m"
fi
@@ -507,8 +537,8 @@ case "$1" in
task_menu
;;
[1-9][0-9][0-9])
task_command=$(cat $CRASHDIR/task/task.list $CRASHDIR/task/task.user 2>/dev/null | grep "$1" | awk -F '#' '{print $2}')
task_name=$(cat $CRASHDIR/task/task.list $CRASHDIR/task/task.user 2>/dev/null | grep "$1" | awk -F '#' '{print $3}')
task_command=$(cat ${CRASHDIR}/task/task.list ${CRASHDIR}/task/task.user 2>/dev/null | grep "$1" | awk -F '#' '{print $2}')
task_name=$(cat ${CRASHDIR}/task/task.list ${CRASHDIR}/task/task.user 2>/dev/null | grep "$1" | awk -F '#' '{print $3}')
#logger "任务$task_name 开始执行"
eval $task_command && task_res=成功 || task_res=失败
logger "任务【$2】执行$task_res"