~修复procd启动本机代理回环的bug
This commit is contained in:
juewuy
2024-01-24 17:46:38 +08:00
parent 5c8cfd7b71
commit 85f01c987a
8 changed files with 8 additions and 8 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -5,4 +5,4 @@ meta_v=v1.18.0
singbox_v=1.7.8
GeoIP_v=20240120
versionsh=1.8.8d
versionsh=1.8.8e

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Copyright (C) Juewuy
version=1.8.8d
version=1.8.8e
setdir(){
dir_avail(){

View File

@@ -1371,7 +1371,6 @@ normal_set(){ #基础设置
local_proxy=未开启
setconfig local_proxy $local_proxy
setconfig local_type
[ -w /etc/init.d/shellcrash ] && sed -i 's/procd_set_param user shellcrash/procd_set_param user root/' /etc/init.d/shellcrash
echo -e "\033[33m已经停用本机代理规则,请尽快重启服务!!\033[0m"
fi
sleep 1

View File

@@ -13,10 +13,12 @@ source ${CRASHDIR}/configs/command.env #加载启动命令和启动目录
start_service() {
#检测必须文件
$CRASHDIR/start.sh bfstart
#本机代理用户
[ -n "$(grep -E 'local_type.*增强模式' ${CRASHDIR}/configs/ShellCrash.cfg)" ] && USER=shellcrash || USER=root
if [ "$?" = "0" ];then
#使用procd创建clash后台进程
procd_open_instance
procd_set_param user root
procd_set_param user $USER
procd_set_param respawn
procd_set_param command $COMMAND
procd_set_param stderr 0

View File

@@ -163,12 +163,13 @@ mark_time(){ #时间戳
}
getlanip(){ #获取局域网host地址
i=1
while [ "$i" -le "10" ];do
while [ "$i" -le "20" ];do
host_ipv4=$(ip a 2>&1 | grep -w 'inet' | grep 'global' | grep 'br' | grep -Ev 'iot' | grep -E ' 1(92|0|72)\.' | sed 's/.*inet.//g' | sed 's/br.*$//g' | sed 's/metric.*$//g' ) #ipv4局域网网段
[ "$ipv6_redir" = "已开启" ] && host_ipv6=$(ip a 2>&1 | grep -w 'inet6' | grep -E 'global' | sed 's/.*inet6.//g' | sed 's/scope.*$//g' ) #ipv6公网地址段
[ -f ${TMPDIR}/ShellCrash.log ] && break
[ -n "$host_ipv4" -a "$ipv6_redir" != "已开启" ] && break
[ -n "$host_ipv4" -a -n "$host_ipv6" ] && break
sleep 2 && i=$((i+1))
sleep 1 && i=$((i+1))
done
#添加自定义ipv4局域网网段
host_ipv4="$host_ipv4$cust_host_ipv4"
@@ -1548,8 +1549,6 @@ bfstart(){ #启动前
echo "shellcrash:x:0:7890:::" >> /etc/passwd
fi
fi
#修改procd启动文件
[ "$start_old" != "已开启" -a -w /etc/init.d/shellcrash ] && sed -i 's/procd_set_param user root/procd_set_param user shellcrash/' /etc/init.d/shellcrash
fi
#清理debug日志
rm -rf ${TMPDIR}/debug.log