mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-31 12:54:04 +02:00
Allow config location as folder (not file)
https://github.com/alexbelgium/hassio-addons/issues/874
This commit is contained in:
@@ -81,13 +81,14 @@ done
|
|||||||
if bashio::config.true "OPENVPN_CUSTOM_PROVIDER"; then
|
if bashio::config.true "OPENVPN_CUSTOM_PROVIDER"; then
|
||||||
|
|
||||||
OVPNLOCATION="$(bashio::config "OPENVPN_CUSTOM_PROVIDER_OVPN_LOCATION")"
|
OVPNLOCATION="$(bashio::config "OPENVPN_CUSTOM_PROVIDER_OVPN_LOCATION")"
|
||||||
|
OVPNCONFIG="$(bashio::config "OPENVPN_CONFIG")"
|
||||||
OPENVPN_PROVIDER="${OVPNLOCATION##*/}"
|
OPENVPN_PROVIDER="${OVPNLOCATION##*/}"
|
||||||
OPENVPN_PROVIDER="${OPENVPN_PROVIDER%.*}"
|
OPENVPN_PROVIDER="${OPENVPN_PROVIDER%.*}"
|
||||||
OPENVPN_PROVIDER="${OPENVPN_PROVIDER,,}"
|
OPENVPN_PROVIDER="${OPENVPN_PROVIDER,,}"
|
||||||
bashio::log.info "Custom openvpn provider selected"
|
bashio::log.info "Custom openvpn provider selected"
|
||||||
|
|
||||||
# Check that ovpn file exists
|
# Check that ovpn file exists
|
||||||
if [ ! -f "$(bashio::config "OPENVPN_CUSTOM_PROVIDER_OVPN_LOCATION")" ]; then
|
if [ ! -f "$OVPNLOCATION" ] || [ ! -f "$OVPNLOCATION/$OVPNCONFIG" ]; then
|
||||||
bashio::log.fatal "Ovpn file not found at location provided : $OVPNLOCATION"
|
bashio::log.fatal "Ovpn file not found at location provided : $OVPNLOCATION"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -97,7 +98,8 @@ if bashio::config.true "OPENVPN_CUSTOM_PROVIDER"; then
|
|||||||
echo "Copying ovpn file to proper location"
|
echo "Copying ovpn file to proper location"
|
||||||
mkdir -p /etc/openvpn/"$OPENVPN_PROVIDER"
|
mkdir -p /etc/openvpn/"$OPENVPN_PROVIDER"
|
||||||
mkdir -p /tmp/tmp2/temp/openvpn/"$OPENVPN_PROVIDER"
|
mkdir -p /tmp/tmp2/temp/openvpn/"$OPENVPN_PROVIDER"
|
||||||
cp "$OVPNLOCATION" /tmp/tmp2/temp/openvpn/"$OPENVPN_PROVIDER"/"$OPENVPN_PROVIDER".ovpn
|
cp "$OVPNLOCATION" /tmp/tmp2/temp/openvpn/"$OPENVPN_PROVIDER"/"$OPENVPN_PROVIDER".ovpn || \
|
||||||
|
cp "$OVPNLOCATION/$OVPNCONFIG" /tmp/tmp2/temp/openvpn/"$OPENVPN_PROVIDER"/"$OPENVPN_PROVIDER".ovpn
|
||||||
|
|
||||||
# Use custom provider
|
# Use custom provider
|
||||||
echo "Exporting variable for custom provider : $OPENVPN_PROVIDER"
|
echo "Exporting variable for custom provider : $OPENVPN_PROVIDER"
|
||||||
|
|||||||
Reference in New Issue
Block a user