Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffac-eol-ssid: rework site configuration #42

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ffac-eol-ssid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ Then one can add the `ffac-eol-ssid` package to the old version and leave a much
## Site Configuration

```
eol_wifi_ssid = 'erneuern.freifunk.net'
eol_ssid = {
enabled = true,
ssid = 'erneuern.freifunk.net',
}
```

## Upgrading
Expand Down
4 changes: 4 additions & 0 deletions ffac-eol-ssid/check_site.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
obsolete({'eol_wifi_ssid'}, 'Use eol_ssid.ssid instead.')
if need_boolean({'eol_ssid', 'enabled'}, false) then
need_string({'eol_ssid', 'ssid'})
end
15 changes: 5 additions & 10 deletions ffac-eol-ssid/luasrc/lib/gluon/upgrade/950-eol-ssid-nagger
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,13 @@ if uci:get('eol-wifi', 'ssid') ~= nil then
os.remove('/etc/config/eol-wifi')
end

-- Get/initialize enabled state
if site.eol_wifi_ssid() == nil then
-- Not applicable
os.exit(0)
if not site.eol_ssid.enabled(false) -- disabled for site/domain
or not uci:get_bool('eol-ssid', 'settings', 'enabled') -- disabled on router
then
os.exit(0) -- do not change SSID
end

-- eol-ssid feature disabled on device
if not uci:get_bool('eol-ssid', 'settings', 'enabled') then
os.exit(0)
end

local eol_wifi_ssid = site.eol_wifi_ssid()
local eol_wifi_ssid = site.eol_ssid.ssid()

-- Change client radio ssid
uci:set('wireless', 'client_radio0', 'ssid', eol_wifi_ssid)
Expand Down