From 00c7235b98ec8428d8aa2f85da450b85dd3eb295 Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Mon, 17 Aug 2020 10:38:04 +0200 Subject: [PATCH] fixed so that $HOME is respected --- bin/setupWireguard | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/setupWireguard b/bin/setupWireguard index 6c1da6e..b540916 100755 --- a/bin/setupWireguard +++ b/bin/setupWireguard @@ -4,7 +4,6 @@ keepassdb="$HOME/Nextcloud/passwords/Passwords.kdbx" type wg >/dev/null 2>&1 || { printf "wireguard is not installed\n" >&2; exit 1; } type keepassxc-cli >/dev/null 2>&1 || { printf "KeepassXC is not installed\n" >&2; exit 1; } -[[ "$EUID" != 0 ]] && printf "needs to be run as root\n" >&2 && exit 1 printf "Enter password for $keepassdb: " read -s password @@ -14,6 +13,6 @@ networks=$(echo "$password" | keepassxc-cli ls "$keepassdb" /Wireguard/$HOSTNAME umask 077 for network in $networks;do echo "configuring /etc/wireguard/${network}.conf" - echo "$password" | keepassxc-cli show -q --attributes Notes "$keepassdb" /Wireguard/$HOSTNAME/$network > /etc/wireguard/${network}.conf + echo "$password" | keepassxc-cli show -q --attributes Notes "$keepassdb" /Wireguard/$HOSTNAME/$network | sudo tee /etc/wireguard/${network}.conf > /dev/null done unset password