#!/command/with-contenv bashio if [ ! -e "/config/openvpn" ] then bashio::log.info "Initialize OpenVPN configuration..." rsync -a /srv/openvpn/ /config/openvpn/ bashio::log.info "done." else bashio::log.info "OpenVPN configuration already initialized" fi if [ ! -d /config/openvpn ] then bashio::log.info "Initialize OpenVPN configuration..." rsync -a /srv/openvpn/ /config/openvpn/ bashio::log.info "done." fi # Generate secret on first start if [ ! -e /config/openvpn/secret.key ] then bashio::log.info "Generate missing share secret key file... " openvpn --genkey secret /config/openvpn/secret.key chmod 400 /config/openvpn/secret.key bashio::log.info "done." fi # Ensure /dev/net/tun is present mkdir -p /dev/net if [ ! -c /dev/net/tun ]; then mknod /dev/net/tun c 10 200 fi # Start OpenVPN bashio::log.info "Starting OpenVPN..." exec /usr/sbin/openvpn --config /config/openvpn/client.conf