mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-04-12 18:39:55 +02:00
Update 01-openvpn.sh
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user