Use CONFIG_LOCATION only for migration

This commit is contained in:
Alexandre
2026-01-09 10:11:18 +01:00
parent 2dd05df4c9
commit 6bbb3de5fe
32 changed files with 227 additions and 81 deletions

View File

@@ -0,0 +1,21 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
set -e
slug=seafile
legacy_path="/homeassistant/addons_config/$slug"
target_path="/config"
mkdir -p "$target_path"
if bashio::config.has_value 'CONFIG_LOCATION' && [ "$(bashio::config 'CONFIG_LOCATION')" != "/config" ]; then
legacy_path="$(bashio::config 'CONFIG_LOCATION')"
fi
if [ -d "$legacy_path" ]; then
if [ ! -f "$legacy_path/.migrated" ] || [ -z "$(ls -A "$target_path" 2>/dev/null)" ]; then
echo "Migrating $legacy_path to $target_path"
cp -rnf "$legacy_path"/. "$target_path"/ || true
touch "$legacy_path/.migrated"
fi
fi