Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Gluon SSID Changer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
firmware
Gluon SSID Changer
Commits
1d6e1ef5
Commit
1d6e1ef5
authored
9 years ago
by
MrMM
Browse files
Options
Downloads
Patches
Plain Diff
using 'wifi' to commit the ssid does cut the mesh connection, do it via kill -HUP
parent
bfdbe820
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
files/lib/gluon/ssid-changer/ssid-changer.sh
+21
-17
21 additions, 17 deletions
files/lib/gluon/ssid-changer/ssid-changer.sh
with
21 additions
and
17 deletions
files/lib/gluon/ssid-changer/ssid-changer.sh
+
21
−
17
View file @
1d6e1ef5
#!/bin/sh
# At first some Definitions:
...
...
@@ -6,24 +5,24 @@
ONLINE_SSID
=
'Freifunk'
OFFLINE_PREFIX
=
'FF_OFFLINE_'
# Use something short to leave space for the nodename
#Is there an active Gateway
#Is there an active Gateway
?
GATEWAY_TQ
=
`
batctl gwl |
grep
"^=>"
|
cut
-d
" "
-f3
|
tr
-d
"()"
`
if
[
$GATEWAY_TQ
-gt
50
]
;
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
`
# Is there a better way to fetch the SSID wich is active?
for
HOSTAPD
in
$(
ls
/var/run/hostapd-phy
*
)
;
do
CURRENT_SSID
=
`
grep
'^
ssid
='
$HOSTAPD
|
cut
-d
"
=
"
-f2
`
if
[
$CURRENT_SSID
==
$ONLINE_SSID
]
then
echo
"SSID
$CURRENT_SSID
is correct, noting to do"
HUP_NEEDED
=
0
else
echo
"SSID is
$CURRENT_SSID
, change to
$ONLINE_SSID
"
NUM
=
`
echo
$RADIO
|
tail
-c
2
`
`
uci
set
wireless.client_radio
$NUM
.ssid
=
$ONLINE_SSID
`
wifi
sed
-i
s/^ssid
=
.
*
/ssid
=
$ONLINE_SSID
/
$HOSTAPD
HUP_NEEDED
=
1
# HUP here would be to early for dualband devices
fi
done
else
echo
"Gateway TQ is
$GATEWAY_TQ
node is considered offline"
NODENAME
=
`
uname
-n
`
...
...
@@ -31,20 +30,25 @@ else
HALF
=
$((
(
28
-
${#
OFFLINE_PREFIX
}
)
/
2
))
SKIP
=
$((
${#
NODENAME
}
-
$HALF
))
OFFLINE_SSID
=
$OFFLINE_PREFIX
${
NODENAME
:0:
$HALF
}
...
${
NODENAME
:
$SKIP
:
${#
NODENAME
}}
# use the first and last part of the nodename for nodes with long name
else
OFFLINE_SSID
=
`
$OFFLINE_PREFIX$NODENAME
`
fi
for
RADIO
in
$(
iw dev |
grep
client |
cut
-d
" "
-f2
)
;
do
CURRENT_SSID
=
`
iw dev
$RADIO
info |
grep
ssid |
cut
-d
"
"
-f2
`
else
OFFLINE_SSID
=
`
$OFFLINE_PREFIX$NODENAME
`
fi
for
HOSTAPD
in
$(
ls
/var/run/hostapd-phy
*
)
;
do
CURRENT_SSID
=
`
grep
'^
ssid
='
$HOSTAPD
|
cut
-d
"
=
"
-f2
`
if
[
$CURRENT_SSID
==
$OFFLINE_SSID
]
then
echo
"SSID
$CURRENT_SSID
is correct, noting to do"
HUP_NEEDED
=
0
else
echo
"SSID is
$CURRENT_SSID
, change to
$OFFLINE_SSID
"
NUM
=
`
echo
$RADIO
|
tail
-c
2
`
`
uci
set
wireless.client_radio
$NUM
.ssid
=
"
$OFFLINE_SSID
"
`
wifi
sed
-i
"s/^ssid=.*/ssid=
$OFFLINE_SSID
/"
$HOSTAPD
HUP_NEEDED
=
1
# HUP here would be to early for dualband devices
fi
done
fi
if
[
$HUP_NEEDED
==
1
]
;
then
killall
-HUP
hostapd
# Send HUP to all hostapd um die neue SSID zu laden
HUP_NEEDED
=
0
echo
"HUP!"
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment