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