mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-28 07:27:38 +01:00
Merge branch 'master' of https://github.com/alexbelgium/hassio-addons
This commit is contained in:
@@ -14,11 +14,6 @@ if bashio::config.true 'openvpn_enabled'; then
|
|||||||
bashio::log.info "Openvpn enabled, configuring"
|
bashio::log.info "Openvpn enabled, configuring"
|
||||||
bashio::log.info "----------------------------"
|
bashio::log.info "----------------------------"
|
||||||
|
|
||||||
# If openvpn_config not set, but folder is not empty
|
|
||||||
if [ ! "$(ls -A /config/openvpn/*.ovpn 2>/dev/null)" ]; then
|
|
||||||
bashio::exit.nok "Configured ovpn file : $openvpn_config not found! Are you sure you added it in /addon_configs/$HOSTNAME/openvpn using the Filebrowser addon ?"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Get current ip
|
# Get current ip
|
||||||
curl -s ipecho.net/plain > /currentip
|
curl -s ipecho.net/plain > /currentip
|
||||||
|
|
||||||
@@ -46,6 +41,7 @@ if bashio::config.true 'openvpn_enabled'; then
|
|||||||
else
|
else
|
||||||
# Print an error message
|
# Print an error message
|
||||||
bashio::log.warning "$file_name is referenced in your ovpn file but does not exist, and can't be found either in the /config/openvpn/ directory"
|
bashio::log.warning "$file_name is referenced in your ovpn file but does not exist, and can't be found either in the /config/openvpn/ directory"
|
||||||
|
sleep 5
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -54,7 +50,6 @@ if bashio::config.true 'openvpn_enabled'; then
|
|||||||
# Standardize lf
|
# Standardize lf
|
||||||
dos2unix "$file"
|
dos2unix "$file"
|
||||||
|
|
||||||
|
|
||||||
# Correct paths
|
# Correct paths
|
||||||
sed -i "s=/etc/openvpn=/config/openvpn=g" "$file"
|
sed -i "s=/etc/openvpn=/config/openvpn=g" "$file"
|
||||||
|
|
||||||
@@ -82,10 +77,12 @@ if bashio::config.true 'openvpn_enabled'; then
|
|||||||
else
|
else
|
||||||
bashio::exit.nok "Configured ovpn file : $openvpn_config is set but does not end by .ovpn ; it can't be used!"
|
bashio::exit.nok "Configured ovpn file : $openvpn_config is set but does not end by .ovpn ; it can't be used!"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
bashio::exit.nok "Configured ovpn file : $openvpn_config not found! Are you sure you added it in /addon_configs/$HOSTNAME/openvpn using the Filebrowser addon ?"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If openvpn_config not set, but folder is not empty
|
# If openvpn_config not set, but folder is not empty
|
||||||
else
|
elif [ ! "$(ls -A /config/openvpn/*.ovpn 2>/dev/null)" ]; then
|
||||||
# Look for openvpn files
|
# Look for openvpn files
|
||||||
# Wildcard search for openvpn config files and store results in array
|
# Wildcard search for openvpn config files and store results in array
|
||||||
mapfile -t VPN_CONFIGS < <( find /config/openvpn -maxdepth 1 -name "*.ovpn" -print )
|
mapfile -t VPN_CONFIGS < <( find /config/openvpn -maxdepth 1 -name "*.ovpn" -print )
|
||||||
@@ -100,6 +97,10 @@ 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_enabled set, config not set, and openvpn folder empty
|
||||||
|
else
|
||||||
|
bashio::exit.nok "openvpn_enabled is set, however, your openvpn folder is empty ! Are you sure you added it in /addon_configs/$HOSTNAME/openvpn using the Filebrowser addon ?"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set credentials
|
# Set credentials
|
||||||
|
|||||||
Reference in New Issue
Block a user