mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-03 06:14:07 +02:00
Update photoprism config migration
This commit is contained in:
@@ -12,8 +12,7 @@ fi
|
||||
|
||||
bashio::log.info "Preparing scripts"
|
||||
echo "... creating structure"
|
||||
CONFIG_DIR="$(dirname "$(bashio::config "CONFIG_LOCATION")")"
|
||||
mkdir -p "$CONFIG_DIR"
|
||||
mkdir -p /config/photoprism
|
||||
mkdir -p \
|
||||
/data/photoprism/originals \
|
||||
/data/photoprism/import \
|
||||
@@ -25,8 +24,8 @@ echo "... setting permissions"
|
||||
chmod -R 777 /data/photoprism
|
||||
chown -Rf photoprism:photoprism /data/photoprism
|
||||
chmod -Rf a+rwx /data/photoprism
|
||||
chmod -R 777 "$CONFIG_DIR"
|
||||
chown -Rf photoprism:photoprism "$CONFIG_DIR"
|
||||
chmod -R 777 /config/photoprism
|
||||
chown -Rf photoprism:photoprism /config/photoprism
|
||||
for line in BACKUP_PATH IMPORT_PATH ORIGINALS_PATH STORAGE_PATH; do
|
||||
mkdir -p "$line"
|
||||
chmod -R 777 "$line"
|
||||
|
||||
@@ -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