mirror of
https://github.com/juewuy/ShellCrash.git
synced 2024-11-16 03:32:34 +08:00
4b98c2a4fd
~优化本地证书及ssl校验机制 ~优化启动逻辑 ~优化解压提示 ~适配singbox内核rule-set功能,增加cn相关数据库下载逻辑 ~singbox内核dns模块重写,mix模式改为使用rule-set分流 ~dns模块适配singboxp内核多路并发功能 ~增加一键清理数据库文件功能 ~修复切换版本时未能同步切换安装源的问题 ~修复设备找不到tun模块依然启动相关防火墙规则的bug ~修复启动时自动下载数据库时未能正确记录版本号的bug
36 lines
960 B
Bash
36 lines
960 B
Bash
#!/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() {
|
|
#本机代理用户
|
|
[ -n "$(grep -E 'local_type.*增强模式' ${CRASHDIR}/configs/ShellCrash.cfg)" ] && USER=shellcrash || USER=root
|
|
#检测必须文件
|
|
$CRASHDIR/start.sh bfstart
|
|
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
|
|
}
|