shellchecking

This commit is contained in:
Jonas Forsberg
2020-10-13 09:13:20 +02:00
parent a4bbc226f2
commit 8faaf0922a
4 changed files with 25 additions and 12 deletions

View File

@@ -5,14 +5,14 @@ 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; }
printf "Enter password for $keepassdb: "
read -s password
printf "Enter password for %s: " "$keepassdb":
read -s -r password
printf "\n"
networks=$(echo "$password" | keepassxc-cli ls "$keepassdb" /Wireguard/$HOSTNAME)
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 | sudo tee /etc/wireguard/${network}.conf > /dev/null
echo "$password" | keepassxc-cli show -q --attributes Notes "$keepassdb" /Wireguard/"$HOSTNAME"/"$network" | sudo tee /etc/wireguard/"${network}".conf > /dev/null
done
unset password