diff --git a/ffac-eol-ssid/Makefile b/ffac-eol-ssid/Makefile index 508b0014..6dda6b7b 100644 --- a/ffac-eol-ssid/Makefile +++ b/ffac-eol-ssid/Makefile @@ -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)) diff --git a/ffac-eol-ssid/README.md b/ffac-eol-ssid/README.md index 0bcd0d75..258cda5c 100644 --- a/ffac-eol-ssid/README.md +++ b/ffac-eol-ssid/README.md @@ -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. diff --git a/ffac-eol-ssid/check_site.lua b/ffac-eol-ssid/check_site.lua new file mode 100644 index 00000000..314da07b --- /dev/null +++ b/ffac-eol-ssid/check_site.lua @@ -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 diff --git a/ffac-eol-ssid/files/etc/config/eol-ssid b/ffac-eol-ssid/files/etc/config/eol-ssid new file mode 100644 index 00000000..63430f98 --- /dev/null +++ b/ffac-eol-ssid/files/etc/config/eol-ssid @@ -0,0 +1,2 @@ +config eol-ssid 'settings' + option enabled '1' diff --git a/ffac-eol-ssid/luasrc/lib/gluon/upgrade/500-eol-ssid-config b/ffac-eol-ssid/luasrc/lib/gluon/upgrade/500-eol-ssid-config new file mode 100644 index 00000000..d93ba1b2 --- /dev/null +++ b/ffac-eol-ssid/luasrc/lib/gluon/upgrade/500-eol-ssid-config @@ -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 diff --git a/ffac-eol-ssid/luasrc/lib/gluon/upgrade/950-eol-ssid-nagger b/ffac-eol-ssid/luasrc/lib/gluon/upgrade/950-eol-ssid-nagger index fccff643..e81ffb1a 100755 --- a/ffac-eol-ssid/luasrc/lib/gluon/upgrade/950-eol-ssid-nagger +++ b/ffac-eol-ssid/luasrc/lib/gluon/upgrade/950-eol-ssid-nagger @@ -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')