Files
hassio-addons/.templates/00-banner.sh
Claude 4754794968 Migrate bashio::addon.* to bashio::app.* (deprecated API)
bashio now emits deprecation warnings for bashio::addon.* calls.
This migrates all 227 call-sites across 86 files to use the new
bashio::app.* API.

Cross-compatibility is preserved in two ways:
1. bashio-standalone.sh: adds bashio::app.* functions that forward to
   bashio::addon.* (used when running without HA Supervisor).
   Also adds the missing ingress_url, restart and stop stubs.
2. ha_entrypoint.sh: injects a one-liner compat shim after the shebang
   of every cont-init and service script at container startup. On old
   bashio installations (bashio::app.* absent) the shim defines
   bashio::app.* as thin wrappers around bashio::addon.*; on new bashio
   the guard condition is true so the block is a no-op.

The probe script in ha_entrypoint.sh is also updated to try
bashio::app.version before falling back to bashio::addon.version.

https://claude.ai/code/session_011FWFBhYQ6VS5FauSqv4UMo
2026-06-08 17:32:43 +00:00

60 lines
2.6 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 '-----------------------------------------------------------'
if [ ! -f /usr/bin/bashio ]; then
cp -rf /usr/local/lib/bashio-standalone.sh /usr/bin/bashio
fi
grep -rl "^#!.*bashio" /etc |
while IFS= read -r 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::app.name)"
bashio::log.blue " $(bashio::app.description)"
bashio::log.blue '-----------------------------------------------------------'
bashio::log.blue " Add-on version: $(bashio::app.version)"
if bashio::var.true "$(bashio::app.update_available)"; then
bashio::log.magenta " There is an update available!"
bashio::log.magenta " Latest version: $(bashio::app.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