From 6b83aae199099885488c897e69c59c9f5a537f0c Mon Sep 17 00:00:00 2001 From: wwd Date: Fri, 28 Nov 2025 18:06:37 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0alpine=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/init.sh | 18 ++++++++++++++++++ scripts/menu.sh | 13 +++++++++++++ 2 files changed, 31 insertions(+) diff --git a/scripts/init.sh b/scripts/init.sh index 68c94a0..a56eec8 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -202,6 +202,24 @@ else setconfig start_old 已开启 fi fi + +# 在此处添加Alpine OpenRC配置(约第220-230行附近) +# Alpine Linux (OpenRC) 自启动配置 +if [ -f "/sbin/openrc" ] && [ "$(cat /proc/1/comm)" = "init" ]; then + # 创建启动脚本 + if [ ! -f "/etc/local.d/shellcrash.start" ]; then + echo "#!/bin/sh" > /etc/local.d/shellcrash.start + echo "${CRASHDIR}/start.sh start &" >> /etc/local.d/shellcrash.start + chmod +x /etc/local.d/shellcrash.start + fi + # 添加到默认运行级别 + rc-update add local default >/dev/null 2>&1 + setconfig autostart "enable" + logger "已配置Alpine系统自启动" 32 +fi + + + #修饰文件及版本号 command -v bash >/dev/null 2>&1 && shtype=bash [ -x /bin/ash ] && shtype=ash diff --git a/scripts/menu.sh b/scripts/menu.sh index 13fc2b0..01b01c5 100644 --- a/scripts/menu.sh +++ b/scripts/menu.sh @@ -1127,14 +1127,27 @@ setboot() { #启动相关设置 0) ;; 1) if [ "$autostart" = "enable" ]; then + # 禁止自启动:删除各系统的启动项 [ -d /etc/rc.d ] && cd /etc/rc.d && rm -rf *shellcrash >/dev/null 2>&1 && cd - >/dev/null ckcmd systemctl && systemctl disable shellcrash.service >/dev/null 2>&1 + # 新增:删除Alpine的启动脚本 + [ -f "/sbin/openrc" ] && rm -f /etc/local.d/shellcrash.start touch ${CRASHDIR}/.dis_startup autostart=disable echo -e "\033[33m已禁止ShellCrash开机启动!\033[0m" elif [ "$autostart" = "disable" ]; then + # 允许自启动:配置各系统的启动项 [ -f /etc/rc.common -a "$(cat /proc/1/comm)" = "procd" ] && /etc/init.d/shellcrash enable ckcmd systemctl && systemctl enable shellcrash.service >/dev/null 2>&1 + # 新增:配置Alpine的启动脚本 + if [ -f "/sbin/openrc" ]; then + [ ! -f "/etc/local.d/shellcrash.start" ] && { + echo "#!/bin/sh" > /etc/local.d/shellcrash.start + echo "${CRASHDIR}/start.sh start &" >> /etc/local.d/shellcrash.start + chmod +x /etc/local.d/shellcrash.start + } + rc-update add local default >/dev/null 2>&1 + fi rm -rf ${CRASHDIR}/.dis_startup autostart=enable echo -e "\033[32m已设置ShellCrash开机启动!\033[0m" From 5c94d13b9e88ce35c32b27c0116206b809112600 Mon Sep 17 00:00:00 2001 From: wwd Date: Fri, 28 Nov 2025 18:19:29 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/menu.sh b/scripts/menu.sh index 01b01c5..7920fe7 100644 --- a/scripts/menu.sh +++ b/scripts/menu.sh @@ -1113,7 +1113,7 @@ setboot() { #启动相关设置 echo ----------------------------------------------- echo -e "\033[30;47m欢迎使用启动设置菜单:\033[0m" echo ----------------------------------------------- - echo -e " 1 ${auto_set}\033[0mShellCrash开机启动" + echo -e " 1 ${auto_set}\033[0mShellCrash开机启动(alpine需先禁用再启用)" echo -e " 2 使用保守模式: \033[36m$start_old\033[0m ————基于定时任务(每分钟检测)" echo -e " 3 设置自启延时: \033[36m$delay\033[0m ————用于解决自启后服务受限" echo -e " 4 启用小闪存模式: \033[36m$mini_clash\033[0m ————用于闪存空间不足的设备" From 9a9eac3b14f21e20a10c111a23ce948acf779db9 Mon Sep 17 00:00:00 2001 From: wwd Date: Fri, 28 Nov 2025 22:44:20 +0800 Subject: [PATCH 3/4] Update install.sh --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 4acece2..6f8faf1 100644 --- a/install.sh +++ b/install.sh @@ -1,7 +1,7 @@ #! /bin/bash # Copyright (C) Juewuy -[ -z "$url" ] && url="https://fastly.jsdelivr.net/gh/juewuy/ShellCrash@master" +[ -z "$url" ] && url="https://fastly.jsdelivr.net/gh/wangweitung/ShellCrash@master" type bash &>/dev/null && shtype=bash || shtype=sh echo='echo -e' [ -n "$(echo -e | grep e)" ] && { From 4b30b42428822a818da3309036814fc3a46de674 Mon Sep 17 00:00:00 2001 From: wwd Date: Tue, 2 Dec 2025 13:35:16 +0800 Subject: [PATCH 4/4] Update install.sh --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 6f8faf1..4acece2 100644 --- a/install.sh +++ b/install.sh @@ -1,7 +1,7 @@ #! /bin/bash # Copyright (C) Juewuy -[ -z "$url" ] && url="https://fastly.jsdelivr.net/gh/wangweitung/ShellCrash@master" +[ -z "$url" ] && url="https://fastly.jsdelivr.net/gh/juewuy/ShellCrash@master" type bash &>/dev/null && shtype=bash || shtype=sh echo='echo -e' [ -n "$(echo -e | grep e)" ] && {