Files
hassio-addons/photoprism/rootfs/etc/cont-init.d/01-migrate.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

32 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
set -e
slug=photoprism
new_config_location="/config"
new_config_dir="$new_config_location"
mkdir -p "$new_config_dir"
if bashio::config.has_value "CONFIG_LOCATION" && [[ "$(bashio::config "CONFIG_LOCATION")" != "/config" ]]; then
old_config_location="$(bashio::config "CONFIG_LOCATION")"
else
old_config_location="/config/addons_config/photoprism/config.yaml"
fi
old_config_dir="$(dirname "$old_config_location")"
if [ "$old_config_dir" != "$new_config_dir" ] && [ -d "$old_config_dir" ]; then
echo "Migrating $old_config_dir to /addon_configs/xxx-$slug"
cp -rnf "$old_config_dir"/. "$new_config_dir"/ || true
echo "Migrated to internal config folder accessible at /addon_configs/xxx-$slug" \
> "$old_config_dir/.migrate"
fi
if [ "$old_config_location" != "$new_config_location" ]; then
bashio::log.info "Updating CONFIG_LOCATION to $new_config_location"
bashio::app.option "CONFIG_LOCATION" "$new_config_location"
fi
if [ -d /config/addons_config ]; then
rm -rf /config/addons_config
fi