Skip to content

Commit

Permalink
ffac-wg-registration: fix all shellcheck issues
Browse files Browse the repository at this point in the history
  • Loading branch information
grische authored and maurerle committed Nov 20, 2023
1 parent 627bf4c commit a4b50e3
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/sh

if [ "$(uci get gluon.mesh_vpn.enabled)" == "true" ] || [ "$(uci get gluon.mesh_vpn.enabled)" == "1" ]; then
# check if registration has been done since last boot
if [ ! -f /tmp/WG_REGISTRATION_SUCCESSFUL ]; then
if [ "$(uci get gluon.mesh_vpn.enabled)" = "true" ] || [ "$(uci get gluon.mesh_vpn.enabled)" = "1" ]; then
# check if registration has been done since last boot
if [ ! -f /tmp/WG_REGISTRATION_SUCCESSFUL ]; then
# Push public key to broker, test for https and use if supported
wget -q https://[::1]
wget -q "https://[::1]"
if [ $? -eq 1 ]; then
PROTO=http
else
Expand All @@ -14,10 +14,10 @@ if [ "$(uci get gluon.mesh_vpn.enabled)" == "true" ] || [ "$(uci get gluon.mesh_
NODENAME=$(uci get system.@system[0].hostname)
BROKER=$(uci get wireguard.mesh_vpn.broker)
logger -t wg-registration "Post $NODENAME and $PUBLICKEY to $PROTO://$BROKER"
gluon-wan wget -q -O- --post-data='{"node_name": "'"$NODENAME"'","public_key": "'"$PUBLICKEY"'"}' $PROTO://$BROKER
if [ $? -eq 0 ]; then
if gluon-wan wget -q -O- --post-data='{"node_name": "'"$NODENAME"'","public_key": "'"$PUBLICKEY"'"}' $PROTO://"$BROKER"
then
touch /tmp/WG_REGISTRATION_SUCCESSFUL
logger -t wg-registration "successfully registered wg publickey"
fi
fi
fi
fi

0 comments on commit a4b50e3

Please sign in to comment.