choose config to use by optionally setting environment variable.

This commit is contained in:
Kristian Haugene
2015-05-09 18:59:36 +02:00
parent 50b5aa7d46
commit 6f07f0324b
3 changed files with 17 additions and 23 deletions

View File

@@ -1,3 +1,18 @@
#!/bin/sh
exec openvpn --config /etc/openvpn/config.ovpn
if [ ! -z "$OPEN_VPN_CONFIG" ]
then
if [ -f /etc/openvpn/"${OPEN_VPN_CONFIG}".ovpn ]
then
echo "Starting OpenVPN using config ${OPEN_VPN_CONFIG}.ovpn"
exec openvpn --config /etc/openvpn/"${OPEN_VPN_CONFIG}".ovpn
else
echo "Supplied config ${OPEN_VPN_CONFIG}.ovpn could not be found."
echo "Using default OpenVPN gateway: Netherlands"
exec openvpn --config /etc/openvpn/Netherlands.ovpn
fi
else
echo "No VPN configuration provided. Using default: Netherlands"
exec openvpn --config /etc/openvpn/Netherlands.ovpn
fi