From 1ff26c57e6f72f33ff62372a50c2ea409ad273aa Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Fri, 15 Aug 2025 19:19:05 +0200 Subject: [PATCH] templates: replace s6-svwait --- .templates/ha_entrypoint.sh | 5 ++++- scrutiny/CHANGELOG.md | 3 +++ scrutiny/config.json | 2 +- scrutiny/rootfs/etc/services.d/nginx/finish | 13 +++++++------ 4 files changed, 15 insertions(+), 8 deletions(-) mode change 100644 => 100755 scrutiny/rootfs/etc/services.d/nginx/finish diff --git a/.templates/ha_entrypoint.sh b/.templates/ha_entrypoint.sh index 115b65124..897e1f254 100755 --- a/.templates/ha_entrypoint.sh +++ b/.templates/ha_entrypoint.sh @@ -99,8 +99,11 @@ if $PID1; then sed -i "1s|^.*|#!$shebang|" "$runfile" # Replace s6-setuidgid calls with 'su' (bash-based) equivalents sed -i -E 's|^s6-setuidgid[[:space:]]+([a-zA-Z0-9._-]+)[[:space:]]+(.*)$|su -s /bin/bash \1 -c "\2"|g' "$runfile" + # Replace s6-svwait calls with bash-based waiting loops + sed -i -E 's|s6-svwait[[:space:]]+-d[[:space:]]+([^[:space:]]+)|bash -c '\''while [ -f \1/supervise/pid ]; do sleep 0.5; done'\''|g' "$runfile" + sed -i -E 's|s6-svwait[[:space:]]+-u[[:space:]]+([^[:space:]]+)|bash -c '\''until [ -f \1/supervise/pid ]; do sleep 0.5; done'\''|g' "$runfile" chmod +x "$runfile" - ( exec "$runfile" ) & true + ( exec "$runfile" ) & true done shopt -u nullglob fi diff --git a/scrutiny/CHANGELOG.md b/scrutiny/CHANGELOG.md index 2ddb16617..694a61f4f 100644 --- a/scrutiny/CHANGELOG.md +++ b/scrutiny/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.8.1-12 (16-08-2025) +- Replace s6-based shutdown with standard command to avoid s6-svwait error + ## v0.8.1-11 (15-08-2025) - Minor bugs fixed ## v0.8.1-10 (13-08-2025) diff --git a/scrutiny/config.json b/scrutiny/config.json index 46636cdbc..a4b384d30 100644 --- a/scrutiny/config.json +++ b/scrutiny/config.json @@ -120,5 +120,5 @@ "slug": "scrutiny", "udev": true, "url": "https://github.com/AnalogJ/scrutiny", - "version": "v0.8.1-11" + "version": "v0.8.1-12" } diff --git a/scrutiny/rootfs/etc/services.d/nginx/finish b/scrutiny/rootfs/etc/services.d/nginx/finish old mode 100644 new mode 100755 index 444240135..5ca74f2bf --- a/scrutiny/rootfs/etc/services.d/nginx/finish +++ b/scrutiny/rootfs/etc/services.d/nginx/finish @@ -1,8 +1,9 @@ -#!/usr/bin/execlineb -S0 +#!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== -# Take down the S6 supervision tree when Nginx fails +# Stop the container when Nginx fails # ============================================================================== -if { s6-test ${1} -ne 0 } -if { s6-test ${1} -ne 256 } - -s6-svscanctl -t /var/run/s6/services +if [[ "$1" -ne 0 && "$1" -ne 256 ]]; then + bashio::log.error "Nginx exited with code $1" + kill -15 1 +fi