Skip to content

Commit a4b50e3

Browse files
grischemaurerle
authored andcommitted
ffac-wg-registration: fix all shellcheck issues
1 parent 627bf4c commit a4b50e3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/bin/sh
22

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

0 commit comments

Comments
 (0)