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-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