From 43007282a463a010d991e6a9a8fe20341da5747d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Mar 2026 18:55:28 +0000 Subject: [PATCH] Fix shebang probe rejecting valid interpreters when Supervisor API returns empty The probe script requires bashio::addon.version to return non-empty output, but the Supervisor API may not be ready during container init. This causes all shebang candidates to be rejected even though the interpreter works fine. Fix: output a 'PROBE_OK' marker when the script executes successfully but the version is empty. Also check /.bashio-standalone.sh as fallback path (some containers store it there instead of /usr/local/lib/). Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com> --- .templates/01-custom_script.sh | 13 ++++++++----- .templates/ha_entrypoint.sh | 15 +++++++++------ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.templates/01-custom_script.sh b/.templates/01-custom_script.sh index a3a845491..a4fb06a67 100755 --- a/.templates/01-custom_script.sh +++ b/.templates/01-custom_script.sh @@ -71,13 +71,16 @@ _rc=$? set -e if [ "$_rc" -ne 0 ] || [ -z "$_bv" ] || [ "$_bv" = "null" ]; then - if [ -f /usr/local/lib/bashio-standalone.sh ]; then - . /usr/local/lib/bashio-standalone.sh - _bv="$(bashio::addon.version)" - fi + for _sf in /usr/local/lib/bashio-standalone.sh /.bashio-standalone.sh; do + if [ -f "$_sf" ]; then + . "$_sf" + _bv="$(bashio::addon.version 2>/dev/null || true)" + break + fi + done fi -echo "$_bv" +echo "${_bv:-PROBE_OK}" ' validate_shebang() { diff --git a/.templates/ha_entrypoint.sh b/.templates/ha_entrypoint.sh index 8370520e1..fedc5f4af 100755 --- a/.templates/ha_entrypoint.sh +++ b/.templates/ha_entrypoint.sh @@ -90,14 +90,17 @@ _rc=$? set -e if [ "$_rc" -ne 0 ] || [ -z "$_bv" ] || [ "$_bv" = "null" ]; then - if [ -f /usr/local/lib/bashio-standalone.sh ]; then - # shellcheck disable=SC1091 - . /usr/local/lib/bashio-standalone.sh - _bv="$(bashio::addon.version)" - fi + for _sf in /usr/local/lib/bashio-standalone.sh /.bashio-standalone.sh; do + if [ -f "$_sf" ]; then + # shellcheck disable=SC1090 + . "$_sf" + _bv="$(bashio::addon.version 2>/dev/null || true)" + break + fi + done fi -echo "$_bv" +echo "${_bv:-PROBE_OK}" ' validate_shebang() {