Compare commits

..
6 Commits
Author SHA1 Message Date
juewuy eb0c211c17 Merge branch 'master' of github.com:juewuy/ShellCrash into dev 2026-08-02 10:42:00 +08:00
juewuy 0d2c252e5d Merge branch 'dev' 2026-07-29 10:53:59 +08:00
juewuy cc563dcfa1 Merge branch 'dev'
# Conflicts:
#	ShellCrash.tar.gz
#	bin/version
#	scripts/starts/start_legacy_wd.sh
#	version
2026-07-18 20:28:21 +08:00
juewuy 2a084019e2 Merge pull request #1240 from abcfy2/master
使用兼容性更强的 `rm -fr` 代替 `rm -d` 删除锁目录
2026-03-22 05:06:02 -07:00
Feng Yu 7f22bb550a 使用兼容性更强的 rm -fr 代替 rm -d 删除锁目录
Fix #1238
2026-03-22 19:32:07 +08:00
juewuy 0b7f7161b0 ~1.9.4release 2026-02-15 19:19:19 +08:00
8 changed files with 5 additions and 58 deletions
-3
View File
@@ -74,10 +74,7 @@ COPY --from=builder /tmp/s6_noarch.tar.xz /tmp/s6_noarch.tar.xz
RUN tar -xJf /tmp/s6_noarch.tar.xz -C / && rm -rf /tmp/s6_noarch.tar.xz RUN tar -xJf /tmp/s6_noarch.tar.xz -C / && rm -rf /tmp/s6_noarch.tar.xz
RUN tar -xJf /tmp/s6_arch.tar.xz -C / && rm -rf /tmp/s6_arch.tar.xz RUN tar -xJf /tmp/s6_arch.tar.xz -C / && rm -rf /tmp/s6_arch.tar.xz
COPY docker/s6-rc.d /etc/s6-overlay/s6-rc.d COPY docker/s6-rc.d /etc/s6-overlay/s6-rc.d
COPY docker/s6-overlay/scripts/sync-autostart /etc/s6-overlay/scripts/sync-autostart
RUN chmod +x /etc/s6-overlay/scripts/sync-autostart
ENV S6_CMD_WAIT_FOR_SERVICES=1 ENV S6_CMD_WAIT_FOR_SERVICES=1
ENV S6_STAGE2_HOOK=/etc/s6-overlay/scripts/sync-autostart
ENTRYPOINT ["/init"] ENTRYPOINT ["/init"]
+1 -3
View File
@@ -89,8 +89,6 @@ mkdir -p /root/ShellCrash
docker run -d \ docker run -d \
……………… ………………
-v shellcrash_configs:/etc/ShellCrash/configs \ -v shellcrash_configs:/etc/ShellCrash/configs \
-v shellcrash_yamls:/etc/ShellCrash/yamls \
-v shellcrash_jsons:/etc/ShellCrash/jsons \
……………… ………………
``` ```
@@ -136,7 +134,7 @@ docker rm -f shellcrash
### Docker删除卷 ### Docker删除卷
```shell ```shell
docker volume rm shellcrash_configs shellcrash_yamls shellcrash_jsons docker volume rm shellcrash_configs
``` ```
### Compose删除容器&卷 ### Compose删除容器&卷
-4
View File
@@ -18,14 +18,10 @@ services:
# - net.ipv6.conf.all.forwarding=1 # - net.ipv6.conf.all.forwarding=1
volumes: volumes:
- shellcrash_configs:/etc/ShellCrash/configs:rw - shellcrash_configs:/etc/ShellCrash/configs:rw
- shellcrash_yamls:/etc/ShellCrash/yamls:rw
- shellcrash_jsons:/etc/ShellCrash/jsons:rw
restart: unless-stopped restart: unless-stopped
volumes: volumes:
shellcrash_configs: shellcrash_configs:
shellcrash_yamls:
shellcrash_jsons:
networks: networks:
macvlan_lan: macvlan_lan:
-22
View File
@@ -1,22 +0,0 @@
#!/bin/sh
# 在 s6-rc 编译 user bundle 之前,把 configs 卷中的自启状态同步到 contents.d
# 由 S6_STAGE2_HOOK 调用;删除重建容器后仍可按 volume 恢复开机自启
CRASHDIR=/etc/ShellCrash
CFG_MARK="$CRASHDIR/configs/.autostart"
S6_MARK=/etc/s6-overlay/s6-rc.d/user/contents.d/afstart
mkdir -p "$CRASHDIR/configs" /etc/s6-overlay/s6-rc.d/user/contents.d
# 兼容旧容器:仅有 s6 标记时迁移到 configs
if [ -f "$S6_MARK" ] && [ ! -f "$CFG_MARK" ]; then
touch "$CFG_MARK"
fi
if [ -f "$CFG_MARK" ] && [ ! -f "$CRASHDIR/.dis_startup" ]; then
touch "$S6_MARK"
else
rm -f "$S6_MARK"
fi
exit 0
+1 -21
View File
@@ -1,22 +1,3 @@
# s6 / Docker:自启状态以 configs 卷内标记为准,并同步到 s6 contents.d
enable_s6_autostart_marks() {
mkdir -p "$CRASHDIR/configs" /etc/s6-overlay/s6-rc.d/user/contents.d
touch "$CRASHDIR/configs/.autostart" /etc/s6-overlay/s6-rc.d/user/contents.d/afstart
}
disable_s6_autostart_marks() {
rm -f "$CRASHDIR/configs/.autostart" /etc/s6-overlay/s6-rc.d/user/contents.d/afstart
}
# 将旧版仅写在可写层的 s6 标记迁移到 configs
migrate_s6_autostart_mark() {
if [ -f /etc/s6-overlay/s6-rc.d/user/contents.d/afstart ] && [ ! -f "$CRASHDIR/configs/.autostart" ]; then
mkdir -p "$CRASHDIR/configs"
touch "$CRASHDIR/configs/.autostart"
fi
}
check_autostart(){ check_autostart(){
if [ "$start_old" = ON ];then if [ "$start_old" = ON ];then
[ ! -f "$CRASHDIR"/.dis_startup ] && return 0 [ ! -f "$CRASHDIR"/.dis_startup ] && return 0
@@ -26,8 +7,7 @@ check_autostart(){
elif ckcmd systemctl; then elif ckcmd systemctl; then
[ "$(systemctl is-enabled shellcrash.service 2>&1)" = enabled ] && return 0 [ "$(systemctl is-enabled shellcrash.service 2>&1)" = enabled ] && return 0
elif grep -q 's6' /proc/1/comm; then elif grep -q 's6' /proc/1/comm; then
migrate_s6_autostart_mark [ -f /etc/s6-overlay/s6-rc.d/user/contents.d/afstart ] && return 0
[ -f "$CRASHDIR/configs/.autostart" ] && [ ! -f "$CRASHDIR"/.dis_startup ] && return 0
elif rc-status -r >/dev/null 2>&1; then elif rc-status -r >/dev/null 2>&1; then
rc-update show default | grep -q "shellcrash" && return 0 rc-update show default | grep -q "shellcrash" && return 0
else else
+2 -2
View File
@@ -12,7 +12,7 @@ allow_autostart() {
fi fi
ckcmd systemctl && systemctl enable shellcrash.service >/dev/null 2>&1 ckcmd systemctl && systemctl enable shellcrash.service >/dev/null 2>&1
grep -q 's6' /proc/1/comm && enable_s6_autostart_marks grep -q 's6' /proc/1/comm && touch /etc/s6-overlay/s6-rc.d/user/contents.d/afstart
rc-status -r >/dev/null 2>&1 && rc-update add shellcrash default >/dev/null 2>&1 rc-status -r >/dev/null 2>&1 && rc-update add shellcrash default >/dev/null 2>&1
rm -rf "$CRASHDIR"/.dis_startup rm -rf "$CRASHDIR"/.dis_startup
} }
@@ -20,7 +20,7 @@ allow_autostart() {
disable_autostart() { disable_autostart() {
[ -d /etc/rc.d ] && cd /etc/rc.d && rm -rf *shellcrash >/dev/null 2>&1 && cd - >/dev/null [ -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 ckcmd systemctl && systemctl disable shellcrash.service >/dev/null 2>&1
grep -q 's6' /proc/1/comm && disable_s6_autostart_marks grep -q 's6' /proc/1/comm && rm -rf /etc/s6-overlay/s6-rc.d/user/contents.d/afstart
rc-status -r >/dev/null 2>&1 && rc-update del shellcrash default >/dev/null 2>&1 rc-status -r >/dev/null 2>&1 && rc-update del shellcrash default >/dev/null 2>&1
touch "$CRASHDIR"/.dis_startup touch "$CRASHDIR"/.dis_startup
} }
-1
View File
@@ -69,7 +69,6 @@ forwhat() {
fi fi
ckcmd systemctl && [ "$(cat /proc/1/comm)" = "systemd" ] && systemctl enable shellcrash.service >/dev/null 2>&1 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 rm -rf "$CRASHDIR"/.dis_startup
autostart=enable autostart=enable
# 检测IP转发 # 检测IP转发
+1 -2
View File
@@ -11,7 +11,6 @@
. "$CRASHDIR"/libs/set_config.sh . "$CRASHDIR"/libs/set_config.sh
. "$CRASHDIR"/libs/set_cron.sh . "$CRASHDIR"/libs/set_cron.sh
. "$CRASHDIR"/libs/check_cmd.sh . "$CRASHDIR"/libs/check_cmd.sh
. "$CRASHDIR"/libs/check_autostart.sh
. "$CRASHDIR"/libs/compare.sh . "$CRASHDIR"/libs/compare.sh
. "$CRASHDIR"/libs/logger.sh . "$CRASHDIR"/libs/logger.sh
. "$CRASHDIR"/libs/web_save.sh . "$CRASHDIR"/libs/web_save.sh
@@ -55,7 +54,7 @@ start)
systemctl start shellcrash.service || . "$CRASHDIR"/starts/start_error.sh systemctl start shellcrash.service || . "$CRASHDIR"/starts/start_error.sh
elif grep -q 's6' /proc/1/comm; then elif grep -q 's6' /proc/1/comm; then
bfstart && /command/s6-svc -u /run/service/shellcrash && { bfstart && /command/s6-svc -u /run/service/shellcrash && {
[ ! -f "$CRASHDIR"/.dis_startup ] && enable_s6_autostart_marks [ ! -f "$CRASHDIR"/.dis_startup ] && touch /etc/s6-overlay/s6-rc.d/user/contents.d/afstart
afstart & afstart &
} }
elif rc-status -r >/dev/null 2>&1; then elif rc-status -r >/dev/null 2>&1; then