From c8be2b007a0bf5c8b1b1b484b5d8772c8345cec0 Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Thu, 26 Jan 2023 08:50:54 +0000 Subject: [PATCH] Update 2 files - /home/.chezmoiscripts/universal/run_onchange_after_24-vpn-linux.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_24-vpn-darwin.tmpl --- .../run_onchange_after_24-vpn-darwin.tmpl | 7 +++++++ .../run_onchange_after_24-vpn-linux.tmpl | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 home/.chezmoiscripts/universal/run_onchange_after_24-vpn-darwin.tmpl create mode 100644 home/.chezmoiscripts/universal/run_onchange_after_24-vpn-linux.tmpl diff --git a/home/.chezmoiscripts/universal/run_onchange_after_24-vpn-darwin.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_24-vpn-darwin.tmpl new file mode 100644 index 00000000..db233716 --- /dev/null +++ b/home/.chezmoiscripts/universal/run_onchange_after_24-vpn-darwin.tmpl @@ -0,0 +1,7 @@ +{{- if eq .host.distro.family "linux" -}} +#!/usr/bin/env bash + +{{ includeTemplate "universal/profile" }} +{{ includeTemplate "universal/logg" }} + +{{ end -}} \ No newline at end of file diff --git a/home/.chezmoiscripts/universal/run_onchange_after_24-vpn-linux.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_24-vpn-linux.tmpl new file mode 100644 index 00000000..cd984032 --- /dev/null +++ b/home/.chezmoiscripts/universal/run_onchange_after_24-vpn-linux.tmpl @@ -0,0 +1,16 @@ +{{- if eq .host.distro.family "linux" -}} +#!/usr/bin/env bash + +{{ includeTemplate "universal/profile" }} +{{ includeTemplate "universal/logg" }} + +if command -v nmcli > /dev/null; then + nmcli connection import type openvpn file '{{ vpn_connection.file }}' + nmcli connection modify '{{ ovpn_name }}' +vpn.data username={{ vpn_connection.username }} + nmcli connection modify '{{ ovpn_name }}' vpn.secrets 'password={{ vpn_connection.password }}' + nmcli connection modify '{{ ovpn_name }}' +vpn.data password-flags=0 +else + logg info '`nmcli` is unavailable' +fi + +{{ end -}} \ No newline at end of file