Merge pull request #2532 from alexbelgium/copilot/fix-docker-compose-errors

Fix standalone Docker Compose mode: fallback to bashio-standalone when no Supervisor
This commit is contained in:
Alexandre
2026-02-25 22:11:05 +01:00
committed by GitHub
3 changed files with 34 additions and 4 deletions

View File

@@ -7,12 +7,15 @@ set -e
# ======================================================================
if ! bashio::supervisor.ping 2>/dev/null; then
# Source standalone bashio first to provide function definitions
if [ -f /usr/local/lib/bashio-standalone.sh ]; then
source /usr/local/lib/bashio-standalone.sh
fi
bashio::log.blue '-----------------------------------------------------------'
bashio::log.blue "Starting addon in standalone mode (no Supervisor)"
bashio::log.blue "Version : ${BUILD_VERSION:-1.0}"
bashio::log.blue "Config source: ENV + /data/options.json"
bashio::log.blue '-----------------------------------------------------------'
source /usr/local/lib/bashio-standalone.sh
cp -rf /usr/local/lib/bashio-standalone.sh /usr/bin/bashio
grep -rlZ "^#!.*bashio" /etc |
while IFS= read -r -d '' f; do

View File

@@ -64,7 +64,20 @@ if ! command -v bashio::addon.version >/dev/null 2>&1; then
done
fi
bashio::addon.version
# Try regular bashio, fallback to standalone if unavailable or fails
set +e
_bv="$(bashio::addon.version 2>/dev/null)"
_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
fi
echo "$_bv"
'
validate_shebang() {
@@ -133,7 +146,7 @@ fi
sed -i "1s|^.*|#!$shebang|" "$0"
if ! command -v bashio::addon.version >/dev/null 2>&1; then
for f in /usr/lib/bashio/bashio.sh /usr/lib/bashio/lib.sh /usr/src/bashio/bashio.sh /usr/local/lib/bashio/bashio.sh; do
for f in /usr/lib/bashio/bashio.sh /usr/lib/bashio/lib.sh /usr/src/bashio/bashio.sh /usr/local/lib/bashio/bashio.sh /usr/local/lib/bashio-standalone.sh; do
if [ -f "$f" ]; then
# shellcheck disable=SC1090
. "$f"

View File

@@ -83,7 +83,21 @@ if ! command -v bashio::addon.version >/dev/null 2>&1; then
done
fi
bashio::addon.version
# Try regular bashio, fallback to standalone if unavailable or fails
set +e
_bv="$(bashio::addon.version 2>/dev/null)"
_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
fi
echo "$_bv"
'
validate_shebang() {