Update photoprism config migration

This commit is contained in:
Alexandre
2026-01-09 10:01:06 +01:00
parent 31417d0297
commit 2d44ee234a
3 changed files with 22 additions and 9 deletions

View File

@@ -76,7 +76,6 @@ Configurations can be done through the app webUI, except for the following optio
| `IMPORT_PATH` | str | `/share/photoprism/import` | Import files path |
| `BACKUP_PATH` | str | `/share/photoprism/backup` | Backup storage path |
| `UPLOAD_NSFW` | bool | `true` | Allow uploads that may be offensive |
| `CONFIG_LOCATION` | str | | Location of additional config.yaml |
| `graphic_drivers` | list | | Graphics driver (mesa) |
| `ingress_disabled` | bool | | Disable ingress for direct IP:port access |
| `localdisks` | str | | Local drives to mount (e.g., `sda1,sdb1,MYNAS`) |

View File

@@ -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"

View File

@@ -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