~修复 Docker 删除重建容器后丢失开机自启状态的问题:将 s6 自启标记持久化到 configs 卷,并在启动时通过 S6_STAGE2_HOOK 同步

This commit is contained in:
纯白色冰淇淋
2026-08-11 11:54:40 +08:00
parent 78ad72f4e4
commit d37267bceb
6 changed files with 51 additions and 4 deletions
+2 -2
View File
@@ -12,7 +12,7 @@ allow_autostart() {
fi
ckcmd systemctl && systemctl enable shellcrash.service >/dev/null 2>&1
grep -q 's6' /proc/1/comm && touch /etc/s6-overlay/s6-rc.d/user/contents.d/afstart
grep -q 's6' /proc/1/comm && enable_s6_autostart_marks
rc-status -r >/dev/null 2>&1 && rc-update add shellcrash default >/dev/null 2>&1
rm -rf "$CRASHDIR"/.dis_startup
}
@@ -20,7 +20,7 @@ allow_autostart() {
disable_autostart() {
[ -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
grep -q 's6' /proc/1/comm && rm -rf /etc/s6-overlay/s6-rc.d/user/contents.d/afstart
grep -q 's6' /proc/1/comm && disable_s6_autostart_marks
rc-status -r >/dev/null 2>&1 && rc-update del shellcrash default >/dev/null 2>&1
touch "$CRASHDIR"/.dis_startup
}
+1
View File
@@ -69,6 +69,7 @@ forwhat() {
fi
ckcmd systemctl && [ "$(cat /proc/1/comm)" = "systemd" ] && systemctl enable shellcrash.service >/dev/null 2>&1
grep -q 's6' /proc/1/comm && enable_s6_autostart_marks
rm -rf "$CRASHDIR"/.dis_startup
autostart=enable
# 检测IP转发