diff --git a/Dockerfile b/Dockerfile index ff1ed55..9dbab45 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,10 +5,7 @@ FROM ghcr.io/sdr-enthusiasts/docker-baseimage:wreadsb -ENV S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \ - S6_SERVICES_GRACETIME=20000 \ - S6_KILL_GRACETIME=20000 \ - BEASTPORT=30005 \ +ENV BEASTPORT=30005 \ GITPATH_TIMELAPSE1090=/opt/timelapse1090 \ HTTP_ACCESS_LOG="false" \ HTTP_ERROR_LOG="true" \ diff --git a/rootfs/etc/s6-overlay/s6-rc.d/startup/dependencies.d/base b/rootfs/etc/s6-overlay/s6-rc.d/startup/dependencies.d/base new file mode 100644 index 0000000..e69de29 diff --git a/rootfs/etc/s6-overlay/s6-rc.d/startup/down b/rootfs/etc/s6-overlay/s6-rc.d/startup/down new file mode 100755 index 0000000..2f14f7f --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/startup/down @@ -0,0 +1,2 @@ +#!/bin/sh +exec /etc/s6-overlay/scripts/startup-finish diff --git a/rootfs/etc/s6-overlay/scripts/startup b/rootfs/etc/s6-overlay/scripts/startup index c746be0..b783d97 100755 --- a/rootfs/etc/s6-overlay/scripts/startup +++ b/rootfs/etc/s6-overlay/scripts/startup @@ -10,9 +10,11 @@ if ! [[ -d "$SDIR" ]] || [[ -z "$(ls "$SDIR")" ]]; then exit 0 fi -for NAME in "$SDIR"/*; do - if ! s6wrap --quiet --prepend="$NAME" --timestamps --args "$NAME"; then - s6wrap --quiet --prepend=startup --timestamps --args echo Error running "$NAME" +cd "$SDIR" || exit 1 + +for NAME in *; do + if ! s6wrap --quiet --prepend="$NAME" --timestamps --args "$SDIR/$NAME"; then + s6wrap --quiet --prepend=startup --timestamps --args echo Error running "$SDIR/$NAME" exit 1 fi done diff --git a/rootfs/etc/s6-overlay/scripts/startup-finish b/rootfs/etc/s6-overlay/scripts/startup-finish new file mode 100755 index 0000000..b8410cb --- /dev/null +++ b/rootfs/etc/s6-overlay/scripts/startup-finish @@ -0,0 +1,20 @@ +#!/command/with-contenv bash +# shellcheck shell=bash disable=SC1091,SC2076 + +source /scripts/common + +SDIR=/etc/s6-overlay/finish.d + +# exit 0 for nonexistent or empty directory +if ! [[ -d "$SDIR" ]] || [[ -z "$(ls "$SDIR")" ]]; then + exit 0 +fi + +cd "$SDIR" || exit 1 + +for NAME in *; do + if ! s6wrap --quiet --prepend="$NAME" --timestamps --args "$SDIR/$NAME"; then + s6wrap --quiet --prepend=startup --timestamps --args echo Error running "$SDIR/$NAME" + exit 1 + fi +done diff --git a/rootfs/etc/s6-overlay/startup.d/01-sanity-check b/rootfs/etc/s6-overlay/startup.d/01-sanity-check index 274e64e..f38bc55 100755 --- a/rootfs/etc/s6-overlay/startup.d/01-sanity-check +++ b/rootfs/etc/s6-overlay/startup.d/01-sanity-check @@ -25,7 +25,7 @@ fi # Set up timezone if [ -z "${TZ}" ]; then - echo "${YELLOW}WARNING: TZ environment variable not set${NOCOLOR}" + echo -e "${YELLOW}WARNING: TZ environment variable not set${NOCOLOR}" else ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime && echo "$TZ" >/etc/timezone fi