Files
hassio-addons/.templates/00-banner.sh
copilot-swe-agent[bot] 2f9721e0d7 Fix standalone Docker Compose mode: fallback to bashio-standalone when no Supervisor
- ha_entrypoint.sh: probe_script_content now tries regular bashio first,
  falls back to bashio-standalone.sh if Supervisor API unreachable
- 00-banner.sh: source bashio-standalone before calling bashio functions
  in standalone branch (prevents undefined function errors with set -e)
- 01-custom_script.sh: same probe fix + add bashio-standalone.sh to
  fallback source chain

Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com>
2026-02-25 16:43:19 +00:00

58 lines
2.5 KiB
Bash
Executable File

#!/usr/bin/with-contenv bashio
# shellcheck shell=bash disable=SC2016
set -e
# ======================================================================
# Banner
# ======================================================================
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 '-----------------------------------------------------------'
cp -rf /usr/local/lib/bashio-standalone.sh /usr/bin/bashio
grep -rlZ "^#!.*bashio" /etc |
while IFS= read -r -d '' f; do
grep -qF "source /usr/local/lib/bashio-standalone.sh" "$f" && continue
sed -i '1a source /usr/local/lib/bashio-standalone.sh' "$f"
done
else
bashio::log.blue '-----------------------------------------------------------'
bashio::log.blue " Add-on: $(bashio::addon.name)"
bashio::log.blue " $(bashio::addon.description)"
bashio::log.blue '-----------------------------------------------------------'
bashio::log.blue " Add-on version: $(bashio::addon.version)"
if bashio::var.true "$(bashio::addon.update_available)"; then
bashio::log.magenta " There is an update available!"
bashio::log.magenta " Latest version: $(bashio::addon.version_latest)"
else
bashio::log.green " You are running the latest version."
fi
bashio::log.blue " System: $(bashio::info.operating_system)"
bashio::log.blue " Architecture: $(bashio::info.arch) / $(bashio::info.machine)"
bashio::log.blue " Home Assistant Core: $(bashio::info.homeassistant)"
bashio::log.blue " Home Assistant Supervisor: $(bashio::info.supervisor)"
fi
bashio::log.blue '-----------------------------------------------------------'
bashio::log.green ' Provided by: https://github.com/alexbelgium/hassio-addons '
bashio::log.blue '-----------------------------------------------------------'
# Adapt user abc
if command -v id &>/dev/null && id abc &>/dev/null; then
if bashio::config.has_value "PUID" && bashio::config.has_value "PGID"; then
PUID="$(bashio::config "PUID")"
PGID="$(bashio::config "PGID")"
usermod -o -u "${PUID:-0}" abc
groupmod -o -g "${PGID:-0}" abc
fi
fi