Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFS Gluon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
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
FFS Gluon
Commits
896c81cc
Commit
896c81cc
authored
10 years ago
by
Nils Schneider
Browse files
Options
Downloads
Patches
Plain Diff
docs: document config-mode modules
parent
211f2c12
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/dev/configmode.rst
+92
-0
92 additions, 0 deletions
docs/dev/configmode.rst
docs/index.rst
+1
-0
1 addition, 0 deletions
docs/index.rst
with
93 additions
and
0 deletions
docs/dev/configmode.rst
0 → 100644
+
92
−
0
View file @
896c81cc
Config Mode
===========
As of 2014.4 `gluon-config-mode` consists of several modules.
gluon-config-mode-core
This modules provides the core functionality for the config mode.
All modules must depend on it.
gluon-config-mode-hostname
Provides a hostname field.
gluon-config-mode-autoupdater
Informs whether the autoupdater is enabled.
gluon-config-mode-mesh-vpn
Allows toggling of mesh-vpn-fastd and setting a bandwidth limit.
gluon-config-mode-geo-location
Enables the user to set the geographical location of the node.
gluon-config-mode-contact-info
Adds a field where the user can provide contact information.
In order to get a config mode close to the one found in 2014.3.x you may add
these modules to your `site.mk`:
gluon-config-mode-hostname,
gluon-config-mode-autoupdater,
gluon-config-mode-mesh-vpn,
gluon-config-mode-geo-location,
gluon-config-mode-contact-info
Writing Config Mode Modules
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Config mode modules are located at `/lib/gluon/config-mode/wizard` and
`/lib/gluon/config-mode/reboot`. Modules are named like `0000-name.lua` and
are executed in lexical order. If you take the standard set of modules, the
order is, for wizard modules:
- 0050-autoupdater-info
- 0100-hostname
- 0300-mesh-vpn
- 0400-geo-location
- 0500-contact-info
While for reboot modules it is:
- 0100-mesh-vpn
- 0900-msg-reboot
Wizards
-------
Wizard modules return a UCI section. A simple module capable of changing the
hostname might look like this::
local cbi = require "luci.cbi"
local uci = luci.model.uci.cursor()
local M = {}
function M.section(form)
local s = form:section(cbi.SimpleSection, nil, nil)
local o = s:option(cbi.Value, "_hostname", "Hostname")
o.value = uci:get_first("system", "system", "hostname")
o.rmempty = false
o.datatype = "hostname"
end
function M.handle(data)
uci:set("system", uci:get_first("system", "system"), "hostname", data._hostname)
uci:save("system")
uci:commit("system")
end
return M
Reboot page
-----------
Reboot modules return a function that will be called when the page is to be
rendered or nil (i.e. the module is skipped)::
if no_hello_world_today then
return nil
else
return function ()
luci.template.render_string("Hello World!")
end
end
This diff is collapsed.
Click to expand it.
docs/index.rst
+
1
−
0
View file @
896c81cc
...
@@ -36,6 +36,7 @@ Developer Documentation
...
@@ -36,6 +36,7 @@ Developer Documentation
dev/basics
dev/basics
dev/hardware
dev/hardware
dev/configmode
Supported Devices
Supported Devices
-----------------
-----------------
...
...
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