mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-31 04:44:05 +02:00
Merge pull request #284 from alexbelgium/create-pull-request/patch-1649549495
Apply beautysh changes
This commit is contained in:
@@ -55,7 +55,7 @@ if bashio::config.true 'openvpn_enabled'; then
|
|||||||
echo "... removing route-nopull from your config.ovpn"
|
echo "... removing route-nopull from your config.ovpn"
|
||||||
sed -i '/route-nopull/d' /etc/openvpn/config.ovpn
|
sed -i '/route-nopull/d' /etc/openvpn/config.ovpn
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Exit
|
# Exit
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@@ -63,48 +63,48 @@ if bashio::config.true 'openvpn_enabled'; then
|
|||||||
# WITH INTERFACE BINDING
|
# WITH INTERFACE BINDING
|
||||||
#########################
|
#########################
|
||||||
# Connection with interface binding
|
# Connection with interface binding
|
||||||
echo "Using interface binding in the qBittorrent app"
|
echo "Using interface binding in the qBittorrent app"
|
||||||
|
|
||||||
# Define preferences line
|
|
||||||
cd /config/qBittorrent/ || exit 1
|
|
||||||
LINE=$(sed -n '/Preferences/=' "$QBT_CONFIG_FILE")
|
|
||||||
LINE=$((LINE + 1))
|
|
||||||
SESSION=$(sed -n '/BitTorrent/=' "$QBT_CONFIG_FILE")
|
|
||||||
|
|
||||||
# If qBittorrent.conf exists
|
# Define preferences line
|
||||||
if [ -f "$QBT_CONFIG_FILE" ]; then
|
cd /config/qBittorrent/ || exit 1
|
||||||
# Remove previous line and bind tun0
|
LINE=$(sed -n '/Preferences/=' "$QBT_CONFIG_FILE")
|
||||||
echo "... deleting previous interface settings"
|
LINE=$((LINE + 1))
|
||||||
sed -i '/Interface/d' "$QBT_CONFIG_FILE"
|
SESSION=$(sed -n '/BitTorrent/=' "$QBT_CONFIG_FILE")
|
||||||
|
|
||||||
# Bind tun0
|
# If qBittorrent.conf exists
|
||||||
echo "... binding tun0 interface in qBittorrent configuration"
|
if [ -f "$QBT_CONFIG_FILE" ]; then
|
||||||
sed -i "$LINE i\Connection\\\Interface=tun0" "$QBT_CONFIG_FILE"
|
# Remove previous line and bind tun0
|
||||||
sed -i "$LINE i\Connection\\\InterfaceName=tun0" "$QBT_CONFIG_FILE"
|
echo "... deleting previous interface settings"
|
||||||
|
sed -i '/Interface/d' "$QBT_CONFIG_FILE"
|
||||||
|
|
||||||
if [ "$SESSION" != "" ]; then
|
# Bind tun0
|
||||||
SESSION=$((SESSION + 1))
|
echo "... binding tun0 interface in qBittorrent configuration"
|
||||||
sed -i "$SESSION i\Session\\\Interface=tun0" "$QBT_CONFIG_FILE"
|
sed -i "$LINE i\Connection\\\Interface=tun0" "$QBT_CONFIG_FILE"
|
||||||
sed -i "$SESSION i\Session\\\InterfaceName=tun0" "$QBT_CONFIG_FILE"
|
sed -i "$LINE i\Connection\\\InterfaceName=tun0" "$QBT_CONFIG_FILE"
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
if [ "$SESSION" != "" ]; then
|
||||||
bashio::log.error "qBittorrent config file doesn't exist, openvpn must be added manually to qbittorrent options "
|
SESSION=$((SESSION + 1))
|
||||||
exit 1
|
sed -i "$SESSION i\Session\\\Interface=tun0" "$QBT_CONFIG_FILE"
|
||||||
|
sed -i "$SESSION i\Session\\\InterfaceName=tun0" "$QBT_CONFIG_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Modify ovpn config
|
else
|
||||||
if ! grep -q route-nopull /etc/openvpn/config.ovpn; then
|
bashio::log.error "qBittorrent config file doesn't exist, openvpn must be added manually to qbittorrent options "
|
||||||
echo "... adding route-nopull to your config.ovpn"
|
exit 1
|
||||||
echo "route-nopull" >>/etc/openvpn/config.ovpn
|
fi
|
||||||
fi
|
|
||||||
|
# Modify ovpn config
|
||||||
|
if ! grep -q route-nopull /etc/openvpn/config.ovpn; then
|
||||||
|
echo "... adding route-nopull to your config.ovpn"
|
||||||
|
echo "route-nopull" >>/etc/openvpn/config.ovpn
|
||||||
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# REMOVE OPENVPN #
|
# REMOVE OPENVPN #
|
||||||
##################
|
##################
|
||||||
|
|
||||||
# Ensure no redirection by removing the direction tag
|
# Ensure no redirection by removing the direction tag
|
||||||
sed -i '/Interface/d' "$QBT_CONFIG_FILE"
|
sed -i '/Interface/d' "$QBT_CONFIG_FILE"
|
||||||
bashio::log.info "Direct connection without VPN enabled"
|
bashio::log.info "Direct connection without VPN enabled"
|
||||||
|
|||||||
Reference in New Issue
Block a user