Use CONFIG_LOCATION only for migration

This commit is contained in:
Alexandre
2026-01-09 10:11:18 +01:00
parent 2dd05df4c9
commit 6bbb3de5fe
32 changed files with 227 additions and 81 deletions

View File

@@ -2,7 +2,7 @@
# shellcheck shell=bash
set -e
CONFIG_LOCATION=$(bashio::config 'CONFIG_LOCATION')
CONFIG_LOCATION="/config"
bashio::log.info "Config stored in $CONFIG_LOCATION"
mkdir -p "$CONFIG_LOCATION"
@@ -10,6 +10,6 @@ chown -R "$PUID:$PGID" "$CONFIG_LOCATION"
chmod -R 755 "$CONFIG_LOCATION"
# shellcheck disable=SC2013
for file in $(grep -Esril "/config/addons_config/overseerr" /etc/logrotate.d /defaults /etc/cont-init.d /etc/services.d /etc/s6-overlay/s6-rc.d); do
sed -i "s=/config/addons_config/overseerr=$CONFIG_LOCATION=g" "$file"
for file in $(grep -Esril "/config" /etc/logrotate.d /defaults /etc/cont-init.d /etc/services.d /etc/s6-overlay/s6-rc.d); do
sed -i "s=/config=$CONFIG_LOCATION=g" "$file"
done

View File

@@ -1,18 +1,26 @@
#!/bin/bash
if [ ! -d /config/addons_config/overseerr ]; then
echo "Creating /config/addons_config/overseerr"
mkdir -p /config/addons_config/overseerr
slug=overseerr
legacy_path="/homeassistant/addons_config/$slug"
target_path="/config"
mkdir -p "$target_path"
if bashio::config.has_value 'CONFIG_LOCATION' && [ "$(bashio::config 'CONFIG_LOCATION')" != "/config" ]; then
legacy_path="$(bashio::config 'CONFIG_LOCATION')"
fi
if [ -d /config/addons_config/addons_config/overseerr ]; then
echo "Migrating data to /config/addons_config/overseerr"
mv /config/addons_config/addons_config/overseerr /config/addons_config/overseerr
if [ -d "$legacy_path" ]; then
if [ ! -f "$legacy_path/.migrated" ] || [ -z "$(ls -A "$target_path" 2>/dev/null)" ]; then
echo "Migrating $legacy_path to $target_path"
cp -rnf "$legacy_path"/. "$target_path"/ || true
touch "$legacy_path/.migrated"
fi
fi
# shellcheck disable=SC2013
for file in $(grep -Esril "/config/.config/yarn" /usr /etc /defaults); do
sed -i "s=/config/.config/yarn=/config/addons_config/overseerr/yarn=g" "$file"
sed -i "s=/config/.config/yarn=/config/yarn=g" "$file"
done
yarn config set global-folder /config/addons_config/overseerr/yarn
chown -R "$PUID:$PGID" /config/addons_config/overseerr
yarn config set global-folder /config/yarn
chown -R "$PUID:$PGID" /config