mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-07-08 06:50:58 +02:00
move config to addons_config
This commit is contained in:
16
qbittorrent/rootfs/etc/cont-init.d/20-folders.sh
Normal file
16
qbittorrent/rootfs/etc/cont-init.d/20-folders.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
slug=qBittorrent
|
||||
|
||||
if [ -d /config/$slug ]; then
|
||||
echo "Moving to new location /config/addons_config/$slug"
|
||||
mkdir -p /config/addons_config/$slug
|
||||
chmod 777 /config/addons_config/$slug
|
||||
mv /config/$slug/* /config/addons_config/$slug/
|
||||
fi
|
||||
|
||||
if [ ! -d /config/addons_config/$slug ]; then
|
||||
echo "Creating /config/addons_config/$slug"
|
||||
mkdir -p /config/addons_config/$slug
|
||||
chmod 777 /config/addons_config/$slug
|
||||
fi
|
||||
@@ -5,7 +5,7 @@
|
||||
##########
|
||||
|
||||
# Define preferences line
|
||||
cd /config/qBittorrent/
|
||||
cd /config/addon_config/qBittorrent/
|
||||
LINE=$(sed -n '/Preferences/=' qBittorrent.conf)
|
||||
LINE=$((LINE + 1))
|
||||
|
||||
@@ -19,7 +19,7 @@ if bashio::config.has_value 'run_duration'; then
|
||||
chmod +x /etc/services.d/qbittorrent/run
|
||||
else
|
||||
rm /etc/services.d/qbittorrent/timer
|
||||
fi
|
||||
fi
|
||||
|
||||
##################
|
||||
# Default folder #
|
||||
@@ -59,7 +59,7 @@ if bashio::config.true 'ssl'; then
|
||||
#set variables
|
||||
CERTFILE=$(bashio::config 'certfile')
|
||||
KEYFILE=$(bashio::config 'keyfile')
|
||||
|
||||
|
||||
#Modify configuration
|
||||
sed -i "$LINE i\WebUI\\\HTTPS\\\Enabled=True" qBittorrent.conf
|
||||
sed -i "$LINE i\WebUI\\\HTTPS\\\CertificatePath=/ssl/$CERTFILE" qBittorrent.conf
|
||||
@@ -70,7 +70,7 @@ fi
|
||||
# WHITELIST #
|
||||
################
|
||||
|
||||
cd /config/qBittorrent/
|
||||
cd /config/addon_config/qBittorrent/
|
||||
if bashio::config.has_value 'whitelist'; then
|
||||
WHITELIST=$(bashio::config 'whitelist')
|
||||
#clean data
|
||||
@@ -84,7 +84,7 @@ fi
|
||||
# USERNAME #
|
||||
###############
|
||||
|
||||
cd /config/qBittorrent/
|
||||
cd /config/addon_config/qBittorrent/
|
||||
if bashio::config.has_value 'Username'; then
|
||||
USERNAME=$(bashio::config 'Username')
|
||||
#clean data
|
||||
@@ -112,7 +112,7 @@ if bashio::config.has_value 'customUI'; then
|
||||
|
||||
### Download WebUI
|
||||
case $CUSTOMUI in
|
||||
"vuetorrent")
|
||||
"vuetorrent")
|
||||
curl -s -S -J -L -o /webui/release.zip $(curl -s https://api.github.com/repos/WDaan/VueTorrent/releases/latest | grep -o "http.*vuetorrent.zip") >/dev/null
|
||||
;;
|
||||
|
||||
@@ -131,11 +131,11 @@ if bashio::config.has_value 'customUI'; 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/addon_config/qBittorrent/qBittorrent.conf
|
||||
sed -i "$LINE i\WebUI\\\RootFolder=$CUSTOMUIDIR" /config/addon_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
|
||||
#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
|
||||
|
||||
fi
|
||||
|
||||
@@ -144,4 +144,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/addon_config/qBittorrent"
|
||||
|
||||
@@ -6,28 +6,28 @@ declare openvpn_username
|
||||
declare openvpn_password
|
||||
|
||||
if bashio::config.true 'openvpn_enabled'; then
|
||||
|
||||
|
||||
bashio::log.info "Configuring openvpn"
|
||||
|
||||
#####################
|
||||
# CONFIGURE OPENVPN #
|
||||
#####################
|
||||
|
||||
|
||||
openvpn_config=$(bashio::config 'openvpn_config')
|
||||
|
||||
cp "/config/openvpn/${openvpn_config}" /etc/openvpn/config.ovpn || bashio::log.error "openvpn config file not found in /config/openvpn/${openvpn_config}"
|
||||
cp "/config/openvpn/${openvpn_config}" /etc/openvpn/config.ovpn || bashio::log.error "openvpn config file not found in /config/openvpn/${openvpn_config}"
|
||||
|
||||
openvpn_username=$(bashio::config 'openvpn_username')
|
||||
echo "${openvpn_username}" > /etc/openvpn/credentials
|
||||
echo "${openvpn_username}" >/etc/openvpn/credentials
|
||||
openvpn_password=$(bashio::config 'openvpn_password')
|
||||
echo "${openvpn_password}" >> /etc/openvpn/credentials
|
||||
echo "${openvpn_password}" >>/etc/openvpn/credentials
|
||||
sed -i 's/auth-user-pass.*/auth-user-pass \/etc\/openvpn\/credentials/g' /etc/openvpn/config.ovpn
|
||||
|
||||
|
||||
# Permissions
|
||||
chmod 600 /etc/openvpn/credentials
|
||||
chmod 755 /etc/openvpn/up.sh
|
||||
chmod 755 /etc/openvpn/down.sh
|
||||
chmod 755 /etc/openvpn/up-qbittorrent.sh
|
||||
chmod 755 /etc/openvpn/up-qbittorrent.sh
|
||||
chmod +x /etc/openvpn/up.sh
|
||||
chmod +x /etc/openvpn/up-qbittorrent.sh
|
||||
|
||||
@@ -36,24 +36,24 @@ if bashio::config.true 'openvpn_enabled'; then
|
||||
#########################
|
||||
# CONFIGURE QBITTORRENT #
|
||||
#########################
|
||||
|
||||
QBT_CONFIG_FILE="/config/qBittorrent/qBittorrent.conf"
|
||||
|
||||
QBT_CONFIG_FILE="/config/addon_config/qBittorrent/qBittorrent.conf"
|
||||
# Define preferences line
|
||||
cd /config/qBittorrent/
|
||||
cd /config/addon_config/qBittorrent/
|
||||
LINE=$(sed -n '/Preferences/=' qBittorrent.conf)
|
||||
LINE=$((LINE + 1))
|
||||
|
||||
|
||||
# If qBittorrent.conf exists
|
||||
if [ -f "$QBT_CONFIG_FILE" ]; then
|
||||
# Remove previous line and bind tun0
|
||||
sed -i '/Interface/d' qBittorrent.conf
|
||||
# sed -i '/PortRangeMin/d' qBittorrent.conf
|
||||
# Bind tun0
|
||||
# sed -i "$LINE i\Connection\\\Interface=tun0" qBittorrent.conf
|
||||
# sed -i "$LINE i\Connection\\\InterfaceName=tun0" qBittorrent.conf
|
||||
if [ -f "$QBT_CONFIG_FILE" ]; then
|
||||
# Remove previous line and bind tun0
|
||||
sed -i '/Interface/d' qBittorrent.conf
|
||||
# sed -i '/PortRangeMin/d' qBittorrent.conf
|
||||
# Bind tun0
|
||||
# sed -i "$LINE i\Connection\\\Interface=tun0" qBittorrent.conf
|
||||
# sed -i "$LINE i\Connection\\\InterfaceName=tun0" qBittorrent.conf
|
||||
else
|
||||
bashio::log.error "qBittorrent config file doesn't exist, openvpn must be added manually to qbittorrent options "
|
||||
exit 1
|
||||
bashio::log.error "qBittorrent config file doesn't exist, openvpn must be added manually to qbittorrent options "
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#####################
|
||||
@@ -61,13 +61,13 @@ if bashio::config.true 'openvpn_enabled'; then
|
||||
#####################
|
||||
|
||||
if bashio::config.true 'openvpn_alternative_mode'; then
|
||||
# Remove previous line and bind tun0
|
||||
sed -i '/Interface/d' qBittorrent.conf
|
||||
# Bind tun0
|
||||
sed -i "$LINE i\Connection\\\Interface=tun0" qBittorrent.conf
|
||||
sed -i "$LINE i\Connection\\\InterfaceName=tun0" qBittorrent.conf
|
||||
# Modify ovpn config
|
||||
echo "route-nopull" >> /etc/openvpn/config.ovpn
|
||||
# Remove previous line and bind tun0
|
||||
sed -i '/Interface/d' qBittorrent.conf
|
||||
# Bind tun0
|
||||
sed -i "$LINE i\Connection\\\Interface=tun0" qBittorrent.conf
|
||||
sed -i "$LINE i\Connection\\\InterfaceName=tun0" qBittorrent.conf
|
||||
# Modify ovpn config
|
||||
echo "route-nopull" >>/etc/openvpn/config.ovpn
|
||||
fi
|
||||
|
||||
else
|
||||
@@ -76,8 +76,8 @@ else
|
||||
# REMOVE OPENVPN #
|
||||
##################
|
||||
# Ensure no redirection by removing the direction tag
|
||||
cd /config/qBittorrent/
|
||||
sed -i '/Interface/d' qBittorrent.conf
|
||||
cd /config/addon_config/qBittorrent/
|
||||
sed -i '/Interface/d' qBittorrent.conf
|
||||
bashio::log.info "Direct connection without VPN enabled"
|
||||
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user