From c1082e55a6cc3390b038a5abcdc505a4398249d3 Mon Sep 17 00:00:00 2001 From: juewuy Date: Sat, 13 Dec 2025 15:39:17 +0800 Subject: [PATCH] =?UTF-8?q?~=E6=96=B0=E5=A2=9E=E5=AE=89=E8=A3=85=E6=97=B6?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E5=88=AB=E5=90=8D=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=20~=E5=B0=8F=E7=B1=B3=E8=87=AA=E5=8A=A8=E5=BC=80=E6=9C=BA?= =?UTF-8?q?=E6=B8=85=E7=90=86=E5=8A=9F=E8=83=BD=E9=80=82=E9=85=8D=E6=9B=B4?= =?UTF-8?q?=E5=A4=9A=E8=AE=BE=E5=A4=87=20~=E5=B0=86=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=86=85=E7=BD=AEGeosite.dat=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E4=B8=BAMihomo=E5=AE=98=E6=96=B9=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E4=BB=A5=E4=BF=AE=E5=A4=8D=E6=8A=A5=E9=94=99?= =?UTF-8?q?=20~=E6=9A=82=E6=97=B6=E7=A7=BB=E9=99=A4=E4=BA=86=E7=94=B1?= =?UTF-8?q?=E4=BA=8E=E9=A1=B9=E7=9B=AE=E5=86=85=E6=96=87=E4=BB=B6=E5=A4=B9?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E5=8F=98=E5=8A=A8=E5=AF=BC=E8=87=B4=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E7=94=A8=E7=9A=84wwng2333=E4=B8=8B=E8=BD=BD=E6=BA=90?= =?UTF-8?q?=20~=E9=9B=86=E4=B8=AD=E4=BF=AE=E5=A4=8D=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=BA=9BSingbox=E7=9B=B8=E5=85=B3=E5=86=85=E6=A0=B8=E7=9A=84?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=8A=A5=E9=94=99=EF=BC=8C=E5=B9=B6=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF=20~=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E9=83=A8=E5=88=86=E8=AE=BE=E5=A4=87=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=9B=B4=E6=96=B0Mihomo=E5=86=85=E6=A0=B8=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/bin_update.yml | 2 +- install.sh | 23 +++++++++++++++++++++-- public/servers.list | 1 - scripts/init.sh | 25 ++++++++++++------------- scripts/misnap_init.sh | 5 +++-- scripts/start.sh | 15 ++++++++++----- scripts/webget.sh | 2 +- 7 files changed, 48 insertions(+), 25 deletions(-) diff --git a/.github/workflows/bin_update.yml b/.github/workflows/bin_update.yml index 9686870..fe860cd 100644 --- a/.github/workflows/bin_update.yml +++ b/.github/workflows/bin_update.yml @@ -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 diff --git a/install.sh b/install.sh index 439a374..35650bd 100644 --- a/install.sh +++ b/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() { diff --git a/public/servers.list b/public/servers.list index 8080eb8..90811fa 100644 --- a/public/servers.list +++ b/public/servers.list @@ -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 diff --git a/scripts/init.sh b/scripts/init.sh index c37a669..4bcb962 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -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 diff --git a/scripts/misnap_init.sh b/scripts/misnap_init.sh index fbdc8dd..e7a820c 100644 --- a/scripts/misnap_init.sh +++ b/scripts/misnap_init.sh @@ -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(){ diff --git a/scripts/start.sh b/scripts/start.sh index bad11ed..e6bd3ab 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -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}," diff --git a/scripts/webget.sh b/scripts/webget.sh index 0d6df61..d0d137c 100644 --- a/scripts/webget.sh +++ b/scripts/webget.sh @@ -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'