From 06bdf6fc6149af9cbb4564aac82cadd56a98a8b2 Mon Sep 17 00:00:00 2001
From: MrMM <mm@freifunk-aachen.de>
Date: Mon, 12 Oct 2015 11:09:47 +0200
Subject: [PATCH] just set TQ to '0' if there is no gatway. fixes #6

---
 files/lib/gluon/ssid-changer/ssid-changer.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/files/lib/gluon/ssid-changer/ssid-changer.sh b/files/lib/gluon/ssid-changer/ssid-changer.sh
index ef07d3e..73b1003 100755
--- a/files/lib/gluon/ssid-changer/ssid-changer.sh
+++ b/files/lib/gluon/ssid-changer/ssid-changer.sh
@@ -21,6 +21,12 @@ fi
 
 #Is there an active Gateway?
 GATEWAY_TQ=`batctl gwl | grep "^=>" | awk -F'[()]' '{print $2}'| tr -d " "` #Grep the Connection Quality of the Gateway which is currently used
+
+if [ ! $GATEWAY_TQ ]; #If there is no gateway there will be errors in the following if clauses
+then
+	GATEWAY_TQ=0 #Just an easy way to get an valid value if there is no gatway
+fi
+
 if [ $GATEWAY_TQ -gt $UPPER_LIMIT ];
 then
 	echo "Gateway TQ is $GATEWAY_TQ node is online"
-- 
GitLab