add git wg update

This commit is contained in:
stubbfel
2018-05-24 21:35:09 +02:00
parent dab2114009
commit bb527afd1f
3 changed files with 30 additions and 4 deletions

12
git-wg-update Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
KEY=$1
NETWORK=${2:-${PWD##*/}}
mapfile -t LINES <<< "$(sudo wg show $NETWORK $KEY)"
for i in "${LINES[@]}"; do
if [ -n "$i" ]; then
PEER=$(echo $i | awk -F ' ' '{print $1}')
VALUE=$(echo $i | awk -F ' ' '{$1="";print $0}')
git-wg-peer-update "$PEER" "$KEY" "$VALUE"
fi
done