From 52a26612be6efeb452458a2836fe77cfd6306508 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 6 Apr 2021 21:57:49 +0200 Subject: [PATCH] Create 21-openvpn --- qbittorrent/rootfs/etc/cont-init.d/21-openvpn | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 qbittorrent/rootfs/etc/cont-init.d/21-openvpn diff --git a/qbittorrent/rootfs/etc/cont-init.d/21-openvpn b/qbittorrent/rootfs/etc/cont-init.d/21-openvpn new file mode 100644 index 000000000..4122ca185 --- /dev/null +++ b/qbittorrent/rootfs/etc/cont-init.d/21-openvpn @@ -0,0 +1,23 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== + +declare openvpn_config +declare openvpn_username +declare openvpn_password + +if bashio::config.true 'openvpn_enabled'; then + + openvpn_config=$(bashio::config 'openvpn_config') + + cp "/config/openvpn/${openvpn_config}.ovpn" /etc/openvpn/config.ovpn + + openvpn_username=$(bashio::config 'openvpn_username') + echo "${openvpn_username}" > /etc/openvpn/credentials + openvpn_password=$(bashio::config 'openvpn_password') + echo "${openvpn_password}" >> /etc/openvpn/credentials + + sed -i 's/auth-user-pass.*/auth-user-pass \/etc\/openvpn\/credentials/g' /etc/openvpn/config.ovpn + + sed -i "1a\/etc/openvpn/up-qbittorrent.sh \"\${4}\" &\n" /etc/openvpn/up.sh + +fi