From f6d067b561cb185cc321ff4efff82da7c2704475 Mon Sep 17 00:00:00 2001 From: MrMeeb Date: Sat, 15 Jun 2024 15:55:18 +0000 Subject: [PATCH] Fix s6-overlay format error (#29) Add missing shebangs that cause `S6 warning: unable to spawn ./finish: Exec format error` when `ONESHOT=true`. Fixes #28 Also brings the method for killing a container via service exit inline with s6's documented method Reviewed-on: https://git.mrmeeb.stream/MrMeeb/certbot-cron-docker/pulls/29 --- root/check-one-shot.sh | 3 ++- root/etc/s6-overlay/s6-rc.d/cron/finish | 10 +++++++++- root/etc/s6-overlay/s6-rc.d/logs/finish | 10 +++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) 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 diff --git a/root/etc/s6-overlay/s6-rc.d/cron/finish b/root/etc/s6-overlay/s6-rc.d/cron/finish index 767f815..a6cb9ce 100644 --- a/root/etc/s6-overlay/s6-rc.d/cron/finish +++ b/root/etc/s6-overlay/s6-rc.d/cron/finish @@ -1 +1,9 @@ -echo "$e" > /run/s6-linux-init-container-results/exitcode \ No newline at end of file +#!/command/with-contenv bash +# shellcheck shell=bash + +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 767f815..a6cb9ce 100644 --- a/root/etc/s6-overlay/s6-rc.d/logs/finish +++ b/root/etc/s6-overlay/s6-rc.d/logs/finish @@ -1 +1,9 @@ -echo "$e" > /run/s6-linux-init-container-results/exitcode \ No newline at end of file +#!/command/with-contenv bash +# shellcheck shell=bash + +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