From 81b3914daf50d50b9cd4602f79f153fc9f83c612 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Sat, 9 Dec 2023 15:16:14 +0100 Subject: [PATCH] Update 00-migration.sh --- .../rootfs/etc/cont-init.d/00-migration.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/qbittorrent/rootfs/etc/cont-init.d/00-migration.sh b/qbittorrent/rootfs/etc/cont-init.d/00-migration.sh index c764b1ded..e63dbad52 100755 --- a/qbittorrent/rootfs/etc/cont-init.d/00-migration.sh +++ b/qbittorrent/rootfs/etc/cont-init.d/00-migration.sh @@ -7,6 +7,8 @@ mkdir -p /config/openvpn mkdir -p /config/qBittorrent/config mkdir -p /config/qBittorrent/data +MIGRATED="" + if [ -f /homeassistant/addons_config/qBittorrent/qBittorrent.conf ]; then bashio::log.warning "----------------------------------------" bashio::log.warning "Migrating configuration to the new addon" @@ -33,11 +35,13 @@ if [ -f /homeassistant/addons_config/qbittorrent/config.yaml ]; then mv /homeassistant/addons_config/qbittorrent/* /config/ rm -r /homeassistant/addons_config/qbittorrent bashio::log.yellow "... moved config.yaml from /config/addons_config/qbittorrent to /addon_configs/$HOSTNAME" + MIGRATED=true fi || true if [ -f /homeassistant/addons_autoscrips/qbittorrent.sh ]; then mv /homeassistant/addons_autoscrips/qbittorrent.sh /config/ bashio::log.yellow "... moved qbittorrent.sh from /config/addons_autoscripts to /addon_configs/$HOSTNAME" + MIGRATED=true fi || true if bashio::config.has_value 'openvpn_enable'; then @@ -49,6 +53,7 @@ if bashio::config.has_value 'openvpn_enable'; then fi bashio::addon.option "openvpn_enable" bashio::log.yellow "... openvpn_enable : removed as not used anymore" + MIGRATED=true fi || true if bashio::config.has_value 'openvpn_username'; then @@ -56,6 +61,7 @@ if bashio::config.has_value 'openvpn_username'; then bashio::log.yellow "... openvpn_username : was set, VPN_USERNAME set to $(bashio::config "openvpn_username")" bashio::addon.option "openvpn_username" bashio::log.yellow "... openvpn_username : removed as not used anymore" + MIGRATED=true fi || true if bashio::config.has_value 'Username'; then @@ -63,6 +69,7 @@ if bashio::config.has_value 'Username'; then bashio::log.yellow "... Username : was set, QBT_USERNAME set to $(bashio::config "Username")" bashio::addon.option "Username" bashio::log.yellow "... Username : removed as not used anymore" + MIGRATED=true fi || true if bashio::config.has_value 'openvpn_password'; then @@ -70,6 +77,7 @@ if bashio::config.has_value 'openvpn_password'; then bashio::log.yellow "... openvpn_password : was set, VPN_PASSWORD set to $(bashio::config "openvpn_password")" bashio::addon.option "openvpn_password" bashio::log.yellow "... openvpn_password : removed as not used anymore" + MIGRATED=true fi || true if bashio::config.has_value 'whitelist'; then @@ -77,11 +85,13 @@ if bashio::config.has_value 'whitelist'; then bashio::log.yellow "... whitelist : was set, LAN_NETWORK set to $(bashio::config "whitelist")" bashio::addon.option "whitelist" bashio::log.yellow "... whitelist : removed as not used anymore" + MIGRATED=true fi || true if bashio::config.has_value 'smbv1'; then bashio::addon.option "smbv1" bashio::log.yellow "... smbv1 : removed as not used anymore" + MIGRATED=true fi || true if bashio::config.has_value 'openvpn_config'; then @@ -89,8 +99,15 @@ if bashio::config.has_value 'openvpn_config'; then if [ -f "$openvpn_config" ]; then mv "$openvpn_config" /config/openvpn/ fi + MIGRATED=true fi || true +if [[ "$MIGRATED" == "true" ]]; then + bashio::log.warning "Options were changed, restarting the addon" + bashio::addon.restart +fi + + if [ -d /config/qBittorrent/qBittorrent ]; then rm -r /config/qBittorrent/qBittorrent fi || true