From 9ed7d80765999e78499db4090eeaa608b4c473ae Mon Sep 17 00:00:00 2001 From: MrMeeb Date: Sat, 15 Jun 2024 15:39:09 +0000 Subject: [PATCH 1/3] Change to documented method for killing a container --- root/check-one-shot.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/root/check-one-shot.sh b/root/check-one-shot.sh index 1808062..1afe99e 100644 --- a/root/check-one-shot.sh +++ b/root/check-one-shot.sh @@ -4,6 +4,7 @@ if [ $ONE_SHOT == "true" ]; then # Cleanly kill container by sending kill signal to supervisor process - kill 1 + echo 0 > /run/s6-linux-init-container-results/exitcode + /run/s6/basedir/bin/halt fi \ No newline at end of file -- 2.47.2 From f82ed81e2e72436a570d4a17f76e4df5920dc5a6 Mon Sep 17 00:00:00 2001 From: MrMeeb Date: Sat, 15 Jun 2024 15:41:02 +0000 Subject: [PATCH 2/3] Add missing shebang to finish hooks --- root/etc/s6-overlay/s6-rc.d/cron/finish | 3 +++ root/etc/s6-overlay/s6-rc.d/logs/finish | 3 +++ 2 files changed, 6 insertions(+) diff --git a/root/etc/s6-overlay/s6-rc.d/cron/finish b/root/etc/s6-overlay/s6-rc.d/cron/finish index 767f815..e6c6dd3 100644 --- a/root/etc/s6-overlay/s6-rc.d/cron/finish +++ b/root/etc/s6-overlay/s6-rc.d/cron/finish @@ -1 +1,4 @@ +#!/command/with-contenv bash +# shellcheck shell=bash + echo "$e" > /run/s6-linux-init-container-results/exitcode \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/logs/finish b/root/etc/s6-overlay/s6-rc.d/logs/finish index 767f815..e6c6dd3 100644 --- a/root/etc/s6-overlay/s6-rc.d/logs/finish +++ b/root/etc/s6-overlay/s6-rc.d/logs/finish @@ -1 +1,4 @@ +#!/command/with-contenv bash +# shellcheck shell=bash + echo "$e" > /run/s6-linux-init-container-results/exitcode \ No newline at end of file -- 2.47.2 From 02f9dbc024094584481c4672193d1288e0bdd3ee Mon Sep 17 00:00:00 2001 From: MrMeeb Date: Sat, 15 Jun 2024 15:41:26 +0000 Subject: [PATCH 3/3] Only pipe exit code to container exit code if ONE_SHOT=false --- root/etc/s6-overlay/s6-rc.d/cron/finish | 7 ++++++- root/etc/s6-overlay/s6-rc.d/logs/finish | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/root/etc/s6-overlay/s6-rc.d/cron/finish b/root/etc/s6-overlay/s6-rc.d/cron/finish index e6c6dd3..a6cb9ce 100644 --- a/root/etc/s6-overlay/s6-rc.d/cron/finish +++ b/root/etc/s6-overlay/s6-rc.d/cron/finish @@ -1,4 +1,9 @@ #!/command/with-contenv bash # shellcheck shell=bash -echo "$e" > /run/s6-linux-init-container-results/exitcode \ No newline at end of file +if [ $ONE_SHOT == "false" ]; then + + # Export exit code if not a ONE_SHOT + echo "$e" > /run/s6-linux-init-container-results/exitcode + +fi \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/logs/finish b/root/etc/s6-overlay/s6-rc.d/logs/finish index e6c6dd3..a6cb9ce 100644 --- a/root/etc/s6-overlay/s6-rc.d/logs/finish +++ b/root/etc/s6-overlay/s6-rc.d/logs/finish @@ -1,4 +1,9 @@ #!/command/with-contenv bash # shellcheck shell=bash -echo "$e" > /run/s6-linux-init-container-results/exitcode \ No newline at end of file +if [ $ONE_SHOT == "false" ]; then + + # Export exit code if not a ONE_SHOT + echo "$e" > /run/s6-linux-init-container-results/exitcode + +fi \ No newline at end of file -- 2.47.2