mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-03-12 16:31:25 +00:00
Compare commits
37 Commits
1.9.4beta3
...
1.9.4rc2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48705a0dd9 | ||
|
|
4a2a982c8d | ||
|
|
6e41971725 | ||
|
|
bbe711b1ce | ||
|
|
ee523035a6 | ||
|
|
847010399d | ||
|
|
b9a29a69a7 | ||
|
|
a0901b8083 | ||
|
|
399928f6ea | ||
|
|
13b291ccc7 | ||
|
|
2b3720b8f3 | ||
|
|
6d904eb297 | ||
|
|
d2d25a60eb | ||
|
|
5e58823cee | ||
|
|
d00f558ae2 | ||
|
|
acff8898a2 | ||
|
|
019ab1bd07 | ||
|
|
3ae53623d7 | ||
|
|
d98501fe66 | ||
|
|
828d70e4f8 | ||
|
|
0014c5c32a | ||
|
|
961aeb5bb1 | ||
|
|
daee138365 | ||
|
|
9029a2ce82 | ||
|
|
213eccc436 | ||
|
|
acf34714cc | ||
|
|
56cb4a327f | ||
|
|
f7f39af5e3 | ||
|
|
f9be142dfa | ||
|
|
de7b57330e | ||
|
|
4f9ffbb7d7 | ||
|
|
100dee42be | ||
|
|
98a610eb58 | ||
|
|
02129b3109 | ||
|
|
023e0caeb9 | ||
|
|
c816d97893 | ||
|
|
48c60b8ea0 |
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
|||||||
meta_v=v1.19.17
|
meta_v=v1.19.17
|
||||||
singboxr_v=1.13.0-alpha.27
|
singboxr_v=1.13.0-alpha.27
|
||||||
versionsh=1.9.4beta3.1
|
versionsh=1.9.4rc1.3
|
||||||
GeoIP_v=20251205
|
GeoIP_v=20251205
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ if [ "$systype" = "mi_snapshot" -o "$systype" = "ng_snapshot" ]; then
|
|||||||
chmod 755 "$CRASHDIR"/starts/snapshot_init.sh
|
chmod 755 "$CRASHDIR"/starts/snapshot_init.sh
|
||||||
if [ "$systype" = "mi_snapshot" ];then
|
if [ "$systype" = "mi_snapshot" ];then
|
||||||
path="/data/shellcrash_init.sh"
|
path="/data/shellcrash_init.sh"
|
||||||
setconfig CRASHDIR "$CRASHDIR" "$CRASHDIR"/starts/snapshot_init.sh
|
sed -i "s#^CRASHDIR=.*#CRASHDIR=$CRASHDIR#" "$CRASHDIR"/starts/snapshot_init.sh
|
||||||
mv -f "$CRASHDIR"/starts/snapshot_init.sh "$path"
|
mv -f "$CRASHDIR"/starts/snapshot_init.sh "$path"
|
||||||
[ ! -f /data/auto_start.sh ] && echo '#用于自定义需要开机启动的功能或者命令,会在开机后自动运行' > /data/auto_start.sh
|
[ ! -f /data/auto_start.sh ] && echo '#用于自定义需要开机启动的功能或者命令,会在开机后自动运行' > /data/auto_start.sh
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -23,7 +23,9 @@ core_unzip() { #$1:需要解压的文件 $2:目标文件名
|
|||||||
}
|
}
|
||||||
core_find(){
|
core_find(){
|
||||||
if [ ! -f "$TMPDIR"/CrashCore ];then
|
if [ ! -f "$TMPDIR"/CrashCore ];then
|
||||||
core_dir=$(find "$BINDIR"/CrashCore.* $find_para 2>/dev/null)
|
[ -n "$(find "$CRASHDIR"/CrashCore.* $find_para 2>/dev/null)" ] &&
|
||||||
|
mv -f "$CRASHDIR"/CrashCore.* "$BINDIR"/
|
||||||
|
core_dir=$(find "$BINDIR"/CrashCore.* $find_para 2>/dev/null | head -n 1)
|
||||||
[ -n "$core_dir" ] && core_unzip "$core_dir" CrashCore
|
[ -n "$core_dir" ] && core_unzip "$core_dir" CrashCore
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -40,17 +42,16 @@ core_check(){
|
|||||||
COMMAND='"$TMPDIR/CrashCore -d $BINDIR -f $TMPDIR/config.yaml"'
|
COMMAND='"$TMPDIR/CrashCore -d $BINDIR -f $TMPDIR/config.yaml"'
|
||||||
fi
|
fi
|
||||||
if [ -z "$v" ]; then
|
if [ -z "$v" ]; then
|
||||||
rm -rf "$TMPDIR"/core_new
|
rm -rf "$1" "$TMPDIR"/core_new
|
||||||
rm -rf "$1"
|
|
||||||
return 2
|
return 2
|
||||||
else
|
else
|
||||||
rm -f "$BINDIR"/CrashCore.tar.gz "$BINDIR"/CrashCore.gz "$BINDIR"/CrashCore.upx
|
rm -f "$BINDIR"/CrashCore.tar.gz "$BINDIR"/CrashCore.gz "$BINDIR"/CrashCore.upx
|
||||||
mv -f "$TMPDIR"/core_new "$TMPDIR"/CrashCore
|
if [ -z "$zip_type" ];then
|
||||||
if [ -f "$1" ];then
|
gzip -c "$TMPDIR/core_new" > "$BINDIR/CrashCore.gz"
|
||||||
mv -f "$1" "$BINDIR/CrashCore.${zip_type}"
|
|
||||||
else
|
else
|
||||||
gzip -c "$TMPDIR"/CrashCore > "$BINDIR"/CrashCore.gz
|
mv -f "$1" "$BINDIR/CrashCore.$zip_type"
|
||||||
fi
|
fi
|
||||||
|
mv -f "$TMPDIR/core_new" "$TMPDIR/CrashCore"
|
||||||
core_v="$v"
|
core_v="$v"
|
||||||
setconfig COMMAND "$COMMAND" "$CRASHDIR"/configs/command.env && . "$CRASHDIR"/configs/command.env
|
setconfig COMMAND "$COMMAND" "$CRASHDIR"/configs/command.env && . "$CRASHDIR"/configs/command.env
|
||||||
setconfig crashcore "$crashcore"
|
setconfig crashcore "$crashcore"
|
||||||
@@ -64,17 +65,17 @@ core_webget(){
|
|||||||
. "$CRASHDIR"/libs/check_target.sh
|
. "$CRASHDIR"/libs/check_target.sh
|
||||||
if [ -z "$custcorelink" ];then
|
if [ -z "$custcorelink" ];then
|
||||||
[ -z "$zip_type" ] && zip_type='tar.gz'
|
[ -z "$zip_type" ] && zip_type='tar.gz'
|
||||||
get_bin "$TMPDIR/CrashCore.${zip_type}" "bin/$crashcore/${target}-linux-${cpucore}.${zip_type}"
|
get_bin "$TMPDIR/Coretmp.$zip_type" "bin/$crashcore/${target}-linux-${cpucore}.$zip_type"
|
||||||
else
|
else
|
||||||
zip_type=$(echo "$custcorelink" | grep -oE 'tar.gz$')
|
zip_type=$(echo "$custcorelink" | grep -oE 'tar.gz$')
|
||||||
[ -z "$zip_type" ] && zip_type=$(echo "$custcorelink" | grep -oE 'gz$')
|
[ -z "$zip_type" ] && zip_type=$(echo "$custcorelink" | grep -oE 'gz$')
|
||||||
[ -n "$zip_type" ] && webget "$TMPDIR/CrashCore.${zip_type}" "$custcorelink"
|
[ -n "$zip_type" ] && webget "$TMPDIR/Coretmp.$zip_type" "$custcorelink"
|
||||||
fi
|
fi
|
||||||
#校验内核
|
#校验内核
|
||||||
if [ "$?" = 0 ];then
|
if [ "$?" = 0 ];then
|
||||||
core_check "$TMPDIR/CrashCore.${zip_type}"
|
core_check "$TMPDIR/Coretmp.$zip_type"
|
||||||
else
|
else
|
||||||
rm -rf "$TMPDIR/CrashCore.${zip_type}"
|
rm -rf "$TMPDIR/Coretmp.$zip_type"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
|
||||||
|
# 检查配置文件
|
||||||
|
[ -f "$CRASHDIR"/configs/ShellCrash.cfg ] || . "$CRASHDIR"/init.sh >/dev/null 2>&1
|
||||||
. "$CRASHDIR"/configs/command.env >/dev/null 2>&1
|
. "$CRASHDIR"/configs/command.env >/dev/null 2>&1
|
||||||
. "$CRASHDIR"/configs/ShellCrash.cfg
|
. "$CRASHDIR"/configs/ShellCrash.cfg
|
||||||
|
|
||||||
@@ -13,10 +16,7 @@ routing_mark=$((fwmark + 2))
|
|||||||
|
|
||||||
[ -z "$dns_nameserver" ] && {
|
[ -z "$dns_nameserver" ] && {
|
||||||
dns_nameserver='223.5.5.5, 1.2.4.8'
|
dns_nameserver='223.5.5.5, 1.2.4.8'
|
||||||
cat /proc/net/udp | grep -q '0035' && dns_nameserver='localhost'
|
cat /proc/net/udp | grep -q '0035' && dns_nameserver='127.0.0.1'
|
||||||
}
|
}
|
||||||
[ -z "$dns_fallback" ] && dns_fallback="1.1.1.1, 8.8.8.8"
|
[ -z "$dns_fallback" ] && dns_fallback="1.1.1.1, 8.8.8.8"
|
||||||
[ -z "$dns_resolver" ] && {
|
[ -z "$dns_resolver" ] && dns_resolver="223.5.5.5, 2400:3200::1"
|
||||||
dns_resolver="223.5.5.5, 2400:3200::1"
|
|
||||||
cat /proc/net/udp | grep -q '0035' && dns_resolver='127.0.0.1'
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
#$1日志内容$2显示颜色$3是否推送
|
#$1日志内容$2显示颜色$3是否推送
|
||||||
logger() {
|
logger() {
|
||||||
TMPDIR=/tmp/ShellCrash
|
TMPDIR=/tmp/ShellCrash
|
||||||
[ -n "$2" -a "$2" != 0 ] && echo -e "\033[$2m$1\033[0m"
|
[ -n "$2" -a "$2" != 0 ] && printf "\033[%sm%s\033[0m\n" "$2" "$1"
|
||||||
log_text="$(date "+%G-%m-%d_%H:%M:%S")~$1"
|
log_text="$(date "+%G-%m-%d_%H:%M:%S")~$1"
|
||||||
echo "$log_text" >>"$TMPDIR"/ShellCrash.log
|
echo "$log_text" >>"$TMPDIR"/ShellCrash.log
|
||||||
[ "$(wc -l "$TMPDIR"/ShellCrash.log | awk '{print $1}')" -gt 99 ] && sed -i '1,50d' "$TMPDIR"/ShellCrash.log
|
[ "$(wc -l "$TMPDIR"/ShellCrash.log | awk '{print $1}')" -gt 199 ] && sed -i '1,20d' "$TMPDIR"/ShellCrash.log
|
||||||
#推送远程日志
|
#推送远程日志
|
||||||
[ -z "$3" ] && {
|
[ -z "$3" ] && {
|
||||||
[ -n "$device_name" ] && log_text="$log_text($device_name)"
|
[ -n "$device_name" ] && log_text="$log_text($device_name)"
|
||||||
@@ -18,7 +18,7 @@ logger() {
|
|||||||
}
|
}
|
||||||
[ -n "$push_bark" ] && {
|
[ -n "$push_bark" ] && {
|
||||||
url="${push_bark}"
|
url="${push_bark}"
|
||||||
content="{\"body\":\"${log_text}\",\"title\":\"ShellCrash日志推送\",\"level\":\"passive\",\"badge\":\"1\"}"
|
content="{\"body\":\"${log_text}\",\"title\":\"ShellCrash_log\",\"level\":\"passive\",\"badge\":\"1\"}"
|
||||||
web_json_post "$url" "$content" &
|
web_json_post "$url" "$content" &
|
||||||
}
|
}
|
||||||
[ -n "$push_Deer" ] && {
|
[ -n "$push_Deer" ] && {
|
||||||
@@ -28,17 +28,17 @@ logger() {
|
|||||||
}
|
}
|
||||||
[ -n "$push_Po" ] && {
|
[ -n "$push_Po" ] && {
|
||||||
url="https://api.pushover.net/1/messages.json"
|
url="https://api.pushover.net/1/messages.json"
|
||||||
content="{\"token\":\"${push_Po}\",\"user\":\"${push_Po_key}\",\"title\":\"ShellCrash日志推送\",\"message\":\"$log_text\"}"
|
content="{\"token\":\"${push_Po}\",\"user\":\"${push_Po_key}\",\"title\":\"ShellCrash_log\",\"message\":\"$log_text\"}"
|
||||||
web_json_post "$url" "$content" &
|
web_json_post "$url" "$content" &
|
||||||
}
|
}
|
||||||
[ -n "$push_PP" ] && {
|
[ -n "$push_PP" ] && {
|
||||||
url="http://www.pushplus.plus/send"
|
url="http://www.pushplus.plus/send"
|
||||||
content="{\"token\":\"${push_PP}\",\"title\":\"ShellCrash日志推送\",\"content\":\"$log_text\"}"
|
content="{\"token\":\"${push_PP}\",\"title\":\"ShellCrash_log\",\"content\":\"$log_text\"}"
|
||||||
web_json_post "$url" "$content" &
|
web_json_post "$url" "$content" &
|
||||||
}
|
}
|
||||||
[ -n "$push_Gotify" ] && {
|
[ -n "$push_Gotify" ] && {
|
||||||
url="${push_Gotify}"
|
url="${push_Gotify}"
|
||||||
content="{\"title\":\"ShellCrash日志推送\",\"message\":\"$log_text\",\"priority\":5}"
|
content="{\"title\":\"ShellCrash_log\",\"message\":\"$log_text\",\"priority\":5}"
|
||||||
web_json_post "$url" "$content" &
|
web_json_post "$url" "$content" &
|
||||||
}
|
}
|
||||||
[ -n "$push_SynoChat" ] && {
|
[ -n "$push_SynoChat" ] && {
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
#参数1代表变量名,参数2代表变量值,参数3即文件路径
|
#参数1代表变量名,参数2代表变量值,参数3即文件路径
|
||||||
setconfig() {
|
setconfig() {
|
||||||
[ -z "$3" ] && configpath="$CRASHDIR"/configs/ShellCrash.cfg || configpath="${3}"
|
[ -z "$3" ] && configpath="$CRASHDIR"/configs/ShellCrash.cfg || configpath="${3}"
|
||||||
if grep -q "^${1}=" "$configpath"; then
|
sed -i "/^${1}=.*/d" "$configpath"
|
||||||
sed -i "s#^${1}=.*#${1}=${2}#g" "$configpath"
|
printf '%s=%s\n' "$1" "$2" >>"$configpath"
|
||||||
else
|
|
||||||
printf '%s=%s\n' "$1" "$2" >>"$configpath"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ webget(){
|
|||||||
wget -Y off $progress -O "$1" "$2"
|
wget -Y off $progress -O "$1" "$2"
|
||||||
return $?
|
return $?
|
||||||
else
|
else
|
||||||
echo "找不到可用下载工具!!!请安装Curl或Wget!!!"
|
echo "No Curl or Wget!!!"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,7 @@ web_save() { #最小化保存面板节点选择
|
|||||||
. "$CRASHDIR"/libs/compare.sh && compare "$TMPDIR/$file" "$CRASHDIR/configs/$file"
|
. "$CRASHDIR"/libs/compare.sh && compare "$TMPDIR/$file" "$CRASHDIR/configs/$file"
|
||||||
[ "$?" = 0 ] && rm -f "$TMPDIR/$file" || mv -f "$TMPDIR/$file" "$CRASHDIR/configs/$file"
|
[ "$?" = 0 ] && rm -f "$TMPDIR/$file" || mv -f "$TMPDIR/$file" "$CRASHDIR/configs/$file"
|
||||||
else
|
else
|
||||||
rm -f "$CRASHDIR/configs/$file" #空文件时移除旧文件
|
> "$CRASHDIR/configs/$file" #空文件时移除旧文件
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,12 +44,6 @@ checkport() { #检查端口冲突
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
ckstatus() { #脚本启动前检查
|
ckstatus() { #脚本启动前检查
|
||||||
#检查脚本配置文件
|
|
||||||
if [ -f "$CFG_PATH" ]; then
|
|
||||||
[ -n "$(awk 'a[$0]++' $CFG_PATH)" ] && awk '!a[$0]++' "$CFG_PATH" >"$CFG_PATH" #检查重复行并去除
|
|
||||||
else
|
|
||||||
. "$CRASHDIR"/init.sh >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
versionsh=$(cat "$CRASHDIR"/version)
|
versionsh=$(cat "$CRASHDIR"/version)
|
||||||
[ -n "$versionsh" ] && versionsh_l=$versionsh
|
[ -n "$versionsh" ] && versionsh_l=$versionsh
|
||||||
[ -z "$redir_mod" ] && redir_mod=纯净模式
|
[ -z "$redir_mod" ] && redir_mod=纯净模式
|
||||||
@@ -100,13 +94,14 @@ ckstatus() { #脚本启动前检查
|
|||||||
echo "-----------------------------------------------"
|
echo "-----------------------------------------------"
|
||||||
#检查新手引导
|
#检查新手引导
|
||||||
if [ -z "$userguide" ]; then
|
if [ -z "$userguide" ]; then
|
||||||
|
userguide=1
|
||||||
setconfig userguide 1
|
setconfig userguide 1
|
||||||
. "$CRASHDIR"/menus/8_tools.sh && userguide
|
. "$CRASHDIR"/menus/8_tools.sh && userguide
|
||||||
fi
|
fi
|
||||||
#检查执行权限
|
#检查执行权限
|
||||||
[ ! -x "$CRASHDIR"/start.sh ] && chmod +x "$CRASHDIR"/start.sh
|
[ ! -x "$CRASHDIR"/start.sh ] && chmod +x "$CRASHDIR"/start.sh
|
||||||
#检查/tmp内核文件
|
#检查/tmp内核文件
|
||||||
for file in $(ls /tmp | grep -v [/$] | grep -v ' ' | grep -Ev ".*(zip|7z|tar)$" | grep -iE 'CrashCore|^clash$|^clash-linux.*|^mihomo.*|^sing.*box|meta.*'); do
|
for file in $(ls /tmp | grep -v [/$] | grep -v ' ' | grep -Ev ".*(zip|7z|tar)$" | grep -iE 'CrashCore|^clash$|^clash-linux.*|^mihomo.*|^sing.*box'); do
|
||||||
echo -e "发现可用的内核文件: \033[36m/tmp/$file\033[0m "
|
echo -e "发现可用的内核文件: \033[36m/tmp/$file\033[0m "
|
||||||
read -p "是否加载(会停止当前服务)?(1/0) > " res
|
read -p "是否加载(会停止当前服务)?(1/0) > " res
|
||||||
[ "$res" = 1 ] && {
|
[ "$res" = 1 ] && {
|
||||||
@@ -240,18 +235,24 @@ case "$1" in
|
|||||||
main_menu
|
main_menu
|
||||||
;;
|
;;
|
||||||
-t)
|
-t)
|
||||||
shtype=sh && [ -n "$(ls -l /bin/sh | grep -o dash)" ] && shtype=bash
|
shtype=sh
|
||||||
|
ckcmd bash && shtype=bash
|
||||||
$shtype -x "$CRASHDIR"/menu.sh
|
$shtype -x "$CRASHDIR"/menu.sh
|
||||||
;;
|
;;
|
||||||
-s)
|
-s)
|
||||||
"$CRASHDIR"/start.sh $2 $3 $4 $5 $6
|
"$CRASHDIR"/start.sh "$2" "$3" "$4" "$5" "$6"
|
||||||
;;
|
;;
|
||||||
-i)
|
-i)
|
||||||
. "$CRASHDIR"/init.sh 2>/dev/null
|
. "$CRASHDIR"/init.sh 2>/dev/null
|
||||||
;;
|
;;
|
||||||
-st)
|
-st)
|
||||||
shtype=sh && [ -n "$(ls -l /bin/sh | grep -o dash)" ] && shtype=bash
|
shtype=sh
|
||||||
$shtype -x "$CRASHDIR"/start.sh $2 $3 $4 $5 $6
|
ckcmd bash && shtype=bash
|
||||||
|
"$shtype" -x "$CRASHDIR"/starts/bfstart.sh
|
||||||
|
. "$CRASHDIR"/starts/start_legacy.sh
|
||||||
|
start_legacy "$COMMAND" 'shellcrash'
|
||||||
|
"$shtype" -x "$CRASHDIR"/starts/afstart.sh
|
||||||
|
"$CRASHDIR"/start.sh stop
|
||||||
;;
|
;;
|
||||||
-d)
|
-d)
|
||||||
shtype=sh && [ -n "$(ls -l /bin/sh | grep -o dash)" ] && shtype=bash
|
shtype=sh && [ -n "$(ls -l /bin/sh | grep -o dash)" ] && shtype=bash
|
||||||
|
|||||||
@@ -515,7 +515,7 @@ EOF
|
|||||||
sed -i '$s/},/}]}/' "$TMPDIR"/providers/outbounds_add.json
|
sed -i '$s/},/}]}/' "$TMPDIR"/providers/outbounds_add.json
|
||||||
sed -i '$s/},/}]}/' "$TMPDIR"/providers/providers.json
|
sed -i '$s/},/}]}/' "$TMPDIR"/providers/providers.json
|
||||||
#使用模版生成outbounds和rules模块
|
#使用模版生成outbounds和rules模块
|
||||||
cat "$TMPDIR"/provider_temp_file | sed "s/{providers_tags}/$providers_tags/g" > "$TMPDIR"/providers/outbounds.json
|
cat "$TMPDIR"/provider_temp_file | sed "s/{providers_tags}/$providers_tags/g" | sed "s/\"providers_tags\"/$providers_tags/g" > "$TMPDIR"/providers/outbounds.json
|
||||||
rm -rf "$TMPDIR"/provider_temp_file
|
rm -rf "$TMPDIR"/provider_temp_file
|
||||||
#调用内核测试
|
#调用内核测试
|
||||||
. "$CRASHDIR"/starts/check_core.sh && check_core && "$TMPDIR"/CrashCore merge "$TMPDIR"/config.json -C "$TMPDIR"/providers
|
. "$CRASHDIR"/starts/check_core.sh && check_core && "$TMPDIR"/CrashCore merge "$TMPDIR"/config.json -C "$TMPDIR"/providers
|
||||||
|
|||||||
@@ -155,13 +155,13 @@ set_bot_tg_config(){
|
|||||||
JSON=$(cat <<EOF
|
JSON=$(cat <<EOF
|
||||||
{
|
{
|
||||||
"commands": [
|
"commands": [
|
||||||
{"command": "crash", "description": "呼出ShellCrash菜单"},
|
{"command": "$my_alias", "description": "呼出ShellCrash菜单"},
|
||||||
{"command": "help", "description": "查看帮助"}
|
{"command": "help", "description": "查看帮助"}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
TEXT='已完成Telegram机器人设置!'
|
TEXT="已完成Telegram机器人设置!请使用 /$my_alias 呼出功能菜单!"
|
||||||
. "$CRASHDIR"/libs/web_json.sh
|
. "$CRASHDIR"/libs/web_json.sh
|
||||||
bot_api="https://api.telegram.org/bot$TOKEN"
|
bot_api="https://api.telegram.org/bot$TOKEN"
|
||||||
web_json_post "$bot_api/setMyCommands" "$JSON"
|
web_json_post "$bot_api/setMyCommands" "$JSON"
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ getscripts(){
|
|||||||
error_down
|
error_down
|
||||||
else
|
else
|
||||||
. "$CRASHDIR"/init.sh >/dev/null
|
. "$CRASHDIR"/init.sh >/dev/null
|
||||||
|
echo "$release_type" | grep -qE '^[0-9]' && setconfig userguide #回退时重新新手引导
|
||||||
echo -e "\033[32m脚本更新成功!\033[0m"
|
echo -e "\033[32m脚本更新成功!\033[0m"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -1041,16 +1042,17 @@ setserver() {
|
|||||||
echo "-----------------------------------------------"
|
echo "-----------------------------------------------"
|
||||||
if [ -n "$url_id" ] && [ "$url_id" -lt 200 ];then
|
if [ -n "$url_id" ] && [ "$url_id" -lt 200 ];then
|
||||||
echo -ne "\033[32m正在获取版本信息!\033[0m\r"
|
echo -ne "\033[32m正在获取版本信息!\033[0m\r"
|
||||||
get_bin "$TMPDIR"/release_version bin/release_version
|
. "$CRASHDIR"/libs/web_get_lite.sh
|
||||||
|
web_get_lite https://github.com/juewuy/ShellCrash/tags | grep -o 'releases/tag/.*data'|awk -F '/' '{print $3}'|sed 's/".*//g' > "$TMPDIR"/tags
|
||||||
if [ "$?" = "0" ];then
|
if [ "$?" = "0" ];then
|
||||||
echo -e "\033[31m请选择想要回退至的稳定版版本:\033[0m"
|
echo -e "\033[31m请选择想要回退至的具体版本:\033[0m"
|
||||||
cat "$TMPDIR"/release_version | awk '{print " "NR" "$1}'
|
cat "$TMPDIR"/tags | awk '{print " "NR" "$1}'
|
||||||
echo -e " 0 返回上级菜单"
|
echo -e " 0 返回上级菜单"
|
||||||
read -p "请输入对应数字 > " num
|
read -p "请输入对应数字 > " num
|
||||||
if [ -z "$num" -o "$num" = 0 ]; then
|
if [ -z "$num" -o "$num" = 0 ]; then
|
||||||
continue
|
continue
|
||||||
elif [ $num -le $(cat "$TMPDIR"/release_version 2>/dev/null | awk 'END{print NR}') ]; then
|
elif [ $num -le $(cat "$TMPDIR"/tags 2>/dev/null | awk 'END{print NR}') ]; then
|
||||||
release_type=$(cat "$TMPDIR"/release_version | awk '{print $1}' | sed -n "$num"p)
|
release_type=$(cat "$TMPDIR"/tags | awk '{print $1}' | sed -n "$num"p)
|
||||||
update_url=''
|
update_url=''
|
||||||
saveserver
|
saveserver
|
||||||
else
|
else
|
||||||
@@ -1065,7 +1067,7 @@ setserver() {
|
|||||||
sleep 1
|
sleep 1
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
rm -rf "$TMPDIR"/release_version
|
rm -rf "$TMPDIR"/tags
|
||||||
else
|
else
|
||||||
echo -e "\033[31m当前源不支持版本回退,请尝试更换其他安装源!\033[0m"
|
echo -e "\033[31m当前源不支持版本回退,请尝试更换其他安装源!\033[0m"
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|||||||
@@ -155,8 +155,6 @@ download_file(){
|
|||||||
else
|
else
|
||||||
send_msg "文件格式不匹配,上传失败!"
|
send_msg "文件格式不匹配,上传失败!"
|
||||||
fi
|
fi
|
||||||
OFFSET=$((OFFSET + 1))
|
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
### --- 具体操作函数 --- ###
|
### --- 具体操作函数 --- ###
|
||||||
do_start_fw(){
|
do_start_fw(){
|
||||||
@@ -231,11 +229,18 @@ polling(){
|
|||||||
OFFSET=$(echo "$UPDATES" | grep -o '"update_id":[0-9]*' | tail -n1 | cut -d: -f2)
|
OFFSET=$(echo "$UPDATES" | grep -o '"update_id":[0-9]*' | tail -n1 | cut -d: -f2)
|
||||||
OFFSET=$((OFFSET + 1))
|
OFFSET=$((OFFSET + 1))
|
||||||
|
|
||||||
|
### --- 校验ChatID --- ###
|
||||||
|
CHATID=$(echo "$UPDATES" | grep -o '"id":[0-9]*' | tail -n1 | cut -d: -f2)
|
||||||
|
[ "$CHATID" != "$TG_CHATID" ] && continue
|
||||||
|
|
||||||
### --- 处理按钮事件 --- ###
|
### --- 处理按钮事件 --- ###
|
||||||
CALLBACK=$(echo "$UPDATES" | grep -o '"data":"[^"]*"' | head -n1 | sed 's/.*:"//;s/"$//')
|
CALLBACK=$(echo "$UPDATES" | grep -o '"data":"[^"]*"' | head -n1 | sed 's/.*:"//;s/"$//')
|
||||||
FILE_ID=$(echo "$UPDATES" | sed 's/"callback_query".*//g' | grep -o '"file_id":"[^"]*"' | head -n1 | sed 's/.*:"//;s/"$//')
|
FILE_ID=$(echo "$UPDATES" | sed 's/"callback_query".*//g' | grep -o '"file_id":"[^"]*"' | head -n1 | sed 's/.*:"//;s/"$//')
|
||||||
|
|
||||||
[ -n "$FILE_ID" ] && download_file
|
[ -n "$FILE_ID" ] && {
|
||||||
|
download_file
|
||||||
|
continue
|
||||||
|
}
|
||||||
[ -n "$CALLBACK" ] && case "$CALLBACK" in
|
[ -n "$CALLBACK" ] && case "$CALLBACK" in
|
||||||
"start_redir")
|
"start_redir")
|
||||||
if [ "$redir_mod" = '纯净模式' ];then
|
if [ "$redir_mod" = '纯净模式' ];then
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ tg_push_token(){
|
|||||||
push_TG="$TOKEN"
|
push_TG="$TOKEN"
|
||||||
setconfig push_TG "$TOKEN"
|
setconfig push_TG "$TOKEN"
|
||||||
setconfig chat_ID "$chat_ID"
|
setconfig chat_ID "$chat_ID"
|
||||||
"$CRASHDIR"/start.sh logger "已完成Telegram日志推送设置!" 32
|
. "$CRASHDIR"/libs/logger.sh && logger "已完成Telegram日志推送设置!" 32
|
||||||
}
|
}
|
||||||
get_chatid(){
|
get_chatid(){
|
||||||
i=1
|
i=1
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ bot_tg_start(){
|
|||||||
}
|
}
|
||||||
bot_tg_stop(){
|
bot_tg_stop(){
|
||||||
cronset 'TG_BOT守护进程'
|
cronset 'TG_BOT守护进程'
|
||||||
[ -f "$TMPDIR/bot_tg.pid" ] && kill -TERM "$(cat "$TMPDIR/bot_tg.pid")"
|
[ -f "$TMPDIR/bot_tg.pid" ] && kill -TERM "$(cat "$TMPDIR/bot_tg.pid")" 2>/dev/null
|
||||||
killall bot_tg.sh 2>/dev/null
|
killall bot_tg.sh 2>/dev/null
|
||||||
rm -f "$TMPDIR/bot_tg.pid"
|
rm -f "$TMPDIR/bot_tg.pid"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ task_logger(){
|
|||||||
[ "$task_push" = 1 ] && push= || push=off
|
[ "$task_push" = 1 ] && push= || push=off
|
||||||
[ -n "$2" -a "$2" != 0 ] && echo -e "\033[$2m$1\033[0m"
|
[ -n "$2" -a "$2" != 0 ] && echo -e "\033[$2m$1\033[0m"
|
||||||
[ "$3" = 'off' ] && push=off
|
[ "$3" = 'off' ] && push=off
|
||||||
echo "$1" |grep -qE '(每隔|时每)([1-9]|[1-9][0-9])分钟' && push=off
|
echo "$1" |grep -qE '(每隔|时每)([1-9]|[1-9][0-9])分钟' || logger "$1" 0 "$push"
|
||||||
logger "$1" 0 "$push"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#任务命令
|
#任务命令
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ start)
|
|||||||
/etc/init.d/shellcrash start
|
/etc/init.d/shellcrash start
|
||||||
elif [ "$USER" = "root" ] && grep -q 'systemd' /proc/1/comm; then
|
elif [ "$USER" = "root" ] && grep -q 'systemd' /proc/1/comm; then
|
||||||
FragmentPath=$(systemctl show -p FragmentPath shellcrash | sed 's/FragmentPath=//')
|
FragmentPath=$(systemctl show -p FragmentPath shellcrash | sed 's/FragmentPath=//')
|
||||||
[ -f $FragmentPath ] && {
|
[ -f "$FragmentPath" ] && {
|
||||||
setconfig ExecStart "$COMMAND >/dev/null" "$FragmentPath"
|
sed -i "s#^ExecStart=.*#ExecStart=$COMMAND >/dev/null#" "$FragmentPath"
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
}
|
}
|
||||||
systemctl start shellcrash.service || . "$CRASHDIR"/starts/start_error.sh
|
systemctl start shellcrash.service || . "$CRASHDIR"/starts/start_error.sh
|
||||||
@@ -71,10 +71,13 @@ stop)
|
|||||||
cronset '保守模式守护进程'
|
cronset '保守模式守护进程'
|
||||||
cronset '运行时每'
|
cronset '运行时每'
|
||||||
cronset '流媒体预解析'
|
cronset '流媒体预解析'
|
||||||
|
#停止tg_bot
|
||||||
|
. "$CRASHDIR"/menus/bot_tg_service.sh && bot_tg_stop
|
||||||
#多种方式结束进程
|
#多种方式结束进程
|
||||||
if [ -f "$TMPDIR/shellcrash.pid" ];then
|
if [ -f "$TMPDIR/shellcrash.pid" ];then
|
||||||
kill -TERM "$(cat "$TMPDIR/shellcrash.pid")"
|
kill -TERM "$(cat "$TMPDIR/shellcrash.pid")" 2>/dev/null
|
||||||
rm -f "$TMPDIR/shellcrash.pid"
|
rm -f "$TMPDIR/shellcrash.pid"
|
||||||
|
stop_firewall
|
||||||
elif [ "$USER" = "root" ] && grep -q 'systemd' /proc/1/comm; then
|
elif [ "$USER" = "root" ] && grep -q 'systemd' /proc/1/comm; then
|
||||||
systemctl stop shellcrash.service >/dev/null 2>&1
|
systemctl stop shellcrash.service >/dev/null 2>&1
|
||||||
elif [ -f /etc/rc.common ] && grep -q 'procd' /proc/1/comm; then
|
elif [ -f /etc/rc.common ] && grep -q 'procd' /proc/1/comm; then
|
||||||
@@ -85,7 +88,7 @@ stop)
|
|||||||
elif rc-status -r >/dev/null 2>&1; then
|
elif rc-status -r >/dev/null 2>&1; then
|
||||||
rc-service shellcrash stop >/dev/null 2>&1
|
rc-service shellcrash stop >/dev/null 2>&1
|
||||||
else
|
else
|
||||||
stop_firewall #清理路由策略
|
stop_firewall
|
||||||
fi
|
fi
|
||||||
killall CrashCore 2>/dev/null
|
killall CrashCore 2>/dev/null
|
||||||
#清理缓存目录
|
#清理缓存目录
|
||||||
@@ -115,8 +118,8 @@ debug)
|
|||||||
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
|
||||||
fi
|
fi
|
||||||
[ "$3" = flash ] && dir=$CRASHDIR || dir=$TMPDIR
|
[ "$3" = flash ] && dir="$CRASHDIR" || dir="$TMPDIR"
|
||||||
$COMMAND >${dir}/debug.log 2>&1 &
|
$COMMAND >"$dir"/debug.log 2>&1 &
|
||||||
sleep 2
|
sleep 2
|
||||||
logger "已运行debug模式!如需停止,请使用重启/停止服务功能!" 33
|
logger "已运行debug模式!如需停止,请使用重启/停止服务功能!" 33
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -6,13 +6,12 @@
|
|||||||
check_core() { #检查及下载内核文件
|
check_core() { #检查及下载内核文件
|
||||||
[ -n "$(find --help 2>&1 | grep -o size)" ] && find_para=' -size +2000' #find命令兼容
|
[ -n "$(find --help 2>&1 | grep -o size)" ] && find_para=' -size +2000' #find命令兼容
|
||||||
[ -z "$(find "$TMPDIR"/CrashCore $find_para 2>/dev/null)" ] && core_find
|
[ -z "$(find "$TMPDIR"/CrashCore $find_para 2>/dev/null)" ] && core_find
|
||||||
[ -z "$(find "$TMPDIR"/CrashCore 2>/dev/null)" ] && {
|
[ ! -f "$TMPDIR"/CrashCore ] && {
|
||||||
logger "未找到【$crashcore】核心,正在下载!" 33
|
logger "未找到【$crashcore】核心,正在下载!" 33
|
||||||
[ -z "$cpucore" ] && . "$CRASHDIR"/libs/check_cpucore.sh && check_cpucore
|
[ -z "$cpucore" ] && . "$CRASHDIR"/libs/check_cpucore.sh && check_cpucore
|
||||||
[ -z "$cpucore" ] && logger 找不到设备的CPU信息,请手动指定处理器架构类型! 31 && exit 1
|
[ -z "$cpucore" ] && logger 找不到设备的CPU信息,请手动指定处理器架构类型! 31 && exit 1
|
||||||
core_webget || logger "核心下载失败,请重新运行或更换安装源!" 31
|
core_webget || logger "核心下载失败,请重新运行或更换安装源!" 31
|
||||||
}
|
}
|
||||||
[ ! -x "$TMPDIR"/CrashCore ] && chmod +x "$TMPDIR"/CrashCore 2>/dev/null #自动授权
|
[ "$start_old" != "ON" ] && [ "$(cat /proc/1/comm)" = "systemd" ] && restorecon -RF "$CRASHDIR" 2>/dev/null #修复SELinux权限问题
|
||||||
[ "$start_old" != "ON" -a "$(cat /proc/1/comm)" = "systemd" ] && restorecon -RF "$CRASHDIR" 2>/dev/null #修复SELinux权限问题
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ dns:
|
|||||||
use-hosts: true
|
use-hosts: true
|
||||||
ipv6: $dns_v6
|
ipv6: $dns_v6
|
||||||
default-nameserver: [ $dns_resolver ]
|
default-nameserver: [ $dns_resolver ]
|
||||||
|
direct-nameserver: [ $dns_nameserver ]
|
||||||
enhanced-mode: fake-ip
|
enhanced-mode: fake-ip
|
||||||
fake-ip-range: 28.0.0.0/8
|
fake-ip-range: 28.0.0.0/8
|
||||||
fake-ip-range6: fc00::/16
|
fake-ip-range6: fc00::/16
|
||||||
|
|||||||
@@ -2,25 +2,36 @@
|
|||||||
getlanip() { #获取局域网host地址
|
getlanip() { #获取局域网host地址
|
||||||
i=1
|
i=1
|
||||||
while [ "$i" -le "20" ]; do
|
while [ "$i" -le "20" ]; do
|
||||||
host_ipv4=$(ip route show scope link | grep -Ev 'wan|utun|iot|peer|docker|podman|virbr|vnet|ovs|vmbr|veth|vmnic|vboxnet|lxcbr|xenbr|vEthernet' | awk '{print $1}' | tr '\n' ' ' | sed 's/ $//') #ipv4局域网网段
|
host_ipv4=$(ip route show scope link | grep -Ev 'wan|utun|iot|peer|docker|podman|virbr|vnet|ovs|vmbr|veth|vmnic|vboxnet|lxcbr|xenbr|vEthernet' | awk '{print $1}') #ipv4局域网网段
|
||||||
[ "$ipv6_redir" = "ON" ] && host_ipv6=$(ip -6 route show default | awk '{print $3}' | tr '\n' ' ' | sed 's/ $//') #ipv6公网地址段
|
[ "$ipv6_redir" = "ON" ] && host_ipv6=$(ip -6 route show default | awk '{print $3}' | tr '\n' ' ' | sed 's/ $//') #ipv6公网地址段
|
||||||
[ -f "$TMPDIR"/ShellCrash.log ] && break
|
[ -f "$TMPDIR"/ShellCrash.log ] && break
|
||||||
[ -n "$host_ipv4" -a "$ipv6_redir" != "ON" ] && break
|
[ -n "$host_ipv4" -a "$ipv6_redir" != "ON" ] && break
|
||||||
[ -n "$host_ipv4" -a -n "$host_ipv6" ] && break
|
[ -n "$host_ipv4" -a -n "$host_ipv6" ] && break
|
||||||
sleep 1 && i=$((i + 1))
|
sleep 1 && i=$((i + 1))
|
||||||
done
|
done
|
||||||
|
#Tailscale
|
||||||
|
[ "$ts_service" = ON ] && {
|
||||||
|
ts_host_ipv4=' 100.64.0.0/10'
|
||||||
|
ts_host_ipv6=' fd7a:115c:a1e0::/48'
|
||||||
|
}
|
||||||
|
#Wireguard
|
||||||
|
[ "$wg_service" = ON ] && {
|
||||||
|
. "$CRASHDIR"/configs/gateway.cfg
|
||||||
|
wg_host_ipv4=' $wg_ipv4'
|
||||||
|
[ -n "$wg_ipv6" ] && wg_host_ipv6=' $wg_ipv6'
|
||||||
|
}
|
||||||
#添加自定义ipv4局域网网段
|
#添加自定义ipv4局域网网段
|
||||||
if [ "$replace_default_host_ipv4" == "ON" ]; then
|
if [ "$replace_default_host_ipv4" == "ON" ]; then
|
||||||
host_ipv4="$cust_host_ipv4"
|
host_ipv4="$cust_host_ipv4"
|
||||||
else
|
else
|
||||||
host_ipv4="$host_ipv4 $cust_host_ipv4"
|
host_ipv4=$(echo "$host_ipv4 $cust_host_ipv4$ts_host_ipv4$wg_host_ipv4"| tr '\n' ' ' | sed 's/ $//')
|
||||||
fi
|
fi
|
||||||
#缺省配置
|
#缺省配置
|
||||||
[ -z "$host_ipv4" ] && {
|
[ -z "$host_ipv4" ] && {
|
||||||
host_ipv4='192.168.0.0/16 10.0.0.0/12 172.16.0.0/12'
|
host_ipv4='192.168.0.0/16 10.0.0.0/12 172.16.0.0/12'
|
||||||
logger "无法获取本地LAN-IPV4网段,请前往流量过滤设置界面设置自定义网段!" 31
|
logger "无法获取本地LAN-IPV4网段,请前往流量过滤设置界面设置自定义网段!" 31
|
||||||
}
|
}
|
||||||
host_ipv6="fe80::/10 fd00::/8 $host_ipv6"
|
host_ipv6="fe80::/10 fd00::/8 $host_ipv6$ts_host_ipv6$wg_host_ipv6"
|
||||||
#获取本机出口IP地址
|
#获取本机出口IP地址
|
||||||
local_ipv4=$(ip route 2>&1 | grep -Ev 'utun|iot|docker|linkdown' | grep -Eo 'src.*' | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | sort -u)
|
local_ipv4=$(ip route 2>&1 | grep -Ev 'utun|iot|docker|linkdown' | grep -Eo 'src.*' | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | sort -u)
|
||||||
[ -z "$local_ipv4" ] && local_ipv4=$(ip route 2>&1 | grep -Eo 'src.*' | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | sort -u)
|
[ -z "$local_ipv4" ] && local_ipv4=$(ip route 2>&1 | grep -Eo 'src.*' | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | sort -u)
|
||||||
|
|||||||
@@ -132,5 +132,5 @@ ckcmd nft && nft delete table inet shellcrash >/dev/null 2>&1
|
|||||||
#还原防火墙文件
|
#还原防火墙文件
|
||||||
[ -s /etc/init.d/firewall.bak ] && mv -f /etc/init.d/firewall.bak /etc/init.d/firewall
|
[ -s /etc/init.d/firewall.bak ] && mv -f /etc/init.d/firewall.bak /etc/init.d/firewall
|
||||||
#others
|
#others
|
||||||
[ "$systype" != 'container' ] && sed -i '/shellcrash-dns-repair/d' /etc/resolv.conf >/dev/null 2>&1
|
sed -i '/shellcrash-dns-repair/d' /etc/resolv.conf 2>/dev/null
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,18 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Copyright (C) Juewuy
|
# Copyright (C) Juewuy
|
||||||
|
|
||||||
CRASHDIR="$(uci get firewall.ShellCrash.path | sed 's/\/starts\/snapshot_init.sh//')"
|
CRASHDIR="$(uci get firewall.ShellCrash.path | sed 's/\/starts.*//')"
|
||||||
|
#防止提前自启
|
||||||
[ -f "$CRASHDIR"/configs/ShellCrash.cfg ] && . "$CRASHDIR"/configs/ShellCrash.cfg
|
/etc/init.d/shellcrash disable
|
||||||
|
crontab -l | grep -v 'start_legacy_wd.sh shellcrash' | crontab -
|
||||||
|
#防止usb未加载
|
||||||
|
i=0
|
||||||
|
while [ ! -f "$CRASHDIR/configs/ShellCrash.cfg" ]; do
|
||||||
|
[ $i -gt 20 ] && exit 1
|
||||||
|
i=$((i + 1))
|
||||||
|
sleep 3
|
||||||
|
done
|
||||||
|
. "$CRASHDIR"/configs/ShellCrash.cfg
|
||||||
|
|
||||||
autoSSH(){
|
autoSSH(){
|
||||||
#自动开启SSH
|
#自动开启SSH
|
||||||
@@ -52,10 +61,15 @@ auto_clean(){
|
|||||||
}
|
}
|
||||||
auto_start(){
|
auto_start(){
|
||||||
#设置init.d服务
|
#设置init.d服务
|
||||||
cp -f "$CRASHDIR"/starts/shellcrash.procd /etc/init.d/shellcrash
|
[ ! -x /etc/init.d/shellcrash ] && {
|
||||||
chmod 755 /etc/init.d/shellcrash
|
cp -f "$CRASHDIR"/starts/shellcrash.procd /etc/init.d/shellcrash
|
||||||
|
chmod 755 /etc/init.d/shellcrash
|
||||||
|
}
|
||||||
#初始化环境变量
|
#初始化环境变量
|
||||||
. "$CRASHDIR"/libs/set_profile.sh && set_profile '/etc/profile'
|
grep -q '^export CRASHDIR=' '/etc/profile' || {
|
||||||
|
. "$CRASHDIR"/libs/set_profile.sh
|
||||||
|
set_profile '/etc/profile'
|
||||||
|
}
|
||||||
#启动服务
|
#启动服务
|
||||||
if [ ! -f "$CRASHDIR"/.dis_startup ]; then
|
if [ ! -f "$CRASHDIR"/.dis_startup ]; then
|
||||||
#AX6S/AX6000修复tun功能
|
#AX6S/AX6000修复tun功能
|
||||||
@@ -65,23 +79,22 @@ auto_start(){
|
|||||||
#自动覆盖根证书文件
|
#自动覆盖根证书文件
|
||||||
[ -s "$CRASHDIR"/tools/ca-certificates.crt ] && cp -f "$CRASHDIR"/tools/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
[ -s "$CRASHDIR"/tools/ca-certificates.crt ] && cp -f "$CRASHDIR"/tools/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
#启动服务
|
#启动服务
|
||||||
"$CRASHDIR"/start.sh start
|
"$CRASHDIR"/start.sh stop
|
||||||
/etc/init.d/shellcrash enable
|
/etc/init.d/shellcrash start && /etc/init.d/shellcrash enable
|
||||||
fi
|
fi
|
||||||
#启动自定义服务
|
|
||||||
[ -s /data/auto_start.sh ] && /bin/sh /data/auto_start.sh &
|
|
||||||
#兼容auto_ssh脚本
|
|
||||||
[ -s /data/auto_ssh/auto_ssh.sh ] && /bin/sh /data/auto_ssh/auto_ssh.sh &
|
|
||||||
}
|
}
|
||||||
init(){
|
init(){
|
||||||
#等待启动完成
|
#等待启动完成
|
||||||
while ! ip a| grep -q lan; do
|
while ! ip a| grep -q lan; do
|
||||||
sleep 10
|
sleep 10
|
||||||
done
|
done
|
||||||
sleep 20
|
|
||||||
autoSSH #软固化功能
|
autoSSH #软固化功能
|
||||||
auto_clean #自动清理
|
auto_clean #自动清理
|
||||||
[ -s "$CRASHDIR"/start.sh ] && auto_start
|
auto_start
|
||||||
|
#启动自定义服务
|
||||||
|
[ -s /data/auto_start.sh ] && /bin/sh /data/auto_start.sh &
|
||||||
|
#兼容auto_ssh脚本
|
||||||
|
[ -s /data/auto_ssh/auto_ssh.sh ] && /bin/sh /data/auto_ssh/auto_ssh.sh &
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
|||||||
Reference in New Issue
Block a user