Update 93-openvpn.sh

This commit is contained in:
Alexandre
2023-12-22 08:02:17 +01:00
committed by GitHub
parent e874a267e0
commit 4f0f8d6b0b

View File

@@ -56,7 +56,7 @@ if bashio::config.true 'openvpn_enabled'; then
cp /config/openvpn/* /etc/openvpn/ cp /config/openvpn/* /etc/openvpn/
# Standardize file # Standardize file
cp /config/openvpn/"${openvpn_config}" /etc/openvpn/config.ovpn cp /config/openvpn/"${openvpn_config}" /etc/openvpn/config.ovpn
 
# If openvpn_config not set, and folder is empty # If openvpn_config not set, and folder is empty
else else
bashio::exit.nok "Openvpn enabled, but no .ovpn files in the /addon_configs/$HOSTNAME/openvpn folder ! Exiting"   bashio::exit.nok "Openvpn enabled, but no .ovpn files in the /addon_configs/$HOSTNAME/openvpn folder ! Exiting"  
@@ -69,7 +69,7 @@ if bashio::config.true 'openvpn_enabled'; then
if grep -q "ipv6" /etc/openvpn/config.ovpn; then if grep -q "ipv6" /etc/openvpn/config.ovpn; then
bashio::log.warning "ipv6 configured in the ovpn file but not compatible with the addon. You should remove it." bashio::log.warning "ipv6 configured in the ovpn file but not compatible with the addon. You should remove it."
fi fi
 
# Set credentials # Set credentials
if bashio::config.has_value "openvpn_username"; then if bashio::config.has_value "openvpn_username"; then
openvpn_username=$(bashio::config 'openvpn_username') openvpn_username=$(bashio::config 'openvpn_username')
@@ -83,7 +83,7 @@ if bashio::config.true 'openvpn_enabled'; then
else else
bashio::exit.nok "Openvpn is enabled, but openvpn_password option is empty! Exiting" bashio::exit.nok "Openvpn is enabled, but openvpn_password option is empty! Exiting"
fi fi
 
# Add credentials file # Add credentials file
if grep -q auth-user-pass /etc/openvpn/config.ovpn; then if grep -q auth-user-pass /etc/openvpn/config.ovpn; then
sed -i "s/auth-user-pass.*/auth-user-pass \/etc\/openvpn\/credentials/g" /etc/openvpn/config.ovpn sed -i "s/auth-user-pass.*/auth-user-pass \/etc\/openvpn\/credentials/g" /etc/openvpn/config.ovpn