Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffac-wg-registration: fix all shellcheck issues #56

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]"
grische marked this conversation as resolved.
Show resolved Hide resolved
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