mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-07-09 07:20:58 +02:00
Update photoprism config migration
This commit is contained in:
@@ -3,12 +3,27 @@
|
||||
set -e
|
||||
|
||||
slug=photoprism
|
||||
new_config_location="/config/photoprism/config.yaml"
|
||||
new_config_dir="$(dirname "$new_config_location")"
|
||||
mkdir -p "$new_config_dir"
|
||||
|
||||
if [ -d "/homeassistant/addons_config/$slug" ]; then
|
||||
echo "Migrating /homeassistant/addons_config/$slug to /addon_configs/xxx-$slug"
|
||||
cp -rnf /homeassistant/addons_config/"$slug"/. /config/ || true
|
||||
if bashio::config.has_value "CONFIG_LOCATION"; 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" \
|
||||
> "/homeassistant/addons_config/$slug/.migrate"
|
||||
> "$old_config_dir/.migrate"
|
||||
fi
|
||||
|
||||
if [ "$old_config_location" != "$new_config_location" ]; then
|
||||
bashio::log.info "Updating CONFIG_LOCATION to $new_config_location"
|
||||
bashio::addon.option "CONFIG_LOCATION" "$new_config_location"
|
||||
fi
|
||||
|
||||
if [ -d /config/addons_config ]; then
|
||||
|
||||
Reference in New Issue
Block a user