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
1d35be8f
Commit
1d35be8f
authored
8 years ago
by
rubo77
Browse files
Options
Downloads
Patches
Plain Diff
take more of the node name into the offline SSID
And code cleanup and comments
parent
4323ed51
No related branches found
Branches containing commit
No related tags found
Tags containing commit
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
+27
-17
27 additions, 17 deletions
files/lib/gluon/ssid-changer/ssid-changer.sh
with
27 additions
and
17 deletions
files/lib/gluon/ssid-changer/ssid-changer.sh
+
27
−
17
View file @
1d35be8f
#!/bin/sh
# at first some Definitions:
ONLINE_SSID
=
$(
uci get wireless.client_radio0.ssid
-q
)
:
${
ONLINE_SSID
:
=
"FREIFUNK"
}
# if for whatever reason ONLINE_SSID is NULL
OFFLINE_PREFIX
=
'FF_OFFLINE_'
# use something short to leave space for the nodename
# Generate an Offline SSID with the first and last part of the nodename to allow owner to recognise wich node is down
NODENAME
=
`
uname
-n
`
if
[
${#
NODENAME
}
-gt
$((
30
-
${#
OFFLINE_PREFIX
}))
]
;
then
# 32 would be possible as well
HALF
=
$((
(
28
-
${#
OFFLINE_PREFIX
}
)
/
2
))
# calculate the length of the first part of the node identifier in the offline-ssid
SKIP
=
$((
${#
NODENAME
}
-
$HALF
))
# jump to this charakter for the last part of the name
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
"
# great! we are able to use the full nodename in the offline ssid
fi
# maximum simplyfied, no more ttvn rating
check
=
$(
batctl gwl
-H
|grep
-v
"gateways in range"
|wc
-l
)
name
=
$(
nodename status|tail
-c
21
)
offline
=
"FF_OFFLINE_"
default
=
"FREIFUNK"
offi
=
$offline$name
CHECK
=
$(
batctl gwl
-H
|grep
-v
"gateways in range"
|wc
-l
)
if
[
$
check
-eq
0
]
;
then
if
[
"
$(
uci get wireless.client_radio0.ssid
)
"
==
"
$
offi
"
]
;
then
echo
"
$0
- still on
$
offi
"
;
exit
0
;
fi
echo
"
$0
change ssid to
$
offi
"
| logger
uci
set
wireless.client_radio0.ssid
=
"
$
offi
"
sed
-i
s/^ssid
=
$
default
/ssid
=
$offi
/ /var/run/hostapd-phy0.conf
killall
-HUP
hostapd
if
[
$
CHECK
-eq
0
]
;
then
if
[
"
$(
uci get wireless.client_radio0.ssid
)
"
==
"
$
OFFLINE_SSID
"
]
;
then
echo
"
$0
- still on
$
OFFLINE_SSID
"
;
exit
0
;
fi
echo
"
$0
change ssid to
$
OFFLINE_SSID
"
| logger
uci
set
wireless.client_radio0.ssid
=
"
$
OFFLINE_SSID
"
sed
-i
s/^ssid
=
$
ONLINE_SSID
/ssid
=
$OFFLINE_SSID
/ /var/run/hostapd-phy0.conf
killall
-HUP
hostapd
fi
if
[
$
check
-gt
0
]
;
then
if
[
"
$(
uci get wireless.client_radio0.ssid
)
"
==
"
$
default
"
]
;
then
echo
"
$0
- still on
$
default
"
;
exit
0
;
fi
echo
"
$0
change ssid to
$
default
"
| logger
uci
set
wireless.client_radio0.ssid
=
"
$
default
"
sed
-i
s/^ssid
=
$
offi
/ssid
=
$default
/ /var/run/hostapd-phy0.conf
killall
-HUP
hostapd
if
[
$
CHECK
-gt
0
]
;
then
if
[
"
$(
uci get wireless.client_radio0.ssid
)
"
==
"
$
ONLINE_SSID
"
]
;
then
echo
"
$0
- still on
$
ONLINE_SSID
"
;
exit
0
;
fi
echo
"
$0
change ssid to
$
ONLINE_SSID
"
| logger
uci
set
wireless.client_radio0.ssid
=
"
$
ONLINE_SSID
"
sed
-i
s/^ssid
=
$
OFFLINE_SSID
/ssid
=
$ONLINE_SSID
/ /var/run/hostapd-phy0.conf
killall
-HUP
hostapd
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