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
51bc4d4c
Commit
51bc4d4c
authored
7 years ago
by
Andreas
Committed by
rubo77
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Enable dual band devices and different SSIDs (#18)
parent
f5bf7285
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gluon-ssid-changer/files/lib/gluon/ssid-changer/ssid-changer.sh
+11
-5
11 additions, 5 deletions
...ssid-changer/files/lib/gluon/ssid-changer/ssid-changer.sh
with
11 additions
and
5 deletions
gluon-ssid-changer/files/lib/gluon/ssid-changer/ssid-changer.sh
+
11
−
5
View file @
51bc4d4c
...
...
@@ -10,7 +10,7 @@ safety_exit() {
pgrep
-f
autoupdater
>
/dev/null
&&
safety_exit
'autoupdater running'
[
$(
cat
/proc/uptime |
sed
's/\..*//g'
)
-gt
60
]
||
safety_exit
'less than one minute'
[
$(
find /var/run
-name
hostapd-phy
*
|
wc
-l
)
-gt
0
]
||
safety_exit
'no hostapd-phy*'
# only once every timeframe minutes the SSID will change to the Offline-SSID
# (set to 1 minute to change immediately every time the router gets offline)
MINUTES
=
"
$(
uci
-q
get ssid-changer.settings.switch_timeframe
)
"
...
...
@@ -57,8 +57,8 @@ fi
OFFLINE_SSID
=
"
$PREFIX$SUFFIX
"
# if for whatever reason ONLINE_SSID is NULL
ONLINE_SSID
=
"
$(
uci
-q
get
wireless.client_radio
0.ssid
)
"
:
${
ONLINE_SSID
:
=
"FREIFUNK"
}
ONLINE_SSID
s
=
"
$(
uci
show |
grep
wireless.client_radio
|
grep
ssid |
awk
-F
'='
'{print $2}'
|
sed
"s/
\\\'
/PLATZHALTER/g"
|
tr
\'
\~
|
sed
"s/PLATZHALTER/
\\\'
/g"
)
"
:
${
ONLINE_SSID
s
:
=
"
~
FREIFUNK
~
"
}
# temp file to count the offline incidents during switch_timeframe
TMP
=
/tmp/ssid-changer-count
...
...
@@ -84,9 +84,9 @@ if [ $TQ_LIMIT_ENABLED = 1 ]; then
# there is no gateway
GATEWAY_TQ
=
0
fi
MSG
=
"TQ is
$GATEWAY_TQ
, "
if
[
$GATEWAY_TQ
-ge
$TQ_LIMIT_MAX
]
;
then
CHECK
=
1
elif
[
$GATEWAY_TQ
-lt
$TQ_LIMIT_MIN
]
;
then
...
...
@@ -107,8 +107,11 @@ M=$(($UP % $MINUTES))
HUP_NEEDED
=
0
if
[
"
$CHECK
"
-gt
0
]
||
[
"
$DISABLED
"
=
'1'
]
;
then
echo
"node is online"
LOOP
=
1
# check status for all physical devices
for
HOSTAPD
in
$(
ls
/var/run/hostapd-phy
*
)
;
do
ONLINE_SSID
=
"
$(
echo
$ONLINE_SSIDs
|
awk
-F
'~'
-v
l
=
$((
LOOP
*
2
))
'{print $l}'
)
"
LOOP
=
$((
LOOP+1
))
CURRENT_SSID
=
"
$(
grep
"^ssid=
$ONLINE_SSID
"
$HOSTAPD
|
cut
-d
"="
-f2
)
"
if
[
"
$CURRENT_SSID
"
=
"
$ONLINE_SSID
"
]
;
then
echo
"SSID
$CURRENT_SSID
is correct, nothing to do"
...
...
@@ -137,7 +140,10 @@ elif [ "$CHECK" -eq 0 ]; then
#echo minute $M, check if $OFF_COUNT is more than half of $T
if
[
$OFF_COUNT
-ge
$((
$T
/
2
))
]
;
then
# node was offline more times than half of switch_timeframe (or than $FIRST)
LOOP
=
1
for
HOSTAPD
in
$(
ls
/var/run/hostapd-phy
*
)
;
do
ONLINE_SSID
=
"
$(
echo
$ONLINE_SSIDs
|
awk
-F
'~'
-v
l
=
$((
LOOP
*
2
))
'{print $l}'
)
"
LOOP
=
$((
LOOP+1
))
CURRENT_SSID
=
"
$(
grep
"^ssid=
$OFFLINE_SSID
"
$HOSTAPD
|
cut
-d
"="
-f2
)
"
if
[
"
$CURRENT_SSID
"
=
"
$OFFLINE_SSID
"
]
;
then
echo
"SSID
$CURRENT_SSID
is correct, nothing to do"
...
...
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