Config location changed

This commit is contained in:
Alexandre
2022-09-11 07:30:35 +02:00
parent 0013016737
commit b0c501eaab
5 changed files with 32 additions and 20 deletions

View File

@@ -1,4 +1,10 @@
#!/bin/bash
mkdir -p /config/qBittorrent
mkdir -p /config/addons_config/qBittorrent
if [ -f /config/qBittorrent/qBittorrent.conf ]; then
echo "Migrating previous folder"
cp -prf /config/qBittorrent/* /config/addons_config/qBittorrent/
rm -r /config/qBittorrent/*
echo "Files were moved to /config/addons_config/qBittorrent" > /config/qBittorrent/filesmoved
fi

View File

@@ -6,14 +6,14 @@
##########
# Define preferences line
mkdir -p /config/qBittorrent
mkdir -p /config/addons_config/qBittorrent
# copy default config
if [ ! -f /config/qBittorrent/qBittorrent.conf ]; then
cp /defaults/qBittorrent.conf /config/qBittorrent/qBittorrent.conf
if [ ! -f /config/addons_config/qBittorrent/qBittorrent.conf ]; then
cp /defaults/qBittorrent.conf /config/addons_config/qBittorrent/qBittorrent.conf
fi
cd /config/qBittorrent/ || true
cd /config/addons_config/qBittorrent/ || true
LINE=$(sed -n '/Preferences/=' qBittorrent.conf)
LINE=$((LINE + 1))
@@ -39,11 +39,12 @@ if bashio::config.has_value 'SavePath'; then
# Replace save path
CURRENTSAVEPATH=$(sed -n '/Downloads\\SavePath/p' qBittorrent.conf)
sed -i "s|${CURRENTSAVEPATH#*=}|$DOWNLOADS|g" qBittorrent.conf 2>/dev/null || true
sed -i "s|${CURRENTSAVEPATH#*=}|$DOWNLOADS|g" qBittorrent.conf || \
sed -i "${LINE}a Downloads\\SavePath\\$DOWNLOADS" qBittorrent.conf
# Replace session save path
CURRENTSAVEPATH=$(sed -n '/Session\\DefaultSavePath/p' qBittorrent.conf)
sed -i "s|${CURRENTSAVEPATH#*=}|$DOWNLOADS|g" qBittorrent.conf 2>/dev/null || true
sed -i "s|${CURRENTSAVEPATH#*=}|$DOWNLOADS|g" qBittorrent.conf || true
# Info
bashio::log.info "Downloads can be found in $DOWNLOADS"
@@ -100,7 +101,7 @@ fi
# WHITELIST #
################
cd /config/qBittorrent/ || true
cd /config/addons_config/qBittorrent/ || true
if bashio::config.has_value 'whitelist'; then
WHITELIST=$(bashio::config 'whitelist')
#clean data
@@ -114,7 +115,7 @@ fi
# USERNAME #
###############
cd /config/qBittorrent/ || true
cd /config/addons_config/qBittorrent/ || true
if bashio::config.has_value 'Username'; then
USERNAME=$(bashio::config 'Username')
#clean data
@@ -162,8 +163,8 @@ if bashio::config.has_value 'customUI' && [ ! "$CUSTOMUI" = default ]; then
rm /webui/*.zip
CUSTOMUIDIR="$(dirname "$(find /webui/"$CUSTOMUI" -iname "public" -type d)")"
# Set qbittorrent
sed -i "$LINE i\WebUI\\\AlternativeUIEnabled=true" /config/qBittorrent/qBittorrent.conf
sed -i "$LINE i\WebUI\\\RootFolder=$CUSTOMUIDIR" /config/qBittorrent/qBittorrent.conf
sed -i "$LINE i\WebUI\\\AlternativeUIEnabled=true" /config/addons_config/qBittorrent/qBittorrent.conf
sed -i "$LINE i\WebUI\\\RootFolder=$CUSTOMUIDIR" /config/addons_config/qBittorrent/qBittorrent.conf
# Set nginx
#sed -i "s=/vuetorrent/public/=$CUSTOMUIDIR/public/=g" /etc/nginx/servers/ingress.conf
#sed -i "s=vue.torrent=$CUSTOMUI.torrent=g" /etc/nginx/servers/ingress.conf
@@ -175,4 +176,4 @@ fi
##########
bashio::log.info "Default username/password : admin/adminadmin"
bashio::log.info "Configuration can be found in /config/qBittorrent"
bashio::log.info "Configuration can be found in /config/addons_config/qBittorrent"

View File

@@ -6,7 +6,7 @@ declare openvpn_config
declare openvpn_username
declare openvpn_password
QBT_CONFIG_FILE="/config/qBittorrent/qBittorrent.conf"
QBT_CONFIG_FILE="/config/addons_config/qBittorrent/qBittorrent.conf"
if bashio::config.true 'openvpn_enabled'; then
@@ -69,7 +69,7 @@ if bashio::config.true 'openvpn_enabled'; then
echo "Using interface binding in the qBittorrent app"
# Define preferences line
cd /config/qBittorrent/ || exit 1
cd /config/addons_config/qBittorrent/ || exit 1
LINE=$(sed -n '/Preferences/=' "$QBT_CONFIG_FILE")
LINE=$((LINE + 1))
SESSION=$(sed -n '/BitTorrent/=' "$QBT_CONFIG_FILE")