mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-02-02 18:07:43 +01:00
Use CONFIG_LOCATION only for migration
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user