From f5149e4b7f871b75431d3e6a500577c5febc181f Mon Sep 17 00:00:00 2001 From: cinnaboot Date: Wed, 25 Sep 2024 11:53:08 -0400 Subject: [PATCH] add file bin/import_wireguard_confs.sh --- bin/import_wireguard_confs.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 bin/import_wireguard_confs.sh diff --git a/bin/import_wireguard_confs.sh b/bin/import_wireguard_confs.sh new file mode 100755 index 0000000..355e119 --- /dev/null +++ b/bin/import_wireguard_confs.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +if test $(id -u) -ne 0; then + echo "must run as root" + exit +fi + + +PROFILE_DIR="wg_profiles" +CONN='' + +for f in $(ls "$PROFILE_DIR"); do + CONN=$(echo $f | cut -d . -f 1) + echo "importing $CONN" + nmcli connection import type wireguard file $PROFILE_DIR/$CONN.conf + nmcli connection down $CONN + nmcli connection modify $CONN connection.autoconnect no +done