Skip to content

Commit

Permalink
ffac-eol-ssid: fix name of eol-ssid subsystem
Browse files Browse the repository at this point in the history
Before thie change, the eol-ssid uci subsystem had to be created manually
and the uci settings did not show up for this package.
  • Loading branch information
grische committed Nov 5, 2023
1 parent ca08c54 commit 1d4c9e4
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 10 deletions.
4 changes: 4 additions & 0 deletions ffac-eol-ssid/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ define Package/$(PKG_NAME)
DEPENDS:=+gluon-core
endef

define Package/ffac-eol-ssid/conffiles
/etc/config/eol-ssid
endef

$(eval $(call BuildPackageGluon,ffac-eol-ssid))
9 changes: 8 additions & 1 deletion ffac-eol-ssid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@ 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_wifi = {
enabled = true,
ssid = 'erneuern.freifunk.net',
}
```

## Upgrading

This package will migrate uci settings for previous version of this package.

## Limitations

As this package was created to migrate older devices, it does not respect 5GHz or OWE radio.
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_wifi.settings.ssid instead.')
if need_boolean({'eol_wifi', 'enabled'}, false) then
need_string({'eol_wifi', 'ssid'})
end
2 changes: 2 additions & 0 deletions ffac-eol-ssid/files/etc/config/eol-ssid
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
config eol-ssid 'settings'
option enabled '1'
11 changes: 11 additions & 0 deletions ffac-eol-ssid/luasrc/lib/gluon/upgrade/500-eol-ssid-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/lua

local uci = require('simple-uci').cursor()

-- migrate older versions
if uci:get('eol-wifi', 'ssid') then
local deprecated_ssid_enabled = not uci:get_bool('eol-wifi', 'ssid', 'disabled')
uci:set('eol-ssid', 'settings', 'enabled', deprecated_ssid_enabled)
uci:delete('eol-wifi', 'ssid')
uci:save('eol-wifi')
end
17 changes: 8 additions & 9 deletions ffac-eol-ssid/luasrc/lib/gluon/upgrade/950-eol-ssid-nagger
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ if site.eol_wifi_ssid() == nil then
os.exit(0)
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()

if not uci:get_bool('eol-wifi', 'ssid', 'disabled') then
uci:section('eol-wifi', 'ssid', 'ssid', {
disabled = false,
})
uci:save('eol-wifi')
-- Change client radio ssid
uci:set('wireless', 'client_radio0', 'ssid', eol_wifi_ssid)
uci:save('wireless')
end
-- Change client radio ssid
uci:set('wireless', 'client_radio0', 'ssid', eol_wifi_ssid)
uci:save('wireless')

0 comments on commit 1d4c9e4

Please sign in to comment.