Update 01-openvpn.sh

This commit is contained in:
Alexandre
2023-12-11 16:24:06 +01:00
committed by GitHub
parent 47154ee096
commit 5352b23671

View File

@@ -3,13 +3,25 @@
set -e
mkdir -p /config/openvpn
QBT_CONFIG_FILE="/config/qBittorrent/config/qBittorrent.conf"
if [ -d /config/openvpn ]; then
if [ -n "$(ls -A /config/openvpn 2>/dev/null)" ]; then
# Modify ovpn config
if ! grep -q route-nopull /etc/openvpn/config.ovpn; then
echo "... adding route-nopull to your config.ovpn"
sed -i "1a route-nopull" /etc/openvpn/config.ovpn
# Correct openvpn files
if [ bashio::config "VPN_ENABLED" == "yes" ]; then
# If there is a config file, add nopull
if [ -n "$(ls -A /config/openvpn 2>/dev/null)" ]; then
if ! grep -q route-nopull /etc/openvpn/config.ovpn; then
echo "... adding route-nopull to your config.ovpn"
sed -i "1a route-nopull" /etc/openvpn/config.ovpn
fi
fi
fi
else
# Ensure no redirection by removing the direction tag
if [ -f "$QBT_CONFIG_FILE" ]; then
sed -i '/Interface/d' "$QBT_CONFIG_FILE"
fi
bashio::log.info "... direct connection without VPN enabled"
fi