Skip to content
Snippets Groups Projects
Commit 7878a502 authored by MrMM's avatar MrMM
Browse files

Use the frist and the last part of the nodename for the offline ssid,...

Use the frist and the last part of the nodename for the offline ssid, otherwise a long prefix in the nodename will be a problem
parent c276c64d
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
#Is there an active Gateway
GATEWAY_TQ=`batctl gwl | grep "^=>" | cut -d" " -f3 | tr -d "()"`
if [ $GATEWAY_TQ > 50 ];
......@@ -9,7 +8,7 @@ then
echo "Gateway TQ is $GATEWAY_TQ node is online"
for RADIO in $(iw dev | grep client | cut -d" " -f2); do
CURRENT_SSID=`iw dev $RADIO info | grep ssid | cut -d" " -f2`
# Use Freifunk for now, get it from /lib/gluon/site.conf in futre version
# Use Freifunk for now, get it from /lib/gluon/site.conf in future version
if [ $CURRENT_SSID == 'Freifunk' ]
then
echo "SSID $CURRENT_SSID is correct, noting to do"
......@@ -23,7 +22,9 @@ then
else
echo "Gateway TQ is $GATEWAY_TQ node is considered offline"
NODENAME=`uname -n`
OFFLINE_SSID=`echo "Freifunk_OFFLINE_$NODENAME" | cut -b -30`
#There is a limit auf 32 charakters for the ssid + 'FF_OFFLINE_' leves us 21 maximum SSID length
if [ ${#NODENAME} > 20 ] ; then
OFFLINE_SSID=`echo "FF_OFFLINE_${STRING:0:9}...${STRING:(-9)}"` # use the first and last part of the nodename for nodes with long prefix
for RADIO in $(iw dev | grep client | cut -d" " -f2); do
CURRENT_SSID=`iw dev $RADIO info | grep ssid | cut -d" " -f2`
if [ $CURRENT_SSID == $OFFLINE_SSID ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment