Browse Source

Merge gluon-radio-config into gluon-core

gluon-radio-config contained only a single file. The code has been adjusted
to allow creating a Gluon configuration without WLAN support by removing
the wifi24 and wifi5 sections from site.conf.
Matthias Schiffer 8 years ago
parent
commit
22130e84e8

+ 0 - 8
docs/index.rst

@@ -43,14 +43,6 @@ Developer Documentation
    dev/wan
    dev/i18n
 
-Packages
---------
-
-.. toctree::
-   :maxdepth: 1
-
-   package/gluon-radio-config
-
 Releases
 --------
 

+ 0 - 20
docs/package/gluon-radio-config.rst

@@ -1,20 +0,0 @@
-gluon-radio-config
-==================
-
-This package takes care of setting basic wireless settings:
-
-- regulatory domain
-- htmode
-- channel
-
-site.conf
----------
-
-regdom
-    regulatory domain (e.g. *de*)
-
-wifi24.channel / wifi5.channel
-    wireless channel for radio
-
-wifi24.htmode / wifi5.htmode
-    desired HT mode (e.g. *HT20*)

+ 5 - 3
docs/user/site.rst

@@ -72,13 +72,15 @@ opkg : optional
     - ``%GV`` is replaced by the Gluon version
     - ``%GR`` is replaced by the Gluon release (as specified in ``site.mk``)
 
-regdom
+regdom : optional
     The wireless regulatory domain responsible for your area, e.g.:
     ::
 
       regdom = 'DE'
 
-wifi24
+    Setting ``regdom`` in mandatory if ``wifi24`` or ``wifi5`` is defined.
+
+wifi24 : optional
     WLAN configuration for 2.4 GHz devices.
     ``channel`` must be set to a valid wireless channel for your radio.
     ``htmode`` selects the desired htmode (e.g. HT20, HT40- or HT40+).
@@ -121,7 +123,7 @@ wifi24
          },
        },
 
-wifi5
+wifi5 : optional
     Same as `wifi24` but for the 5Ghz radio.
 
 next_node : package

+ 10 - 0
package/gluon-core/check_site.lua

@@ -21,3 +21,13 @@ need_string_array('ntp_servers', false)
 
 need_string_match('prefix4', '^%d+.%d+.%d+.%d+/%d+$')
 need_string_match('prefix6', '^[%x:]+/%d+$')
+
+
+for _, config in ipairs({'wifi24', 'wifi5'}) do
+  if need_table(config, nil, false) then
+    need_string('regdom') -- regdom is only required when wifi24 or wifi5 is configured
+
+    need_number(config .. '.channel')
+    need_string(config .. '.htmode')
+  end
+end

+ 18 - 2
package/gluon-core/files/lib/gluon/upgrade/200-wireless

@@ -1,5 +1,8 @@
 #!/usr/bin/lua
 
+local util = require 'gluon.util'
+local uci = require('luci.model.uci').cursor()
+local site = require 'gluon.site_config'
 local sysconfig = require 'gluon.sysconfig'
 
 -- Initial
@@ -7,6 +10,19 @@ if not sysconfig.gluon_version then
   local uci = require('luci.model.uci').cursor()
 
   uci:delete_all('wireless', 'wifi-iface')
-  uci:save('wireless')
-  uci:commit('wireless')
 end
+
+local function configure_radio(radio, index, config)
+  if config then
+    uci:delete('wireless', radio, 'disabled')
+
+    uci:set('wireless', radio, 'channel', config.channel)
+    uci:set('wireless', radio, 'htmode', config.htmode)
+    uci:set('wireless', radio, 'country', site.regdom)
+  end
+end
+
+util.iterate_radios(configure_radio)
+
+uci:save('wireless')
+uci:commit('wireless')

+ 1 - 1
package/gluon-mesh-batman-adv-core/Makefile

@@ -11,7 +11,7 @@ define Package/gluon-mesh-batman-adv-core
   SECTION:=gluon
   CATEGORY:=Gluon
   TITLE:=Support for batman-adv meshing (core)
-  DEPENDS:=+gluon-core +gluon-radio-config +firewall +libiwinfo-lua
+  DEPENDS:=+gluon-core +firewall +libiwinfo-lua
 endef
 
 define Build/Prepare

+ 0 - 31
package/gluon-radio-config/Makefile

@@ -1,31 +0,0 @@
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=gluon-radio-config
-PKG_VERSION:=1
-
-PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
-
-include $(GLUONDIR)/include/package.mk
-
-define Package/gluon-radio-config
-  SECTION:=gluon
-  CATEGORY:=Gluon
-  TITLE:=Basic radio config (regdom, channel, htmode)
-  DEPENDS:=+gluon-core
-endef
-
-define Build/Prepare
-	mkdir -p $(PKG_BUILD_DIR)
-endef
-
-define Build/Configure
-endef
-
-define Build/Compile
-endef
-
-define Package/gluon-radio-config/install
-	$(CP) ./files/* $(1)/
-endef
-
-$(eval $(call BuildPackage,gluon-radio-config))

+ 0 - 18
package/gluon-radio-config/files/lib/gluon/upgrade/250-gluon-radio-config

@@ -1,18 +0,0 @@
-#!/usr/bin/lua
-
-local util = require 'gluon.util'
-local uci = require('luci.model.uci').cursor()
-local site = require 'gluon.site_config'
-
-local function configure_radio(radio, index, config)
-  uci:delete('wireless', radio, 'disabled')
-
-  uci:set('wireless', radio, 'channel', config.channel)
-  uci:set('wireless', radio, 'htmode', config.htmode)
-  uci:set('wireless', radio, 'country', site.regdom)
-end
-
-util.iterate_radios(configure_radio)
-
-uci:save('wireless')
-uci:commit('wireless')