From 14ac05bba343de7b2bef0a1e84aea84e866060ef Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Fri, 21 Feb 2025 09:20:31 +0100 Subject: [PATCH] Migrate files to new /config https://github.com/alexbelgium/hassio-addons/issues/1048?notification_referrer_id=NT_kwDOAqIdGbQxNDkxMzI0ODYwODo0NDE3ODcxMw#event-16395784949 --- jellyfin/rootfs/etc/cont-init.d/01-migrate.sh | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 jellyfin/rootfs/etc/cont-init.d/01-migrate.sh diff --git a/jellyfin/rootfs/etc/cont-init.d/01-migrate.sh b/jellyfin/rootfs/etc/cont-init.d/01-migrate.sh new file mode 100644 index 000000000..13978a7a9 --- /dev/null +++ b/jellyfin/rootfs/etc/cont-init.d/01-migrate.sh @@ -0,0 +1,29 @@ +#!/usr/bin/with-contenv bashio +# shellcheck shell=bash +set -e + +slug=jellyfin + +# Migration to new /config logic +if [[ "$LOCATION" == "/config/addons_config/"* ]]; then + bashio::log.warning "Data folder was $LOCATION, it is migrated to /config/data. The previous folder is renamed to _migrated" + LOCATION="${LOCATION/config/homeassistant}" + mkdir -p /config/data + if [ -d $LOCATION ]; then + cp -rf "$LOCATION"/* /config/data/ + mv "$LOCATION" "$LOCATION"_migrated + fi + bashio::addon.option "data_location" "/config/data" +fi + +# Migrate autoscripts +if [ -f "/homeassistant/addons_autoscripts/$slug.sh" ]; then + bashio::log.warning "Migrating autoscript" + mv /homeassistant/addons_autoscripts/$slug.sh /config/ || true +fi + +# Migrate config.yaml +if [ -f "/homeassistant/addons_config/$slug/config.yaml" ]; then + bashio::log.warning "Migrating config.yaml" + mv /homeassistant/addons_config/$slug/config.yaml /config/ || true +fi