Merge branch 'dev' into sb
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) Juewuy
|
||||
|
||||
version=1.9.2beta6
|
||||
version=1.9.2beta7
|
||||
|
||||
setdir() {
|
||||
dir_avail() {
|
||||
|
||||
@@ -116,17 +116,16 @@ ckstatus() {
|
||||
[ ! -x ${CRASHDIR}/start.sh ] && chmod +x ${CRASHDIR}/start.sh
|
||||
#检查/tmp内核文件
|
||||
for file in $(ls /tmp | grep -v [/$] | grep -v ' ' | grep -Ev ".*(gz|zip|7z|tar)$" | grep -iE 'CrashCore|^clash$|^clash-linux.*|^mihomo.*|^sing.*box|^clash.meta.*'); do
|
||||
file=/tmp/$file
|
||||
chmod +x $file
|
||||
echo -e "发现可用的内核文件: \033[36m$file\033[0m "
|
||||
chmod +x /tmp/$file
|
||||
echo -e "发现可用的内核文件: \033[36m/tmp/$file\033[0m "
|
||||
read -p "是否加载(会停止当前服务)?(1/0) > " res
|
||||
[ "$res" = 1 ] && {
|
||||
${CRASHDIR}/start.sh stop
|
||||
core_v=$($file -v 2>/dev/null | head -n 1 | sed 's/ linux.*//;s/.* //')
|
||||
[ -z "$core_v" ] && core_v=$($file version 2>/dev/null | grep -Eo 'version .*' | sed 's/version //')
|
||||
core_v=$(/tmp/$file -v 2>/dev/null | head -n 1 | sed 's/ linux.*//;s/.* //')
|
||||
[ -z "$core_v" ] && core_v=$(/tmp/$file version 2>/dev/null | grep -Eo 'version .*' | sed 's/version //')
|
||||
if [ -n "$core_v" ]; then
|
||||
source ${CRASHDIR}/webget.sh && setcoretype &&
|
||||
mv -f $file ${TMPDIR}/CrashCore &&
|
||||
mv -f /tmp/$file ${TMPDIR}/CrashCore &&
|
||||
tar -zcf ${BINDIR}/CrashCore.tar.gz ${tar_para} -C ${TMPDIR} CrashCore &&
|
||||
echo -e "\033[32m内核加载完成!\033[0m " &&
|
||||
setconfig crashcore $crashcore &&
|
||||
@@ -135,7 +134,7 @@ ckstatus() {
|
||||
sleep 1
|
||||
else
|
||||
echo -e "\033[33m检测到不可用的内核文件!可能是文件受损或CPU架构不匹配!\033[0m"
|
||||
rm -rf $file
|
||||
rm -rf /tmp/$file
|
||||
echo -e "\033[33m内核文件已移除,请认真检查后重新上传!\033[0m"
|
||||
sleep 2
|
||||
fi
|
||||
@@ -144,14 +143,14 @@ ckstatus() {
|
||||
done
|
||||
#检查/tmp配置文件
|
||||
for file in $(ls /tmp | grep -v [/$] | grep -v ' ' | grep -iE '.yaml$|.yml$|config.json$'); do
|
||||
file=/tmp/$file
|
||||
echo -e "发现内核配置文件: \033[36m$file\033[0m "
|
||||
tmp_file=/tmp/$file
|
||||
echo -e "发现内核配置文件: \033[36m/tmp/$file\033[0m "
|
||||
read -p "是否加载为$crashcore的配置文件?(1/0) > " res
|
||||
[ "$res" = 1 ] && {
|
||||
if [ -n "$(echo $file | grep -iE '.json$')" ]; then
|
||||
mv -f $file ${CRASHDIR}/jsons/config.json
|
||||
if [ -n "$(echo /tmp/$file | grep -iE '.json$')" ]; then
|
||||
mv -f /tmp/$file ${CRASHDIR}/jsons/config.json
|
||||
else
|
||||
mv -f $file ${CRASHDIR}/yamls/config.yaml
|
||||
mv -f /tmp/$file ${CRASHDIR}/yamls/config.yaml
|
||||
fi
|
||||
echo -e "\033[32m配置文件加载完成!\033[0m "
|
||||
sleep 1
|
||||
@@ -1965,7 +1964,7 @@ tools() {
|
||||
[ -f /etc/firewall.user ] && echo -e " 4 \033[32m配置\033[0m外网访问SSH"
|
||||
[ -x /usr/sbin/otapredownload ] && echo -e " 5 \033[33m$mi_update\033[0m小米系统自动更新"
|
||||
[ -f ${CRASHDIR}/misnap_init.sh ] && echo -e " 6 小米设备软固化SSH ———— \033[$mi_autoSSH_type \033[0m"
|
||||
[ -f /etc/config/ddns -a -d "/etc/ddns" ] && echo -e " 7 配置\033[32mDDNS服务\033[0m(需下载相关脚本)"
|
||||
[ -f /etc/config/ddns ] && echo -e " 7 配置\033[32mDDNS服务\033[0m(需下载相关脚本)"
|
||||
[ -f ${CRASHDIR}/misnap_init.sh ] && echo -e " 8 小米设备Tun模块修复 ———— \033[$mi_tunfix \033[0m"
|
||||
echo -----------------------------------------------
|
||||
echo -e " 0 返回上级菜单"
|
||||
|
||||
@@ -61,9 +61,9 @@ getconfig() { #读取配置及全局变量
|
||||
#自动生成ua
|
||||
[ -z "$user_agent" -o "$user_agent" = "auto" ] && {
|
||||
if [ "$crashcore" = singbox -o "$crashcore" = singboxp ];then
|
||||
user_agent="sing-box/$core_v"
|
||||
user_agent="sing-box/singbox/$core_v"
|
||||
elif [ "$crashcore" = meta ];then
|
||||
user_agent="mihomo/$core_v"
|
||||
user_agent="clash.meta/mihomo/$core_v"
|
||||
else
|
||||
user_agent="clash"
|
||||
fi
|
||||
@@ -199,7 +199,7 @@ put_save() { #推送面板选择
|
||||
}
|
||||
get_bin() { #专用于项目内部文件的下载
|
||||
. "$CRASHDIR"/configs/ShellCrash.cfg >/dev/null
|
||||
[ -z "$update_url" ] && update_url=https://fastly.jsdelivr.net/gh/juewuy/ShellCrash@master
|
||||
[ -z "$update_url" ] && update_url=https://testingcf.jsdelivr.net/gh/juewuy/ShellCrash@master
|
||||
if [ -n "$url_id" ]; then
|
||||
[ -z "$release_type" ] && release_type=master
|
||||
if [ "$url_id" = 101 -o "$url_id" = 104 ]; then
|
||||
@@ -541,7 +541,7 @@ EOF
|
||||
mv -f "$TMPDIR"/rules.add "$TMPDIR"/rules.yaml
|
||||
}
|
||||
#mix模式生成rule-providers
|
||||
[ "$dns_mod" = "mix" ] && ! grep -q 'geosite-cn:' "$TMPDIR"/rule-providers.yaml && ! grep -q 'rule-providers' "$CRASHDIR"/yamls/others.yaml 2>/dev/null && {
|
||||
[ "$dns_mod" = "mix" ] && ! grep -q 'geosite-cn:' "$TMPDIR"/rule-providers.yaml && ! grep -q '^rule-providers' "$CRASHDIR"/yamls/others.yaml 2>/dev/null && {
|
||||
space=$(sed -n "1p" "$TMPDIR"/rule-providers.yaml | grep -oE '^ *') #获取空格数
|
||||
[ -z "$space" ] && space=' '
|
||||
echo "${space}geosite-cn: {type: file, behavior: domain, format: mrs, path: geosite-cn.mrs}" >> "$TMPDIR"/rule-providers.yaml
|
||||
@@ -1757,7 +1757,7 @@ start_firewall() { #路由规则总入口
|
||||
getlanip #获取局域网host地址
|
||||
#设置策略路由
|
||||
[ "$firewall_area" != 4 ] && {
|
||||
local table=100
|
||||
local table=166
|
||||
[ "$redir_mod" = "Tproxy模式" ] && ip route add local default dev lo table $table 2>/dev/null
|
||||
[ "$redir_mod" = "Tun模式" -o "$redir_mod" = "混合模式" ] && {
|
||||
i=1
|
||||
@@ -2401,7 +2401,7 @@ webget)
|
||||
export all_proxy="http://${auth}127.0.0.1:$mix_port"
|
||||
url=$(echo $3 | sed 's#https://.*jsdelivr.net/gh/juewuy/ShellCrash[@|/]#https://raw.githubusercontent.com/juewuy/ShellCrash/#' | sed 's#https://gh.jwsc.eu.org/#https://raw.githubusercontent.com/juewuy/ShellCrash/#')
|
||||
else
|
||||
url=$(echo $3 | sed 's#https://raw.githubusercontent.com/juewuy/ShellCrash/#https://fastly.jsdelivr.net/gh/juewuy/ShellCrash@#')
|
||||
url=$(echo $3 | sed 's#https://raw.githubusercontent.com/juewuy/ShellCrash/#https://testingcf.jsdelivr.net/gh/juewuy/ShellCrash@#')
|
||||
fi
|
||||
#参数【$2】代表下载目录,【$3】代表在线地址
|
||||
#参数【$4】代表输出显示,【$5】不启用重定向
|
||||
|
||||
@@ -1054,6 +1054,7 @@ set_core_config(){ #配置文件功能
|
||||
fi
|
||||
fi
|
||||
gen_core_config_link
|
||||
set_core_config
|
||||
;;
|
||||
2)
|
||||
if [ -f "$CRASHDIR"/v2b_api.sh ];then
|
||||
@@ -1062,6 +1063,7 @@ set_core_config(){ #配置文件功能
|
||||
else
|
||||
set_core_config_link
|
||||
fi
|
||||
set_core_config
|
||||
;;
|
||||
3)
|
||||
if [ "$crashcore" = meta -o "$crashcore" = clashpre ];then
|
||||
@@ -1094,6 +1096,7 @@ set_core_config(){ #配置文件功能
|
||||
checkcfg_new=$(cat $CFG_PATH)
|
||||
[ "$checkcfg" != "$checkcfg_new" ] && checkrestart
|
||||
fi
|
||||
set_core_config
|
||||
;;
|
||||
7)
|
||||
if [ -z "$Url" -a -z "$Https" ];then
|
||||
@@ -1498,15 +1501,15 @@ setcore(){ #内核选择菜单
|
||||
echo -e "1 \033[43;30m Clash \033[0m: \033[32m占用低\033[0m"
|
||||
echo -e " >>\033[32m$clash_v \033[33m不支持Tun、Rule-set等\033[0m"
|
||||
echo -e " 说明文档: \033[36;4mhttps://lancellc.gitbook.io\033[0m"
|
||||
echo -e "2 \033[43;30m SingBox \033[0m: \033[32m支持全面占用低\033[0m"
|
||||
echo -e " >>\033[32m$singbox_v \033[33m不支持providers\033[0m"
|
||||
echo -e " 说明文档: \033[36;4mhttps://sing-box.sagernet.org\033[0m"
|
||||
#echo -e "2 \033[43;30m SingBox \033[0m: \033[32m支持全面占用低\033[0m"
|
||||
#echo -e " >>\033[32m$singbox_v \033[33m不支持providers\033[0m"
|
||||
#echo -e " 说明文档: \033[36;4mhttps://sing-box.sagernet.org\033[0m"
|
||||
echo -e "3 \033[43;30m Mihomo \033[0m: \033[32m(原meta内核)支持全面\033[0m"
|
||||
echo -e " >>\033[32m$meta_v \033[33m占用略高,GeoSite可能不兼容华硕固件\033[0m"
|
||||
echo -e " 说明文档: \033[36;4mhttps://wiki.metacubex.one\033[0m"
|
||||
echo -e "4 \033[43;30m SingBoxP \033[0m: \033[32m支持ssr、providers、dns并发……\033[0m"
|
||||
echo -e " >>\033[32m$singboxp_v \033[33mPuerNya分支版本\033[0m"
|
||||
echo -e " 说明文档: \033[36;4mhttps://sing-boxp.dustinwin.top\033[0m"
|
||||
#echo -e "4 \033[43;30m SingBoxP \033[0m: \033[32m支持ssr、providers、dns并发……\033[0m"
|
||||
#echo -e " >>\033[32m$singboxp_v \033[33mPuerNya分支版本\033[0m"
|
||||
#echo -e " 说明文档: \033[36;4mhttps://sing-boxp.dustinwin.top\033[0m"
|
||||
echo -----------------------------------------------
|
||||
echo -e "5 \033[36m自定义内核\033[0m $custcore"
|
||||
echo -----------------------------------------------
|
||||
@@ -1663,13 +1666,13 @@ setcustgeo(){ #下载自定义数据库文件
|
||||
;;
|
||||
2)
|
||||
project=DustinWin/ruleset_geodata
|
||||
api_tag=mihomo
|
||||
api_tag=mihomo-geodata
|
||||
checkcustgeo
|
||||
setcustgeo
|
||||
;;
|
||||
3)
|
||||
project=DustinWin/ruleset_geodata
|
||||
api_tag=sing-box
|
||||
api_tag=sing-box-geodata
|
||||
checkcustgeo
|
||||
setcustgeo
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user