From 5a2c1a27a66277f977271d22f4a89a486cb41710 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sat, 15 Feb 2025 10:34:30 +0100 Subject: [PATCH] Allow migration --- immich/CHANGELOG.md | 1 + immich/Dockerfile | 2 +- immich/config.json | 8 ++++---- immich/rootfs/etc/cont-init.d/01-migrate.sh | 22 +++++++++++++++++++++ 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 immich/rootfs/etc/cont-init.d/01-migrate.sh diff --git a/immich/CHANGELOG.md b/immich/CHANGELOG.md index 99d1aeedc..ddef27e57 100644 --- a/immich/CHANGELOG.md +++ b/immich/CHANGELOG.md @@ -3,6 +3,7 @@ - SECURITY FIX : avoid hardcoding the postgres root password and change it if was already applied - Ensure host is reachable before starting - Autocorrect homeassistant.local to local ip +- Align configuration with /addon_configs ## 1.126.1 (15-02-2025) - Update to latest version from imagegenius/docker-immich (changelog : https://github.com/imagegenius/docker-immich/releases) diff --git a/immich/Dockerfile b/immich/Dockerfile index a3275fc13..d30c27ac4 100644 --- a/immich/Dockerfile +++ b/immich/Dockerfile @@ -31,7 +31,7 @@ USER root # Global LSIO modifications ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_lsio.sh" "/ha_lsio.sh" -ARG CONFIGLOCATION="/config/addons_config/immich" +ARG CONFIGLOCATION="/config" RUN chmod 744 /ha_lsio.sh && if grep -qr "lsio" /etc; then /ha_lsio.sh "$CONFIGLOCATION"; fi && rm /ha_lsio.sh # Install REDIS diff --git a/immich/config.json b/immich/config.json index cb76ca999..5b6630361 100644 --- a/immich/config.json +++ b/immich/config.json @@ -85,10 +85,10 @@ "image": "ghcr.io/alexbelgium/immich-{arch}", "init": false, "map": [ - "media:rw", - "config:rw", - "addons:rw", + "addon_config:rw", "backup:rw", + "homeassistant_config:rw", + "media:rw", "share:rw", "ssl:rw" ], @@ -141,6 +141,6 @@ "slug": "immich", "udev": true, "url": "https://github.com/alexbelgium/hassio-addons", - "version": "1.126.1-3", + "version": "1.126.1-4", "webui": "http://[HOST]:[PORT:8080]" } diff --git a/immich/rootfs/etc/cont-init.d/01-migrate.sh b/immich/rootfs/etc/cont-init.d/01-migrate.sh new file mode 100644 index 000000000..c6d381053 --- /dev/null +++ b/immich/rootfs/etc/cont-init.d/01-migrate.sh @@ -0,0 +1,22 @@ +#!/usr/bin/with-contenv bashio +# shellcheck shell=bash + +MIGRATED="" +PREVIOUS_FOLDER="immich" + +# Move main folder +if [ -f /homeassistant/addons_config/"$PREVIOUS_FOLDER"/config.yaml ]; then + bashio::log.warning "----------------------------------------" + bashio::log.warning "Migrating configuration to the new addon" + bashio::log.warning "----------------------------------------" + cp -rnp /homeassistant/addons_config/"$PREVIOUS_FOLDER"/ /config/ + mv /homeassistant/addons_config/"$PREVIOUS_FOLDER" "$PREVIOUS_FOLDER"_migrated + if [ -d /config/addons_config ]; then rm -r /config/addons_config; fi + echo "Files moved to /addon_configs/$HOSTNAME" +fi + +# Move autoscript +if [ -f /homeassistant/addons_autoscrips/immich.sh ]; then + cp -rnf /homeassistant/addons_autoscrips/"$PREVIOUS_FOLDER".sh /config/ &>/dev/null || true + bashio::log.yellow "... moved "$PREVIOUS_FOLDER".sh from /config/addons_autoscripts to /addon_configs/$HOSTNAME" +fi