From 5c81835b26c1692c32a225f1f34fba8e380cf484 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 1 Mar 2022 07:49:48 +0100 Subject: [PATCH] Update 93-openvpn.sh --- qbittorrent/rootfs/etc/cont-init.d/93-openvpn.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/qbittorrent/rootfs/etc/cont-init.d/93-openvpn.sh b/qbittorrent/rootfs/etc/cont-init.d/93-openvpn.sh index 379437a8e..eacd6a8fc 100644 --- a/qbittorrent/rootfs/etc/cont-init.d/93-openvpn.sh +++ b/qbittorrent/rootfs/etc/cont-init.d/93-openvpn.sh @@ -53,20 +53,23 @@ if bashio::config.true 'openvpn_enabled'; then cd /config/qBittorrent/ || exit 1 LINE=$(sed -n '/Preferences/=' qBittorrent.conf) LINE=$((LINE + 1)) - if [ "$SESSION" != "" ]; then - SESSION=$(sed -n '/BitTorrent/=' qBittorrent.conf) - SESSION=$((SESSION + 1)) - fi + SESSION=$(sed -n '/BitTorrent/=' qBittorrent.conf) # If qBittorrent.conf exists if [ -f "$QBT_CONFIG_FILE" ]; 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 - sed -i "$SESSION i\Session\\\Interface=tun0" qBittorrent.conf - sed -i "$SESSION i\Session\\\InterfaceName=tun0" qBittorrent.conf + + if [ "$SESSION" != "" ]; then + SESSION=$((SESSION + 1)) + sed -i "$SESSION i\Session\\\Interface=tun0" qBittorrent.conf + sed -i "$SESSION i\Session\\\InterfaceName=tun0" qBittorrent.conf + fi + else bashio::log.error "qBittorrent config file doesn't exist, openvpn must be added manually to qbittorrent options " exit 1