适配singboxpure内核
适配singbox内核加载本机hosts功能 debug菜单增加singbox配置文件合并功能 优化singbox内核dns及dns生成逻辑 优化json文件切割方式 优化ip6tables模块检测方式
This commit is contained in:
@@ -94,7 +94,7 @@ setrules(){ #自定义规则
|
|||||||
echo -e " 1 新增自定义规则"
|
echo -e " 1 新增自定义规则"
|
||||||
echo -e " 2 移除自定义规则"
|
echo -e " 2 移除自定义规则"
|
||||||
echo -e " 3 清空规则列表"
|
echo -e " 3 清空规则列表"
|
||||||
[ "$crashcore" = singbox ] || echo -e " 4 配置节点绕过: \033[36m$proxies_bypass\033[0m"
|
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] || echo -e " 4 配置节点绕过: \033[36m$proxies_bypass\033[0m"
|
||||||
echo -e " 0 返回上级菜单"
|
echo -e " 0 返回上级菜单"
|
||||||
read -p "请输入对应数字 > " num
|
read -p "请输入对应数字 > " num
|
||||||
case $num in
|
case $num in
|
||||||
@@ -379,7 +379,7 @@ override(){ #配置文件覆写
|
|||||||
echo -----------------------------------------------
|
echo -----------------------------------------------
|
||||||
echo -e " 1 自定义\033[32m端口及秘钥\033[0m"
|
echo -e " 1 自定义\033[32m端口及秘钥\033[0m"
|
||||||
echo -e " 2 管理\033[36m自定义规则\033[0m"
|
echo -e " 2 管理\033[36m自定义规则\033[0m"
|
||||||
[ "$crashcore" = singbox ] || {
|
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] || {
|
||||||
echo -e " 3 管理\033[33m自定义节点\033[0m"
|
echo -e " 3 管理\033[33m自定义节点\033[0m"
|
||||||
echo -e " 4 管理\033[36m自定义策略组\033[0m"
|
echo -e " 4 管理\033[36m自定义策略组\033[0m"
|
||||||
}
|
}
|
||||||
@@ -416,7 +416,7 @@ override(){ #配置文件覆写
|
|||||||
override
|
override
|
||||||
;;
|
;;
|
||||||
5)
|
5)
|
||||||
[ "$crashcore" = singbox ] && set_singbox_adv || set_clash_adv
|
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] && set_singbox_adv || set_clash_adv
|
||||||
sleep 3
|
sleep 3
|
||||||
override
|
override
|
||||||
;;
|
;;
|
||||||
@@ -651,7 +651,7 @@ set_core_config_link(){ #直接导入配置
|
|||||||
set_core_config(){ #配置文件功能
|
set_core_config(){ #配置文件功能
|
||||||
[ -z "$rule_link" ] && rule_link=1
|
[ -z "$rule_link" ] && rule_link=1
|
||||||
[ -z "$server_link" ] && server_link=1
|
[ -z "$server_link" ] && server_link=1
|
||||||
[ "$crashcore" = singbox ] && config_path=${JSONSDIR}/config.json || config_path=${YAMLSDIR}/config.yaml
|
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] && config_path=${JSONSDIR}/config.json || config_path=${YAMLSDIR}/config.yaml
|
||||||
echo -----------------------------------------------
|
echo -----------------------------------------------
|
||||||
echo -e "\033[30;47m ShellCrash配置文件管理\033[0m"
|
echo -e "\033[30;47m ShellCrash配置文件管理\033[0m"
|
||||||
echo -----------------------------------------------
|
echo -----------------------------------------------
|
||||||
@@ -819,7 +819,7 @@ setcpucore(){
|
|||||||
echo -e "不知道如何获取核心版本?请参考:\033[36;4mhttps://juewuy.github.io/bdaz\033[0m"
|
echo -e "不知道如何获取核心版本?请参考:\033[36;4mhttps://juewuy.github.io/bdaz\033[0m"
|
||||||
echo -----------------------------------------------
|
echo -----------------------------------------------
|
||||||
read -p "请输入对应数字 > " num
|
read -p "请输入对应数字 > " num
|
||||||
setcpucore=$(echo $cpucore_list | awk '{print $"'"$num"'"}' )
|
[ -n "$num" ] && setcpucore=$(echo $cpucore_list | awk '{print $"'"$num"'"}' )
|
||||||
if [ -z "$setcpucore" ];then
|
if [ -z "$setcpucore" ];then
|
||||||
echo -e "\033[31m请输入正确的处理器架构!\033[0m"
|
echo -e "\033[31m请输入正确的处理器架构!\033[0m"
|
||||||
sleep 1
|
sleep 1
|
||||||
@@ -830,7 +830,7 @@ setcpucore(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
setcoretype(){
|
setcoretype(){
|
||||||
[ "$crashcore" = singbox ] && core_old=singbox || core_old=clash
|
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] && core_old=singbox || core_old=clash
|
||||||
echo -e "\033[33m请确认该自定义内核的类型:\033[0m"
|
echo -e "\033[33m请确认该自定义内核的类型:\033[0m"
|
||||||
echo -e " 1 Clash基础内核"
|
echo -e " 1 Clash基础内核"
|
||||||
echo -e " 2 Clash-Premium内核"
|
echo -e " 2 Clash-Premium内核"
|
||||||
@@ -843,7 +843,7 @@ setcoretype(){
|
|||||||
4) crashcore=singbox ;;
|
4) crashcore=singbox ;;
|
||||||
*) crashcore=clash ;;
|
*) crashcore=clash ;;
|
||||||
esac
|
esac
|
||||||
[ "$crashcore" = singbox ] && core_new=singbox || core_new=clash
|
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] && core_new=singbox || core_new=clash
|
||||||
}
|
}
|
||||||
switch_core(){
|
switch_core(){
|
||||||
#singbox和clash内核切换时提示是否保留文件
|
#singbox和clash内核切换时提示是否保留文件
|
||||||
@@ -865,7 +865,7 @@ switch_core(){
|
|||||||
setconfig geosite_cn_v
|
setconfig geosite_cn_v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if [ "$crashcore" = singbox ];then
|
if [ "$crashcore" = singbox -o "$crashcore" = singboxp ];then
|
||||||
COMMAND='"$TMPDIR/CrashCore run -D $BINDIR -C $TMPDIR/jsons"'
|
COMMAND='"$TMPDIR/CrashCore run -D $BINDIR -C $TMPDIR/jsons"'
|
||||||
else
|
else
|
||||||
COMMAND='"$TMPDIR/CrashCore -d $BINDIR -f $TMPDIR/config.yaml"'
|
COMMAND='"$TMPDIR/CrashCore -d $BINDIR -f $TMPDIR/config.yaml"'
|
||||||
@@ -875,7 +875,7 @@ switch_core(){
|
|||||||
getcore(){
|
getcore(){
|
||||||
[ -z "$crashcore" ] && crashcore=clashpre
|
[ -z "$crashcore" ] && crashcore=clashpre
|
||||||
[ -z "$cpucore" ] && getcpucore
|
[ -z "$cpucore" ] && getcpucore
|
||||||
[ "$crashcore" = singbox ] && core_new=singbox || core_new=clash
|
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] && core_new=singbox || core_new=clash
|
||||||
#获取在线内核文件
|
#获取在线内核文件
|
||||||
echo -----------------------------------------------
|
echo -----------------------------------------------
|
||||||
echo 正在在线获取$crashcore核心文件……
|
echo 正在在线获取$crashcore核心文件……
|
||||||
@@ -900,7 +900,7 @@ getcore(){
|
|||||||
}
|
}
|
||||||
chmod +x ${TMPDIR}/CrashCore
|
chmod +x ${TMPDIR}/CrashCore
|
||||||
[ "$crashcore" = unknow ] && setcoretype
|
[ "$crashcore" = unknow ] && setcoretype
|
||||||
if [ "$crashcore" = singbox ];then
|
if [ "$crashcore" = singbox -o "$crashcore" = singboxp ];then
|
||||||
core_v=$(${TMPDIR}/CrashCore version 2>/dev/null | grep version | awk '{print $3}')
|
core_v=$(${TMPDIR}/CrashCore version 2>/dev/null | grep version | awk '{print $3}')
|
||||||
else
|
else
|
||||||
core_v=$(${TMPDIR}/CrashCore -v 2>/dev/null | head -n 1 | sed 's/ linux.*//;s/.* //')
|
core_v=$(${TMPDIR}/CrashCore -v 2>/dev/null | head -n 1 | sed 's/ linux.*//;s/.* //')
|
||||||
@@ -964,7 +964,7 @@ setcore(){
|
|||||||
#获取核心及版本信息
|
#获取核心及版本信息
|
||||||
[ -z "$crashcore" ] && crashcore="unknow"
|
[ -z "$crashcore" ] && crashcore="unknow"
|
||||||
[ ! -f ${CRASHDIR}/core.tar.gz ] && crashcore="未安装核心"
|
[ ! -f ${CRASHDIR}/core.tar.gz ] && crashcore="未安装核心"
|
||||||
[ "$crashcore" = singbox ] && core_old=singbox || core_old=clash
|
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] && core_old=singbox || core_old=clash
|
||||||
###
|
###
|
||||||
echo -----------------------------------------------
|
echo -----------------------------------------------
|
||||||
[ -z "$cpucore" ] && getcpucore
|
[ -z "$cpucore" ] && getcpucore
|
||||||
@@ -985,13 +985,13 @@ setcore(){
|
|||||||
echo -e " (Meta/Mihomo) \033[33m内存占用较高\033[0m"
|
echo -e " (Meta/Mihomo) \033[33m内存占用较高\033[0m"
|
||||||
echo -e " 说明文档: \033[36;4mhttps://wiki.metacubex.one\033[0m"
|
echo -e " 说明文档: \033[36;4mhttps://wiki.metacubex.one\033[0m"
|
||||||
echo
|
echo
|
||||||
echo -e "4 \033[43;30m SingBoxP\033[0m: \033[32m支持ssr、providers、dns并发……\033[0m"
|
echo -e "4 \033[43;30m SingBoxP \033[0m: \033[32m支持ssr、providers、dns并发……\033[0m"
|
||||||
echo -e " (sing-box分支) \033[33mPuerNya分支版本\033[0m"
|
echo -e " (sing-box分支) \033[33mPuerNya分支版本\033[0m"
|
||||||
echo -e " 说明文档: \033[36;4mhttps://sing-box.sagernet.org\033[0m"
|
echo -e " 说明文档: \033[36;4mhttps://sing-box.sagernet.org\033[0m"
|
||||||
echo
|
echo
|
||||||
echo -e "5 \033[32m自定义内核\033[0m: \033[33m仅限专业用户使用\033[0m"
|
echo -e "5 \033[32m自定义内核\033[0m: \033[33m仅限专业用户使用\033[0m"
|
||||||
echo
|
echo
|
||||||
echo "6 手动指定处理器架构"
|
echo "9 手动指定处理器架构"
|
||||||
echo -----------------------------------------------
|
echo -----------------------------------------------
|
||||||
echo 0 返回上级菜单
|
echo 0 返回上级菜单
|
||||||
read -p "请输入对应数字 > " num
|
read -p "请输入对应数字 > " num
|
||||||
@@ -1867,7 +1867,7 @@ userguide(){
|
|||||||
}
|
}
|
||||||
#测试菜单
|
#测试菜单
|
||||||
debug(){
|
debug(){
|
||||||
[ "$crashcore" = singbox ] && config_tmp=$TMPDIR/config.json || config_tmp=$TMPDIR/config.yaml
|
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] && config_tmp=$TMPDIR/jsons || config_tmp=$TMPDIR/config.yaml
|
||||||
echo -----------------------------------------------
|
echo -----------------------------------------------
|
||||||
echo -e "\033[36m注意:Debug运行均会停止原本的内核服务\033[0m"
|
echo -e "\033[36m注意:Debug运行均会停止原本的内核服务\033[0m"
|
||||||
echo -e "后台运行日志地址:\033[32m$TMPDIR/debug.log\033[0m"
|
echo -e "后台运行日志地址:\033[32m$TMPDIR/debug.log\033[0m"
|
||||||
@@ -1879,6 +1879,7 @@ debug(){
|
|||||||
echo -e " 3 后台运行完整启动流程,并配置防火墙劫持,日志等级:\033[31merror\033[0m"
|
echo -e " 3 后台运行完整启动流程,并配置防火墙劫持,日志等级:\033[31merror\033[0m"
|
||||||
echo -e " 4 后台运行完整启动流程,并配置防火墙劫持,日志等级:\033[32minfo\033[0m"
|
echo -e " 4 后台运行完整启动流程,并配置防火墙劫持,日志等级:\033[32minfo\033[0m"
|
||||||
echo -e " 5 后台运行完整启动流程,并配置防火墙劫持,日志等级:\033[33mdebug\033[0m"
|
echo -e " 5 后台运行完整启动流程,并配置防火墙劫持,日志等级:\033[33mdebug\033[0m"
|
||||||
|
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] && echo -e " 6 将\033[32m$config_tmp\033[0m下json文件合并为$TMPDIR/debug.json"
|
||||||
echo -----------------------------------------------
|
echo -----------------------------------------------
|
||||||
echo " 0 返回上级目录!"
|
echo " 0 返回上级目录!"
|
||||||
read -p "请输入对应数字 > " num
|
read -p "请输入对应数字 > " num
|
||||||
@@ -1886,7 +1887,7 @@ debug(){
|
|||||||
0) ;;
|
0) ;;
|
||||||
1)
|
1)
|
||||||
$CRASHDIR/start.sh stop
|
$CRASHDIR/start.sh stop
|
||||||
if [ "$crashcore" = singbox ] ;then
|
if [ "$crashcore" = singbox -o "$crashcore" = singboxp ] ;then
|
||||||
$TMPDIR/CrashCore run -D $BINDIR -C $TMPDIR/jsons &
|
$TMPDIR/CrashCore run -D $BINDIR -C $TMPDIR/jsons &
|
||||||
{ sleep 4 ; kill $! &>/dev/null & }
|
{ sleep 4 ; kill $! &>/dev/null & }
|
||||||
wait
|
wait
|
||||||
@@ -1914,13 +1915,17 @@ debug(){
|
|||||||
$CRASHDIR/start.sh debug debug
|
$CRASHDIR/start.sh debug debug
|
||||||
main_menu
|
main_menu
|
||||||
;;
|
;;
|
||||||
|
6)
|
||||||
|
$TMPDIR/CrashCore merge $TMPDIR/debug.json -C $TMPDIR/jsons && echo -e "\033[32m合并成功!\033[0m"
|
||||||
|
main_menu
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
errornum
|
errornum
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
testcommand(){
|
testcommand(){
|
||||||
[ "$crashcore" = singbox ] && config_path=${JSONSDIR}/config.json || config_path=${YAMLSDIR}/config.yaml
|
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] && config_path=${JSONSDIR}/config.json || config_path=${YAMLSDIR}/config.yaml
|
||||||
echo -----------------------------------------------
|
echo -----------------------------------------------
|
||||||
echo -e "\033[30;47m这里是测试命令菜单\033[0m"
|
echo -e "\033[30;47m这里是测试命令菜单\033[0m"
|
||||||
echo -e "\033[33m如遇问题尽量运行相应命令后截图提交issue或TG讨论组\033[0m"
|
echo -e "\033[33m如遇问题尽量运行相应命令后截图提交issue或TG讨论组\033[0m"
|
||||||
@@ -1970,6 +1975,7 @@ testcommand(){
|
|||||||
[ "$local_proxy" = "已开启" ] && [ "$local_type" = "iptables增强模式" ] && {
|
[ "$local_proxy" = "已开启" ] && [ "$local_type" = "iptables增强模式" ] && {
|
||||||
echo ----------------OUTPUT-------------------
|
echo ----------------OUTPUT-------------------
|
||||||
iptables -t nat -L OUTPUT --line-numbers
|
iptables -t nat -L OUTPUT --line-numbers
|
||||||
|
iptables -t nat -L shellcrash_dns_out --line-numbers
|
||||||
iptables -t nat -L shellcrash_out --line-numbers
|
iptables -t nat -L shellcrash_out --line-numbers
|
||||||
}
|
}
|
||||||
[ "$ipv6_redir" = "已开启" ] && {
|
[ "$ipv6_redir" = "已开启" ] && {
|
||||||
|
|||||||
@@ -299,5 +299,6 @@ sed -i "s/clashcore/crashcore/g" $configpath
|
|||||||
sed -i "s/clash_v/core_v/g" $configpath
|
sed -i "s/clash_v/core_v/g" $configpath
|
||||||
sed -i "s/clash.meta/meta/g" $configpath
|
sed -i "s/clash.meta/meta/g" $configpath
|
||||||
sed -i "s/ShellClash/ShellCrash/g" $configpath
|
sed -i "s/ShellClash/ShellCrash/g" $configpath
|
||||||
|
sed -i "s/cpucore=armv8/cpucore=arm64/g" $configpath
|
||||||
|
|
||||||
echo -e "\033[32m脚本初始化完成,请输入\033[30;47m crash \033[0;33m命令开始使用!\033[0m"
|
echo -e "\033[32m脚本初始化完成,请输入\033[30;47m crash \033[0;33m命令开始使用!\033[0m"
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ ckstatus(){
|
|||||||
#检测系统端口占用
|
#检测系统端口占用
|
||||||
checkport
|
checkport
|
||||||
fi
|
fi
|
||||||
[ "$crashcore" = singbox ] && corename=Sing-Box || corename=Clash
|
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] && corename=SingBox || corename=Clash
|
||||||
[ -f ${TMPDIR}/debug.log -a -n "$PID" ] && auto="\033[33m并处于debug状态!\033[0m"
|
[ -f ${TMPDIR}/debug.log -a -n "$PID" ] && auto="\033[33m并处于debug状态!\033[0m"
|
||||||
#输出状态
|
#输出状态
|
||||||
echo -----------------------------------------------
|
echo -----------------------------------------------
|
||||||
@@ -158,9 +158,8 @@ errornum(){
|
|||||||
echo -e "\033[31m请输入正确的字母或数字!\033[0m"
|
echo -e "\033[31m请输入正确的字母或数字!\033[0m"
|
||||||
}
|
}
|
||||||
startover(){
|
startover(){
|
||||||
[ "$crashcore" = singbox ] && corename=Singbox || corename=Clash
|
|
||||||
echo -e "\033[32m$corename服务已启动!\033[0m"
|
echo -e "\033[32m$corename服务已启动!\033[0m"
|
||||||
echo -e "请使用 \033[4;32mhttp://$host$hostdir\033[0m 管理内置规则"
|
echo -e "请使用 \033[4;36mhttp://$host$hostdir\033[0m 管理内置规则"
|
||||||
if [ "$redir_mod" = "纯净模式" ];then
|
if [ "$redir_mod" = "纯净模式" ];then
|
||||||
echo -----------------------------------------------
|
echo -----------------------------------------------
|
||||||
echo -e "其他设备可以使用PAC配置连接:\033[4;32mhttp://$host:$db_port/ui/pac\033[0m"
|
echo -e "其他设备可以使用PAC配置连接:\033[4;32mhttp://$host:$db_port/ui/pac\033[0m"
|
||||||
@@ -168,7 +167,7 @@ startover(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
start_core(){
|
start_core(){
|
||||||
if [ "$crashcore" = singbox ];then
|
if [ "$crashcore" = singbox -o "$crashcore" = singboxp ];then
|
||||||
core_config=${CRASHDIR}/jsons/config.json
|
core_config=${CRASHDIR}/jsons/config.json
|
||||||
else
|
else
|
||||||
core_config=${CRASHDIR}/yamls/config.yaml
|
core_config=${CRASHDIR}/yamls/config.yaml
|
||||||
@@ -1229,7 +1228,7 @@ normal_set(){ #基础设置
|
|||||||
echo -----------------------------------------------
|
echo -----------------------------------------------
|
||||||
echo -e "\033[36m已设为 $dns_mod 模式!!\033[0m"
|
echo -e "\033[36m已设为 $dns_mod 模式!!\033[0m"
|
||||||
elif [ "$num" = 3 ]; then
|
elif [ "$num" = 3 ]; then
|
||||||
if [ "$crashcore" = singbox ];then
|
if [ "$crashcore" = singbox -o "$crashcore" = singboxp ];then
|
||||||
dns_mod=mix
|
dns_mod=mix
|
||||||
setconfig dns_mod $dns_mod
|
setconfig dns_mod $dns_mod
|
||||||
echo -----------------------------------------------
|
echo -----------------------------------------------
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ After=network.target
|
|||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=shellcrash
|
User=shellcrash
|
||||||
|
ExecStartPre=/etc/ShellCrash/start.sh bfstart
|
||||||
ExecStart=/etc/ShellCrash/CrashCore run -D /etc/ShellCrash -C /tmp/ShellCrash/jsons
|
ExecStart=/etc/ShellCrash/CrashCore run -D /etc/ShellCrash -C /tmp/ShellCrash/jsons
|
||||||
ExecStartPost=/etc/ShellCrash/start.sh afstart >/dev/null &
|
ExecStartPost=/etc/ShellCrash/start.sh afstart >/dev/null &
|
||||||
ExecStopPost=/etc/ShellCrash/start.sh stop_firewall ; /etc/ShellCrash/start.sh unset_proxy
|
ExecStopPost=/etc/ShellCrash/start.sh stop_firewall ; /etc/ShellCrash/start.sh unset_proxy
|
||||||
|
|||||||
139
scripts/start.sh
139
scripts/start.sh
@@ -33,7 +33,7 @@ getconfig(){ #获取脚本配置
|
|||||||
[ -z "$multiport" ] && multiport='22,53,80,123,143,194,443,465,587,853,993,995,5222,8080,8443'
|
[ -z "$multiport" ] && multiport='22,53,80,123,143,194,443,465,587,853,993,995,5222,8080,8443'
|
||||||
[ "$common_ports" = "已开启" ] && ports="-m multiport --dports $multiport"
|
[ "$common_ports" = "已开启" ] && ports="-m multiport --dports $multiport"
|
||||||
#内核配置文件
|
#内核配置文件
|
||||||
if [ "$crashcore" = singbox ];then
|
if [ "$crashcore" = singbox -o "$crashcore" = singboxp ];then
|
||||||
target=singbox
|
target=singbox
|
||||||
format=json
|
format=json
|
||||||
core_config=${CRASHDIR}/jsons/config.json
|
core_config=${CRASHDIR}/jsons/config.json
|
||||||
@@ -231,11 +231,6 @@ check_singbox_config(){ #检查singbox配置文件
|
|||||||
logger "获取到了配置文件【$core_config_new】,但似乎并不包含正确的节点信息!" 31
|
logger "获取到了配置文件【$core_config_new】,但似乎并不包含正确的节点信息!" 31
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
#检测SSR节点
|
|
||||||
if [ -n "$(cat $core_config_new | grep -oE '"shadowsocksr"')" ];then
|
|
||||||
echo -----------------------------------------------
|
|
||||||
logger "singbox主干已移除对SSR相关协议的支持,请使用clash系内核或者PuerNya分支!" 33
|
|
||||||
fi
|
|
||||||
#检测并去除无效策略组
|
#检测并去除无效策略组
|
||||||
[ -n "$url_type" ] && {
|
[ -n "$url_type" ] && {
|
||||||
#获得无效策略组名称
|
#获得无效策略组名称
|
||||||
@@ -310,7 +305,7 @@ get_core_config(){ #下载内核配置文件
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
Https=""
|
Https=""
|
||||||
[ "$crashcore" = singbox ] && check_singbox_config || check_clash_config
|
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] && check_singbox_config || check_clash_config
|
||||||
#如果不同则备份并替换文件
|
#如果不同则备份并替换文件
|
||||||
if [ -s $core_config ];then
|
if [ -s $core_config ];then
|
||||||
compare $core_config_new $core_config
|
compare $core_config_new $core_config
|
||||||
@@ -536,9 +531,8 @@ modify_json(){ #修饰singbox配置文件
|
|||||||
cat > ${TMPDIR}/jsons/log.json <<EOF
|
cat > ${TMPDIR}/jsons/log.json <<EOF
|
||||||
{ "log": { "level": "info", "timestamp": true } }
|
{ "log": { "level": "info", "timestamp": true } }
|
||||||
EOF
|
EOF
|
||||||
#生成dns.json
|
#生成add_hosts.json
|
||||||
if [ "$hosts_opt" != "未启用" ];then #本机hosts
|
if [ "$hosts_opt" != "未启用" ];then #本机hosts
|
||||||
reverse_mapping=true
|
|
||||||
sys_hosts=/etc/hosts
|
sys_hosts=/etc/hosts
|
||||||
[ -s /data/etc/custom_hosts ] && sys_hosts=/data/etc/custom_hosts
|
[ -s /data/etc/custom_hosts ] && sys_hosts=/data/etc/custom_hosts
|
||||||
#NTP劫持
|
#NTP劫持
|
||||||
@@ -548,20 +542,38 @@ EOF
|
|||||||
203.107.6.88 time.android.com
|
203.107.6.88 time.android.com
|
||||||
203.107.6.88 time.facebook.com
|
203.107.6.88 time.facebook.com
|
||||||
EOF
|
EOF
|
||||||
}
|
hosts_domain=$(cat $sys_hosts | grep -E "^([0-9]{1,3}[\.]){3}" | awk '{printf "\"%s\", ", $2}' | sed 's/, $//' )
|
||||||
else
|
cat > ${TMPDIR}/jsons/add_hosts.json <<EOF
|
||||||
reverse_mapping=false
|
|
||||||
fi
|
|
||||||
[ -z "$dns_nameserver" ] && dns_nameserver='223.5.5.5' || dns_nameserver=$(echo $dns_nameserver | awk -F ',' '{print $1}')
|
|
||||||
[ -z "$dns_fallback" ] && dns_fallback='1.0.0.1' || dns_fallback=$(echo $dns_fallback | awk -F ',' '{print $1}')
|
|
||||||
[ "$ipv6_dns" = "已开启" ] && strategy='prefer_ipv4' || strategy='ipv4_only'
|
|
||||||
[ "$dns_mod" = "redir_host" ] && proxy_dns=dns_proxy && direct_dns=dns_direct
|
|
||||||
[ "$dns_mod" = "fake-ip" ] && proxy_dns=dns_fakeip && direct_dns=dns_direct
|
|
||||||
[ "$dns_mod" = "mix" ] && proxy_dns=dns_fakeip && direct_dns=dns_direct
|
|
||||||
cat > ${TMPDIR}/jsons/dns.json <<EOF
|
|
||||||
{
|
{
|
||||||
"dns": {
|
"dns": {
|
||||||
"servers": [{
|
"servers": [{
|
||||||
|
"tag": "local",
|
||||||
|
"address": "local"
|
||||||
|
}],
|
||||||
|
"rules": [{
|
||||||
|
"domain": [$hosts_domain],
|
||||||
|
"server": "local"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
#生成dns.json
|
||||||
|
[ -z "$dns_nameserver" ] && dns_nameserver='223.5.5.5' || dns_nameserver=$(echo $dns_nameserver | awk -F ',' '{print $1}')
|
||||||
|
[ -z "$dns_fallback" ] && dns_fallback='1.0.0.1' || dns_fallback=$(echo $dns_fallback | awk -F ',' '{print $1}')
|
||||||
|
[ "$ipv6_dns" = "已开启" ] && strategy='prefer_ipv4' || strategy='ipv4_only'
|
||||||
|
[ "$dns_mod" = "redir_host" ] && final_dns=dns_direct
|
||||||
|
[ "$dns_mod" = "fake-ip" ] && final_dns=dns_fakeip
|
||||||
|
[ "$dns_mod" = "mix" ] && {
|
||||||
|
final_dns=dns_direct
|
||||||
|
mix_dns="{ \"geosite\": [\"geolocation-!cn\"], \"server\": \"dns_fakeip\" },"
|
||||||
|
}
|
||||||
|
cat > ${TMPDIR}/jsons/dns.json <<EOF
|
||||||
|
{
|
||||||
|
"dns": {
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
"tag": "dns_proxy",
|
"tag": "dns_proxy",
|
||||||
"address": "$dns_fallback",
|
"address": "$dns_fallback",
|
||||||
"strategy": "$strategy",
|
"strategy": "$strategy",
|
||||||
@@ -582,25 +594,31 @@ EOF
|
|||||||
}, {
|
}, {
|
||||||
"tag": "block",
|
"tag": "block",
|
||||||
"address": "rcode://success"
|
"address": "rcode://success"
|
||||||
}],
|
}
|
||||||
"rules": [{
|
],
|
||||||
"outbound": ["any"],
|
"rules": [
|
||||||
"server": "dns_resolver"
|
{ "outbound": ["any"], "server": "dns_resolver" },
|
||||||
}, {
|
{ "clash_mode": "Global", "server": "$final_dns" },
|
||||||
"geosite": ["cn"],
|
{ "clash_mode": "Direct", "server": "dns_direct" },
|
||||||
"query_type": [ "A", "AAAA" ],
|
$mix_dns
|
||||||
"server": "$direct_dns"
|
{ "query_type": [ "A", "AAAA" ], "server": "$final_dns" }
|
||||||
}, {
|
],
|
||||||
"geosite": ["geolocation-!cn"],
|
|
||||||
"query_type": [ "A", "AAAA" ],
|
|
||||||
"server": "$proxy_dns"
|
|
||||||
}],
|
|
||||||
"final": "dns_direct",
|
"final": "dns_direct",
|
||||||
"independent_cache": true,
|
"independent_cache": true,
|
||||||
"reverse_mapping": true,
|
"reverse_mapping": true,
|
||||||
"fakeip": { "enabled": true, "inet4_range": "198.18.0.0/16", "inet6_range": "fc00::/16" }
|
"fakeip": { "enabled": true, "inet4_range": "198.18.0.0/16", "inet6_range": "fc00::/16" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
EOF
|
||||||
|
#生成add_route.json
|
||||||
|
cat > ${TMPDIR}/jsons/add_route.json <<EOF
|
||||||
|
{
|
||||||
|
"route": {
|
||||||
|
"rules": [
|
||||||
|
{ "inbound": "dns-in", "outbound": "dns-out" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
EOF
|
EOF
|
||||||
#生成ntp.json
|
#生成ntp.json
|
||||||
cat > ${TMPDIR}/jsons/ntp.json <<EOF
|
cat > ${TMPDIR}/jsons/ntp.json <<EOF
|
||||||
@@ -684,16 +702,6 @@ EOF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
|
||||||
#生成add_route.json
|
|
||||||
cat > ${TMPDIR}/jsons/add_route.json <<EOF
|
|
||||||
{
|
|
||||||
"route": {
|
|
||||||
"rules": [
|
|
||||||
{ "inbound": "dns-in", "outbound": "dns-out" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOF
|
EOF
|
||||||
#生成自定义规则文件
|
#生成自定义规则文件
|
||||||
[ -s ${CRASHDIR}/yamls/rules.yaml ] && {
|
[ -s ${CRASHDIR}/yamls/rules.yaml ] && {
|
||||||
@@ -715,12 +723,13 @@ EOF
|
|||||||
| sed '1i\{ "route": { "rules": [ ' \
|
| sed '1i\{ "route": { "rules": [ ' \
|
||||||
| sed '$s/,$/ ] } }/' > ${TMPDIR}/jsons/cust_add_rules.json
|
| sed '$s/,$/ ] } }/' > ${TMPDIR}/jsons/cust_add_rules.json
|
||||||
}
|
}
|
||||||
#提取配置文件以获得outbounds.json及route.json
|
#提取配置文件以获得outbounds.json,outbound_providers.json及route.json
|
||||||
${TMPDIR}/CrashCore format -c $core_config > ${TMPDIR}/format.json
|
${TMPDIR}/CrashCore format -c $core_config > ${TMPDIR}/format.json
|
||||||
echo '{' > ${TMPDIR}/jsons/outbounds.json
|
echo '{' > ${TMPDIR}/jsons/outbounds.json
|
||||||
echo '{' > ${TMPDIR}/jsons/route.json
|
echo '{' > ${TMPDIR}/jsons/route.json
|
||||||
cat ${TMPDIR}/format.json | sed -n '/"outbounds":/,/"route":/{/"route":/d; p}' >> ${TMPDIR}/jsons/outbounds.json
|
cat ${TMPDIR}/format.json | sed -n '/"outbounds":/,/^ "[a-z]/{/^ "\(route\|outbound_providers\)/d; p}' >> ${TMPDIR}/jsons/outbounds.json
|
||||||
cat ${TMPDIR}/format.json | sed -n '/"route":/,/"experimental":/{/"experimental":/d; p}' >> ${TMPDIR}/jsons/route.json
|
[ "$crashcore" = "singboxp" ] && cat ${TMPDIR}/format.json | sed -n '/"outbound_providers":/,/^ "[a-z]/{/^ "route/d; p}' >> ${TMPDIR}/jsons/outbound_providers.json
|
||||||
|
cat ${TMPDIR}/format.json | sed -n '/"route":/,/^ "[a-z]/{/^ "experimental/d; p}' >> ${TMPDIR}/jsons/route.json
|
||||||
#清理route.json中的process_name规则以及"auto_detect_interface"
|
#清理route.json中的process_name规则以及"auto_detect_interface"
|
||||||
sed -i '/"process_name": \[/,/],$/d' ${TMPDIR}/jsons/route.json
|
sed -i '/"process_name": \[/,/],$/d' ${TMPDIR}/jsons/route.json
|
||||||
sed -i '/"process_name": "[^"]*",/d' ${TMPDIR}/jsons/route.json
|
sed -i '/"process_name": "[^"]*",/d' ${TMPDIR}/jsons/route.json
|
||||||
@@ -731,9 +740,10 @@ EOF
|
|||||||
else
|
else
|
||||||
sed -i 's/"insecure": true/"insecure": false/' ${TMPDIR}/jsons/outbounds.json
|
sed -i 's/"insecure": true/"insecure": false/' ${TMPDIR}/jsons/outbounds.json
|
||||||
fi
|
fi
|
||||||
#修饰outbounds&route.json结尾
|
#修饰outbounds&outbound_providers&route.json结尾
|
||||||
sed -i 's/^ ],$/ ] }/' ${TMPDIR}/jsons/outbounds.json
|
sed -i 's/^ ],$/ ] }/' ${TMPDIR}/jsons/outbounds.json
|
||||||
sed -i 's/^ },$/ } }/' ${TMPDIR}/jsons/route.json
|
sed -i 's/^ },$/ } }/' ${TMPDIR}/jsons/route.json
|
||||||
|
[ -s ${TMPDIR}/jsons/outbound_providers.json ] && sed -i 's/^ },$/ } }/' ${TMPDIR}/jsons/outbound_providers.json || rm -rf ${TMPDIR}/jsons/outbound_providers.json
|
||||||
#加载自定义配置文件
|
#加载自定义配置文件
|
||||||
mkdir -p ${TMPDIR}/jsons_base
|
mkdir -p ${TMPDIR}/jsons_base
|
||||||
for char in log dns ntp experimental;do
|
for char in log dns ntp experimental;do
|
||||||
@@ -762,6 +772,7 @@ EOF
|
|||||||
#清理缓存
|
#清理缓存
|
||||||
rm -rf ${TMPDIR}/*.json
|
rm -rf ${TMPDIR}/*.json
|
||||||
rm -rf ${TMPDIR}/jsons_base
|
rm -rf ${TMPDIR}/jsons_base
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#设置路由规则
|
#设置路由规则
|
||||||
@@ -833,7 +844,7 @@ start_redir(){ #iptables-redir
|
|||||||
iptables -t nat -A PREROUTING -p tcp $ports -j shellcrash
|
iptables -t nat -A PREROUTING -p tcp $ports -j shellcrash
|
||||||
[ "$dns_mod" != "redir_host" -a "$common_ports" = "已开启" ] && iptables -t nat -A PREROUTING -p tcp -d 198.18.0.0/16 -j shellcrash
|
[ "$dns_mod" != "redir_host" -a "$common_ports" = "已开启" ] && iptables -t nat -A PREROUTING -p tcp -d 198.18.0.0/16 -j shellcrash
|
||||||
#设置ipv6转发
|
#设置ipv6转发
|
||||||
if [ "$ipv6_redir" = "已开启" -a -n "$(lsmod | grep 'ip6table_nat')" ];then
|
if [ "$ipv6_redir" = "已开启" ] && ip6tables -t nat -L &>/dev/null;then
|
||||||
ip6tables -t nat -N shellcrashv6
|
ip6tables -t nat -N shellcrashv6
|
||||||
for ip in $reserve_ipv6 $host_ipv6;do #跳过目标保留地址及目标本机网段
|
for ip in $reserve_ipv6 $host_ipv6;do #跳过目标保留地址及目标本机网段
|
||||||
ip6tables -t nat -A shellcrashv6 -d $ip -j RETURN
|
ip6tables -t nat -A shellcrashv6 -d $ip -j RETURN
|
||||||
@@ -943,7 +954,7 @@ start_tproxy(){ #iptables-tproxy
|
|||||||
iptables -I INPUT -p udp --dport 443 -m comment --comment "ShellCrash-QUIC-REJECT" $set_cn_ip -j REJECT >/dev/null 2>&1
|
iptables -I INPUT -p udp --dport 443 -m comment --comment "ShellCrash-QUIC-REJECT" $set_cn_ip -j REJECT >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
#设置ipv6转发
|
#设置ipv6转发
|
||||||
[ "$ipv6_redir" = "已开启" ] && {
|
[ "$ipv6_redir" = "已开启" ] && ip6tables -t nat -L &>/dev/null && {
|
||||||
ip -6 rule add fwmark $fwmark table 101
|
ip -6 rule add fwmark $fwmark table 101
|
||||||
ip -6 route add local ::/0 dev lo table 101
|
ip -6 route add local ::/0 dev lo table 101
|
||||||
ip6tables -t mangle -N shellcrashv6
|
ip6tables -t mangle -N shellcrashv6
|
||||||
@@ -1072,7 +1083,7 @@ start_tun(){ #iptables-tun
|
|||||||
[ "$1" = "all" ] && iptables -t mangle -A PREROUTING -p tcp $ports -j shellcrash
|
[ "$1" = "all" ] && iptables -t mangle -A PREROUTING -p tcp $ports -j shellcrash
|
||||||
|
|
||||||
#设置ipv6转发
|
#设置ipv6转发
|
||||||
[ "$ipv6_redir" = "已开启" ] && [ "$crashcore" = "singbox" -o "$crashcore" = "meta" ] && {
|
[ "$ipv6_redir" = "已开启" ] && ip6tables -t nat -L &>/dev/null && [ "$crashcore" != clash ] && {
|
||||||
ip -6 route add default dev utun table 101
|
ip -6 route add default dev utun table 101
|
||||||
ip -6 rule add fwmark $fwmark table 101
|
ip -6 rule add fwmark $fwmark table 101
|
||||||
ip6tables -t mangle -N shellcrashv6
|
ip6tables -t mangle -N shellcrashv6
|
||||||
@@ -1459,7 +1470,7 @@ core_check(){
|
|||||||
mv -f ${TMPDIR}/core_new/$file ${TMPDIR}/CrashCore
|
mv -f ${TMPDIR}/core_new/$file ${TMPDIR}/CrashCore
|
||||||
done
|
done
|
||||||
rm -rf ${TMPDIR}/core_new
|
rm -rf ${TMPDIR}/core_new
|
||||||
if [ "$crashcore" = singbox ];then
|
if [ "$crashcore" = singbox -o "$crashcore" = singboxp ];then
|
||||||
core_v=$(${TMPDIR}/CrashCore version 2>/dev/null | grep version | awk '{print $3}')
|
core_v=$(${TMPDIR}/CrashCore version 2>/dev/null | grep version | awk '{print $3}')
|
||||||
COMMAND='"$TMPDIR/CrashCore run -D $BINDIR -C $TMPDIR/jsons"'
|
COMMAND='"$TMPDIR/CrashCore run -D $BINDIR -C $TMPDIR/jsons"'
|
||||||
else
|
else
|
||||||
@@ -1479,8 +1490,8 @@ core_check(){
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ ! -x ${TMPDIR}/CrashCore ] && chmod +x ${TMPDIR}/CrashCore 2>/dev/null #自动授权
|
[ ! -x ${TMPDIR}/CrashCore ] && chmod +x ${TMPDIR}/CrashCore 2>/dev/null #自动授权
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
clash_check(){ #clash启动前检查
|
clash_check(){ #clash启动前检查
|
||||||
#检测vless/hysteria协议
|
#检测vless/hysteria协议
|
||||||
@@ -1511,7 +1522,7 @@ clash_check(){ #clash启动前检查
|
|||||||
#预下载GeoIP数据库
|
#预下载GeoIP数据库
|
||||||
if [ ! -f ${BINDIR}/Country.mmdb ];then
|
if [ ! -f ${BINDIR}/Country.mmdb ];then
|
||||||
if [ -f ${CRASHDIR}/Country.mmdb ];then
|
if [ -f ${CRASHDIR}/Country.mmdb ];then
|
||||||
mv ${CRASHDIR}/Country.mmdb ${BINDIR}/Country.mmdb
|
ln -sf ${CRASHDIR}/Country.mmdb ${BINDIR}/Country.mmdb
|
||||||
else
|
else
|
||||||
logger "未找到GeoIP数据库,正在下载!" 33
|
logger "未找到GeoIP数据库,正在下载!" 33
|
||||||
get_bin ${BINDIR}/Country.mmdb bin/geodata/cn_mini.mmdb
|
get_bin ${BINDIR}/Country.mmdb bin/geodata/cn_mini.mmdb
|
||||||
@@ -1523,7 +1534,7 @@ clash_check(){ #clash启动前检查
|
|||||||
#预下载GeoSite数据库
|
#预下载GeoSite数据库
|
||||||
if [ -n "$(cat $core_config|grep -Ei 'geosite')" ] && [ ! -f ${BINDIR}/GeoSite.dat ];then
|
if [ -n "$(cat $core_config|grep -Ei 'geosite')" ] && [ ! -f ${BINDIR}/GeoSite.dat ];then
|
||||||
if [ -f ${CRASHDIR}/GeoSite.dat ];then
|
if [ -f ${CRASHDIR}/GeoSite.dat ];then
|
||||||
mv -f ${CRASHDIR}/GeoSite.dat ${BINDIR}/GeoSite.dat
|
ln -sf ${CRASHDIR}/GeoSite.dat ${BINDIR}/GeoSite.dat
|
||||||
else
|
else
|
||||||
logger "未找到GeoSite数据库,正在下载!" 33
|
logger "未找到GeoSite数据库,正在下载!" 33
|
||||||
get_bin ${BINDIR}/GeoSite.dat bin/geodata/geosite.dat
|
get_bin ${BINDIR}/GeoSite.dat bin/geodata/geosite.dat
|
||||||
@@ -1533,11 +1544,20 @@ clash_check(){ #clash启动前检查
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
singbox_check(){ #singbox启动前检查
|
singbox_check(){ #singbox启动前检查
|
||||||
|
#检测PuerNya专属功能
|
||||||
|
if [ -n "$(cat ${CRASHDIR}/jsons/*.json | grep -oE 'shadowsocksr|providers')" ];then
|
||||||
|
echo -----------------------------------------------
|
||||||
|
logger "检测到PuerNya内核专属功能,改为使用singboxp内核启动!" 33
|
||||||
|
rm -rf ${TMPDIR}/CrashCore
|
||||||
|
rm -rf ${CRASHDIR}/CrashCore
|
||||||
|
rm -rf ${CRASHDIR}/core.tar.gz
|
||||||
|
crashcore=singboxp
|
||||||
|
fi
|
||||||
core_check
|
core_check
|
||||||
#预下载GeoIP数据库
|
#预下载GeoIP数据库
|
||||||
if [ ! -f ${BINDIR}/geoip.db ];then
|
if [ ! -f ${BINDIR}/geoip.db ];then
|
||||||
if [ -f ${CRASHDIR}/geoip.db ];then
|
if [ -f ${CRASHDIR}/geoip.db ];then
|
||||||
mv ${CRASHDIR}/geoip.db ${BINDIR}/geoip.db
|
ln -sf ${CRASHDIR}/geoip.db ${BINDIR}/geoip.db
|
||||||
else
|
else
|
||||||
logger "未找到GeoIP数据库,正在下载!" 33
|
logger "未找到GeoIP数据库,正在下载!" 33
|
||||||
get_bin ${BINDIR}/geoip.db bin/geodata/geoip_cn.db
|
get_bin ${BINDIR}/geoip.db bin/geodata/geoip_cn.db
|
||||||
@@ -1547,9 +1567,9 @@ singbox_check(){ #singbox启动前检查
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
#预下载GeoSite数据库
|
#预下载GeoSite数据库
|
||||||
if [ -n "$(cat $core_config|grep -Ei '"geosite":')" ] && [ ! -f ${BINDIR}/geosite.db ];then
|
if [ -n "cat ${CRASHDIR}/jsons/*.json | grep -Ei 'geosite')" -o "$dns_mod" = "mix" ] && [ ! -f ${BINDIR}/geosite.db ];then
|
||||||
if [ -f ${CRASHDIR}/geosite.db ];then
|
if [ -f ${CRASHDIR}/geosite.db ];then
|
||||||
mv -f ${CRASHDIR}/geosite.db ${BINDIR}/geosite.db
|
ln -sf ${CRASHDIR}/geosite.db ${BINDIR}/geosite.db
|
||||||
else
|
else
|
||||||
logger "未找到GeoSite数据库,正在下载!" 33
|
logger "未找到GeoSite数据库,正在下载!" 33
|
||||||
get_bin ${BINDIR}/geosite.db bin/geodata/geosite_cn.db
|
get_bin ${BINDIR}/geosite.db bin/geodata/geosite_cn.db
|
||||||
@@ -1587,7 +1607,7 @@ bfstart(){ #启动前
|
|||||||
catpac #生成pac文件
|
catpac #生成pac文件
|
||||||
#内核及内核配置文件检查
|
#内核及内核配置文件检查
|
||||||
[ ! -x ${TMPDIR}/CrashCore ] && chmod +x ${TMPDIR}/CrashCore 2>/dev/null #检测可执行权限
|
[ ! -x ${TMPDIR}/CrashCore ] && chmod +x ${TMPDIR}/CrashCore 2>/dev/null #检测可执行权限
|
||||||
if [ "$crashcore" = singbox ];then
|
if [ "$crashcore" = singbox -o "$crashcore" = singboxp ];then
|
||||||
singbox_check
|
singbox_check
|
||||||
[ -d ${TMPDIR}/jsons ] && rm -rf ${TMPDIR}/jsons/* || mkdir -p ${TMPDIR}/jsons #准备目录
|
[ -d ${TMPDIR}/jsons ] && rm -rf ${TMPDIR}/jsons/* || mkdir -p ${TMPDIR}/jsons #准备目录
|
||||||
[ "$disoverride" != "1" ] && modify_json || ln -sf $core_config ${TMPDIR}/jsons/config.json
|
[ "$disoverride" != "1" ] && modify_json || ln -sf $core_config ${TMPDIR}/jsons/config.json
|
||||||
@@ -1743,7 +1763,6 @@ start)
|
|||||||
elif [ -f /etc/rc.common -a "$(cat /proc/1/comm)" = "procd" ];then
|
elif [ -f /etc/rc.common -a "$(cat /proc/1/comm)" = "procd" ];then
|
||||||
/etc/init.d/shellcrash start
|
/etc/init.d/shellcrash start
|
||||||
elif [ "$USER" = "root" -a "$(cat /proc/1/comm)" = "systemd" ];then
|
elif [ "$USER" = "root" -a "$(cat /proc/1/comm)" = "systemd" ];then
|
||||||
bfstart
|
|
||||||
FragmentPath=$(systemctl show -p FragmentPath shellcrash | sed 's/FragmentPath=//')
|
FragmentPath=$(systemctl show -p FragmentPath shellcrash | sed 's/FragmentPath=//')
|
||||||
setconfig ExecStart "$COMMAND >/dev/null" "$FragmentPath"
|
setconfig ExecStart "$COMMAND >/dev/null" "$FragmentPath"
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
@@ -1786,7 +1805,7 @@ debug)
|
|||||||
stop_firewall >/dev/null #清理路由策略
|
stop_firewall >/dev/null #清理路由策略
|
||||||
bfstart
|
bfstart
|
||||||
[ -n "$2" ] && {
|
[ -n "$2" ] && {
|
||||||
if [ "$crashcore" = singbox ];then
|
if [ "$crashcore" = singbox -o "$crashcore" = singboxp ];then
|
||||||
sed -i "s/\"level\": \"info\"/\"level\": \"$2\"/" ${TMPDIR}/config.json
|
sed -i "s/\"level\": \"info\"/\"level\": \"$2\"/" ${TMPDIR}/config.json
|
||||||
else
|
else
|
||||||
sed -i "s/log-level: info/log-level: $2/" ${TMPDIR}/config.yaml
|
sed -i "s/log-level: info/log-level: $2/" ${TMPDIR}/config.yaml
|
||||||
|
|||||||
Reference in New Issue
Block a user