~新增安装时自定义别名功能
~小米自动开机清理功能适配更多设备 ~将项目内置Geosite.dat数据库替换为Mihomo官方数据库以修复报错 ~暂时移除了由于项目内文件夹路径变动导致不可用的wwng2333下载源 ~集中修复了一些Singbox相关内核的启动报错,并增加提示信息 ~修复部分设备自动更新Mihomo内核失败的bug
This commit is contained in:
2
.github/workflows/bin_update.yml
vendored
2
.github/workflows/bin_update.yml
vendored
@@ -84,7 +84,7 @@ jobs:
|
||||
curl -kfSL -o geodata/cn_mini.mmdb https://raw.githubusercontent.com/Hackl0us/GeoIP2-CN/release/Country.mmdb
|
||||
curl -kfSL -o geodata/china_ip_list.txt https://raw.githubusercontent.com/ChanthMiao/China-IPv4-List/release/cn.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://github.com/DustinWin/ruleset_geodata/releases/download/mihomo-geodata/geosite-all.dat
|
||||
curl -kfSL -o geodata/geosite.dat https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat
|
||||
curl -kfSL -o geodata/srs_geoip_cn.srs https://github.com/DustinWin/ruleset_geodata/releases/download/sing-box-ruleset/cnip.srs
|
||||
curl -kfSL -o geodata/srs_geosite_cn.srs https://github.com/DustinWin/ruleset_geodata/releases/download/sing-box-ruleset/cn.srs
|
||||
curl -kfSL -o geodata/mrs_geosite_cn.mrs https://github.com/DustinWin/ruleset_geodata/releases/download/mihomo-ruleset/cn.mrs
|
||||
|
||||
23
install.sh
23
install.sh
@@ -43,6 +43,23 @@ error_down() {
|
||||
$echo "\033[33m使用其他安装源重新安装!\033[0m"
|
||||
}
|
||||
#安装及初始化
|
||||
set_alias(){
|
||||
$echo "\033[32m请选择一个别名\033[0m"
|
||||
echo -----------------------------------------------
|
||||
$echo " 1 【\033[32m crash \033[0m】"
|
||||
$echo " 2 【\033[32m sc \033[0m】"
|
||||
$echo " 3 【\033[32m mm \033[0m】"
|
||||
$echo " 0 退出安装"
|
||||
echo -----------------------------------------------
|
||||
read -p "请输入相应数字或自定义别名 > " res
|
||||
case "$res" in
|
||||
1) my_alias=crash ;;
|
||||
2) my_alias=sc ;;
|
||||
3) my_alias=mm ;;
|
||||
*) my_alias=$res ;;
|
||||
esac
|
||||
setconfig my_alias $my_alias
|
||||
}
|
||||
gettar() {
|
||||
webget /tmp/ShellCrash.tar.gz "$url/ShellCrash.tar.gz"
|
||||
if [ "$result" != "200" ]; then
|
||||
@@ -57,7 +74,9 @@ gettar() {
|
||||
mkdir -p $CRASHDIR >/dev/null
|
||||
tar -zxf '/tmp/ShellCrash.tar.gz' -C $CRASHDIR/ || tar -zxf '/tmp/ShellCrash.tar.gz' --no-same-owner -C $CRASHDIR/
|
||||
if [ -s $CRASHDIR/init.sh ]; then
|
||||
. $CRASHDIR/init.sh >/dev/null || $echo "\033[33m初始化失败,请尝试本地安装!\033[0m"
|
||||
set_alias
|
||||
. $CRASHDIR/init.sh >/dev/null
|
||||
[ "$?" != 0 ] && $echo "\033[33m初始化失败,请尝试本地安装!\033[0m" && exit 1
|
||||
else
|
||||
rm -rf /tmp/ShellCrash.tar.gz
|
||||
$echo "\033[33m文件解压失败!\033[0m"
|
||||
@@ -207,7 +226,7 @@ install() {
|
||||
[ "$profile" = "~/.bashrc" ] && echo "请执行【. ~/.bashrc > /dev/null】命令以加载环境变量!"
|
||||
[ -n "$(ls -l /bin/sh | grep -oE 'zsh')" ] && echo "请执行【. ~/.zshrc > /dev/null】命令以加载环境变量!"
|
||||
echo -----------------------------------------------
|
||||
$echo "\033[33m输入\033[30;47m crash \033[0;33m命令即可管理!!!\033[0m"
|
||||
$echo "\033[33m输入\033[30;47m $my_alias \033[0;33m命令即可管理!!!\033[0m"
|
||||
echo -----------------------------------------------
|
||||
}
|
||||
setversion() {
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
103 ShellClash自建源(请勿滥用!) https://gh.jwsc.eu.org
|
||||
104 Cloudflare_CDN源(推荐) https://testingcf.jsdelivr.net/gh/juewuy/ShellCrash
|
||||
|
||||
201 wwng2333自建CN源(请勿滥用!) https://mirrors.csgo.ovh/ShellClash 公测版
|
||||
202 http私人内测源(危险!非必要请勿使用) http://t.jwsc.eu.org 开发版
|
||||
|
||||
401 作者提供,支持vless|hy2 https://sub.jwsc.eu.org ua
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) Juewuy
|
||||
|
||||
version=1.9.3beta5fix
|
||||
version=1.9.3beta6
|
||||
|
||||
setdir() {
|
||||
dir_avail() {
|
||||
@@ -248,20 +248,19 @@ grep -q 'firewall_mod' "$CRASHDIR/configs/ShellClash.cfg" 2>/dev/null || {
|
||||
[ -w /jffs/configs/profile.add ] && profile=/jffs/configs/profile.add
|
||||
[ -w ~/.bashrc ] && profile=~/.bashrc
|
||||
[ -w /etc/profile ] && profile=/etc/profile
|
||||
set_profile(){
|
||||
[ -z "$my_alias" ] && my_alias=crash
|
||||
sed -i "/alias crash=*/"d "$1"
|
||||
sed -i "/alias ${my_alias}=*/"d "$1"
|
||||
echo "alias ${my_alias}=\"$shtype $CRASHDIR/menu.sh\"" >>"$1" #设置快捷命令环境变量
|
||||
sed -i '/export CRASHDIR=*/'d "$1"
|
||||
echo "export CRASHDIR=\"$CRASHDIR\"" >>"$1" #设置路径环境变量
|
||||
. "$1" >/dev/null 2>&1
|
||||
}
|
||||
if [ -n "$profile" ]; then
|
||||
sed -i '/alias crash=*/'d $profile
|
||||
echo "alias crash=\"$shtype $CRASHDIR/menu.sh\"" >>$profile #设置快捷命令环境变量
|
||||
sed -i '/export CRASHDIR=*/'d $profile
|
||||
echo "export CRASHDIR=\"$CRASHDIR\"" >>$profile #设置路径环境变量
|
||||
. $profile >/dev/null 2>&1 || echo 运行错误!请使用bash而不是dash运行安装命令!!!
|
||||
set_profile "$profile"
|
||||
#适配zsh环境变量
|
||||
zsh --version >/dev/null 2>&1 && [ -z "$(cat ~/.zshrc 2>/dev/null | grep CRASHDIR)" ] && {
|
||||
sed -i '/alias crash=*/'d ~/.zshrc 2>/dev/null
|
||||
echo "alias crash=\"$shtype $CRASHDIR/menu.sh\"" >>~/.zshrc
|
||||
sed -i '/export CRASHDIR=*/'d ~/.zshrc 2>/dev/null
|
||||
echo "export CRASHDIR=\"$CRASHDIR\"" >>~/.zshrc
|
||||
. ~/.zshrc >/dev/null 2>&1
|
||||
}
|
||||
zsh --version >/dev/null 2>&1 && [ -z "$(cat ~/.zshrc 2>/dev/null | grep CRASHDIR)" ] && set_profile '~/.zshrc' 2>/dev/null
|
||||
else
|
||||
echo -e "\033[33m无法写入环境变量!请检查安装权限!\033[0m"
|
||||
exit 1
|
||||
|
||||
@@ -43,8 +43,9 @@ auto_clean(){
|
||||
#自动清理升级备份文件夹
|
||||
rm -rf /data/etc_bak
|
||||
#自动清理被写入闪存的系统日志并禁止服务
|
||||
/etc/init.d/stat_points stop
|
||||
/etc/init.d/stat_points disable
|
||||
/etc/init.d/stat_points stop 2>/dev/null
|
||||
/etc/init.d/stat_points disable 2>/dev/null
|
||||
sed -i '\#/logrotate#{ /^[[:space:]]*#/!s/^/#ShellCrash自动注释 / }' /etc/crontabs/root
|
||||
rm -rf /data/usr/log
|
||||
}
|
||||
init(){
|
||||
|
||||
@@ -302,6 +302,12 @@ check_singbox_config() { #检查singbox配置文件
|
||||
sed -i 's/^.*"inbounds":/{"inbounds":/' "$core_config_new"
|
||||
sed -i 's/{[^{}]*"dns-out"[^{}]*}//g' "$core_config_new"
|
||||
}
|
||||
#检查不支持的旧版内容
|
||||
grep -q '"sni"' "$core_config_new" && {
|
||||
logger "获取到了不支持的旧版(<1.12)配置文件【$core_config_new】!" 31
|
||||
echo "请尝试使用支持1.12以上版本内核的方式生成配置文件!"
|
||||
exit 1
|
||||
}
|
||||
#检测并去除无效策略组
|
||||
[ -n "$url_type" ] && {
|
||||
#获得无效策略组名称
|
||||
@@ -682,7 +688,7 @@ EOF
|
||||
#获取detour出口
|
||||
auto_detour=$(grep -E '"type": "urltest"' -A 1 "$TMPDIR"/jsons/outbounds.json | grep '"tag":' | head -n 1 | sed 's/^[[:space:]]*"tag": //;s/,$//' )
|
||||
[ -z "$auto_detour" ] && auto_detour=$(grep -E '"type": "selector"' -A 1 "$TMPDIR"/jsons/outbounds.json | grep '"tag":' | head -n 1 | sed 's/^[[:space:]]*"tag": //;s/,$//' )
|
||||
[ -z "$auto_detour" ] && auto_detour=DIRECT
|
||||
[ -z "$auto_detour" ] && auto_detour='"DIRECT"'
|
||||
#根据dns模式生成
|
||||
[ "$dns_mod" = "redir_host" ] && {
|
||||
global_dns=dns_proxy
|
||||
@@ -713,9 +719,8 @@ EOF
|
||||
"rule_set": [
|
||||
{
|
||||
"tag": "cn",
|
||||
"type": "remote",
|
||||
"path": "./ruleset/cn.srs",
|
||||
"url": "https://testingcf.jsdelivr.net/gh/juewuy/ShellCrash@update/bin/geodata/srs_geosite_cn.srs"
|
||||
"type": "local",
|
||||
"path": "./ruleset/cn.srs"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -870,7 +875,7 @@ EOF
|
||||
grep -qE '"tag": "REJECT"' "$TMPDIR"/jsons/outbounds.json || add_reject='{ "tag": "REJECT", "type": "block" }'
|
||||
grep -qE '"tag": "GLOBAL"' "$TMPDIR"/jsons/outbounds.json || {
|
||||
auto_proxies=$(grep -E '"type": "(selector|urltest)"' -A 1 "$TMPDIR"/jsons/outbounds.json | grep '"tag":' | sed 's/^[[:space:]]*"tag": //;$ s/,$//')
|
||||
add_global='{ "tag": "GLOBAL", "type": "selector", "outbounds": ['"$auto_proxies"']}'
|
||||
[ -n "$auto_proxies" ] && add_global='{ "tag": "GLOBAL", "type": "selector", "outbounds": ['"$auto_proxies"', "DIRECT"]}'
|
||||
}
|
||||
[ -n "$add_direct" -a -n "$add_reject" ] && add_direct="${add_direct},"
|
||||
[ -n "$add_reject" -a -n "$add_global" ] && add_reject="${add_reject},"
|
||||
|
||||
@@ -2262,7 +2262,7 @@ userguide(){
|
||||
redir_mod="Redir模式"
|
||||
fi
|
||||
}
|
||||
setconfig crashcore "mihomo"
|
||||
setconfig crashcore "meta"
|
||||
setconfig redir_mod "$redir_mod"
|
||||
setconfig dns_mod mix
|
||||
setconfig firewall_area '1'
|
||||
|
||||
Reference in New Issue
Block a user