增加alpine启动脚本

This commit is contained in:
wwd
2025-11-28 18:06:37 +08:00
parent 22d23fb27f
commit 6b83aae199
2 changed files with 31 additions and 0 deletions

View File

@@ -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

View File

@@ -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"