mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-02-01 01:17:42 +01:00
Migrate *arr addons to addon_configs
This commit is contained in:
@@ -6,15 +6,17 @@ if bashio::config.has_value 'CONFIG_LOCATION'; then
|
||||
CONFIG_LOCATION="$(bashio::config 'CONFIG_LOCATION')"
|
||||
# Modify if it is a base directory
|
||||
if [[ "$CONFIG_LOCATION" == *.* ]]; then CONFIG_LOCATION="$(dirname "$CONFIG_LOCATION")"; fi
|
||||
else
|
||||
CONFIG_LOCATION="/config"
|
||||
fi
|
||||
|
||||
CONFIG_LOCATION=$(bashio::config 'CONFIG_LOCATION')
|
||||
bashio::log.info "Config stored in $CONFIG_LOCATION"
|
||||
|
||||
mkdir -p "$CONFIG_LOCATION"
|
||||
chown -R "$PUID:$PGID" "$CONFIG_LOCATION"
|
||||
|
||||
# shellcheck disable=SC2013
|
||||
for file in $(grep -sril "/config/addons_config/readarr" /etc /defaults); do
|
||||
sed -i "s|/config/addons_config/readarr|$CONFIG_LOCATION|g" "$file"
|
||||
done
|
||||
if [ "$CONFIG_LOCATION" != "/config" ]; then
|
||||
# shellcheck disable=SC2013
|
||||
for file in $(grep -sril "/config" /etc /defaults); do
|
||||
sed -i "s|/config|$CONFIG_LOCATION|g" "$file"
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
set -e
|
||||
|
||||
if [ ! -d /share/storage/ebook ]; then
|
||||
echo "Creating /share/storage/ebook"
|
||||
@@ -12,21 +14,15 @@ if [ ! -d /share/downloads ]; then
|
||||
chown -R "$PUID:$PGID" /share/downloads
|
||||
fi
|
||||
|
||||
if [ -d /config/readarr ] && [ ! -d /config/addons_config/readarr ]; then
|
||||
echo "Moving to new location /config/addons_config/readarr"
|
||||
mkdir -p /config/addons_config/readarr
|
||||
chown -R "$PUID:$PGID" /config/addons_config/readarr
|
||||
mv /config/readarr/* /config/addons_config/readarr/
|
||||
rm -r /config/readarr
|
||||
slug=readarr
|
||||
|
||||
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
|
||||
mv /homeassistant/addons_config/"$slug" /homeassistant/addons_config/"$slug"_migrated
|
||||
fi
|
||||
|
||||
if [ ! -d /config/addons_config/readarr ]; then
|
||||
echo "Creating /config/addons_config/readarr"
|
||||
mkdir -p /config/addons_config/readarr
|
||||
chown -R "$PUID:$PGID" /config/addons_config/readarr
|
||||
fi
|
||||
|
||||
if [ -d /config/addons_config/readarr/readarr ]; then
|
||||
mv /config/addons_config/readarr/readarr/{.,}* /config/addons_config/readarr/
|
||||
rmdir /config/addons_config/readarr/readarr
|
||||
if [ -d /config/readarr ]; then
|
||||
mv /config/readarr/{.,}* /config/ || true
|
||||
rmdir /config/readarr || true
|
||||
fi
|
||||
|
||||
@@ -21,7 +21,7 @@ sed -i "s|%%ingress_entry%%|${ingress_entry}|g" /etc/nginx/servers/ingress.conf
|
||||
|
||||
# Values
|
||||
slug=readarr
|
||||
CONFIG_LOCATION=/config/addons_config/"$slug"/config.xml
|
||||
CONFIG_LOCATION=/config/config.xml
|
||||
|
||||
if [ -f "$CONFIG_LOCATION" ]; then
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ set -e
|
||||
# Set variables
|
||||
slug=readarr
|
||||
port=8787
|
||||
CONFIG_LOCATION=/config/addons_config/"$slug"/config.xml
|
||||
CONFIG_LOCATION=/config/config.xml
|
||||
|
||||
# Wait for transmission to become available
|
||||
bashio::net.wait_for "$port" localhost 900
|
||||
|
||||
Reference in New Issue
Block a user