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>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-07 18:55:28 +00:00
parent 50a7f44ff3
commit 43007282a4
2 changed files with 17 additions and 11 deletions

View File

@@ -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() {

View File

@@ -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() {