From 916c7d48afcccff77afe9c142747c8f6f0ce899d Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Thu, 16 Jun 2022 14:08:33 +0200 Subject: [PATCH] Update 99-run.sh --- .../rootfs/etc/cont-init.d/99-run.sh | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/transmission_openvpn/rootfs/etc/cont-init.d/99-run.sh b/transmission_openvpn/rootfs/etc/cont-init.d/99-run.sh index f9d381db5..3540b2c61 100644 --- a/transmission_openvpn/rootfs/etc/cont-init.d/99-run.sh +++ b/transmission_openvpn/rootfs/etc/cont-init.d/99-run.sh @@ -11,6 +11,39 @@ for k in $(bashio::jq "/data/options.json" 'keys | .[]'); do done echo "" +################### +# Custom provider # +################### + +if bashio::config.true "OPENVPN_CUSTOM_PROVIDER"; then + +OVPNLOCATION="$(bashio::config "OPENVPN_CUSTOM_PROVIDER_OVPN_LOCATION")" +OPENVPN_PROVIDER="${OVPNLOCATION##*/}" +OPENVPN_PROVIDER="${OPENVPN_PROVIDER%.*}" +bashio::log.info "Custom openvpn provider selected" + + # Check that ovpn file exists + if [ ! -f bashio::config "OPENVPN_CUSTOM_PROVIDER_OVPN_LOCATION" ]; then + bashio::log.fatal "Ovpn file not found at location provided : $OVPNLOCATION" + exit 1 + fi + + # Copy ovpn file + echo "Copying ovpn file to proper location" + mkdir /openvpn/"$OPENVPN_PROVIDER" + cp "$OVPNLOCATION" /openvpn/"$OPENVPN_PROVIDER"/ + + # Use custom provider + echo "Exporting variable for custom provider : $OPENVPN_PROVIDER" + export OPENVPN_PROVIDER="$OPENVPN_PROVIDER" + export OPENVPN_CONFIG="$OPENVPN_PROVIDER" + +else + +bashio::log.info "Custom openvpn provider not selected, the provider $OPENVPN_PROVIDER will be used" + +fi + ####################### # Run haugene scripts # #######################