Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
packages
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
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
packages
Commits
bd941aad
Commit
bd941aad
authored
8 years ago
by
Jan-Tarek Butt
Browse files
Options
Downloads
Patches
Plain Diff
change sequence of working and add update function
parent
f8789776
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
hoodselector/files/usr/sbin/hoodselector
+49
-23
49 additions, 23 deletions
hoodselector/files/usr/sbin/hoodselector
with
49 additions
and
23 deletions
hoodselector/files/usr/sbin/hoodselector
+
49
−
23
View file @
bd941aad
...
@@ -331,35 +331,38 @@ end
...
@@ -331,35 +331,38 @@ end
local
jhood
=
readhoodfile
(
file
)
local
jhood
=
readhoodfile
(
file
)
if
jhood
~=
nil
then
if
jhood
~=
nil
then
local
radios
=
get_wifi_devices
()
local
radios
=
get_wifi_devices
()
local
geo
=
get_geolocation
()
if
get_gw_range
()
then
if
geo
[
1
]
~=
nil
or
geo
[
2
]
~=
nil
then
-- check if fastd running
local
geo_hood
=
gethood_by_geo
(
jhood
,
geo
)
if
(
uci
:
get
(
'fastd'
,
'mesh_vpn'
,
'enabled'
)
==
'1'
)
then
if
geo_hood
~=
nil
then
os.execute
(
'/etc/init.d/fastd start'
)
local
no_error
=
set_hoodconfig
(
geo_hood
,
radios
)
end
if
no_error
then
local
geo
=
get_geolocation
()
io.stderr
:
write
(
'Setting hood getting from position.\n'
)
if
geo
[
1
]
~=
nil
or
geo
[
2
]
~=
nil
then
local
geo_hood
=
gethood_by_geo
(
jhood
,
geo
)
if
geo_hood
~=
nil
then
local
no_error
=
set_hoodconfig
(
geo_hood
,
radios
)
if
no_error
then
io.stderr
:
write
(
'Setting hood getting from position.\n'
)
exit
()
end
io.stderr
:
write
(
'Error while setting new hood getting by geoposition.\n'
)
exit
()
exit
()
end
end
io.stderr
:
write
(
'
Error while setting new hood getting by geo
position.\n'
)
io.stderr
:
write
(
'
No hood has been defined for current
position.\n'
)
exit
(
)
local
defaultHood
=
get_default_hood
(
jhood
)
en
d
if
defaultHood
~=
nil
th
en
io.stderr
:
write
(
'No hood has been defined for current position.\n'
)
local
no_error
=
set_hoodconfig
(
defaultHood
,
radios
)
local
defaultHood
=
get_default_hood
(
jhood
)
if
no_error
then
if
default
H
ood
~=
nil
then
io.stderr
:
write
(
'Setting
default
h
ood
.\n'
)
local
no_error
=
set_hoodconfig
(
defaultHood
,
radios
)
exit
(
)
if
no_error
th
en
en
d
io.stderr
:
write
(
'
S
etting defaulthood.\n'
)
io.stderr
:
write
(
'
Error while s
etting defaulthood.\n'
)
exit
()
exit
()
end
end
io.stderr
:
write
(
'
Error while setting defaulthoo
d.\n'
)
io.stderr
:
write
(
'
No defaulthood has been define
d.\n'
)
exit
()
exit
()
end
end
io.stderr
:
write
(
'No defaulthood has been defined.\n'
)
io.stderr
:
write
(
'Router dont have a position.\n'
)
exit
()
end
io.stderr
:
write
(
'Router dont have a position.\n'
)
if
get_gw_range
()
then
exit
()
end
end
if
next
(
radios
)
then
if
next
(
radios
)
then
local
scan_bssid
=
get_neigbour_bssid
(
radios
)
local
scan_bssid
=
get_neigbour_bssid
(
radios
)
...
@@ -375,6 +378,29 @@ if jhood ~= nil then
...
@@ -375,6 +378,29 @@ if jhood ~= nil then
exit
()
exit
()
end
end
io.stderr
:
write
(
'No hood has been defined for scanned bssid.\n'
)
io.stderr
:
write
(
'No hood has been defined for scanned bssid.\n'
)
-- Stop fastd
os.execute
(
'/etc/init.d/fastd stop'
)
-- Set BSSID without hood
local
if_change
=
false
for
index
,
radio
in
ipairs
(
radios
)
do
if
not
(
uci
:
get
(
'wireless'
,
'ibss_'
..
radio
,
'bssid'
)
==
scan_bssid
)
then
uci
:
section
(
'wireless'
,
'wifi-iface'
,
'ibss_'
..
radio
,
{
bssid
=
scan_bssid
}
)
if_change
=
true
end
end
if
if_change
then
uci
:
save
(
'wireless'
)
uci
:
commit
(
'wireless'
)
os.execute
(
'wifi'
)
end
-- Wait 15 seconds while meshing its creates
os.execute
(
"sleep "
..
tonumber
(
17
))
-- run autoupdater in backround and exit hoodselector
os.execute
(
'autoupdater -f &'
)
exit
()
exit
()
end
end
end
end
...
...
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