Merge d407c1619a
into 7b81b4a457
This commit is contained in:
commit
f9ba4e4d60
|
@ -0,0 +1,32 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=gluon-luci-node-purpose
|
||||
PKG_VERSION:=0.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/gluon-luci-node-purpose
|
||||
SECTION:=gluon
|
||||
CATEGORY:=Gluon
|
||||
DEPENDS:=+gluon-luci-admin +gluon-node-purpose
|
||||
TITLE:=UI for specifying node purpose
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/gluon-luci-node-purpose/install
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,gluon-luci-node-purpose))
|
|
@ -0,0 +1,5 @@
|
|||
module("luci.controller.admin.nodepurpose", package.seeall)
|
||||
|
||||
function index()
|
||||
entry({"admin", "nodepurpose"}, cbi("admin/nodepurpose"), "Verwendungszweck", 20)
|
||||
end
|
|
@ -0,0 +1,35 @@
|
|||
local f, s, o, role
|
||||
local uci = luci.model.uci.cursor()
|
||||
local config = 'gluon-node-info'
|
||||
|
||||
-- where to read the configuration from
|
||||
local role = uci:get(config, uci:get_first(config, "purpose"), "role")
|
||||
|
||||
f = SimpleForm("purpose", "Verwendungszweck")
|
||||
f.reset = false
|
||||
f.template = "admin/expertmode"
|
||||
f.submit = "Fertig"
|
||||
|
||||
s = f:section(SimpleSection, nil, [[
|
||||
Wenn dein Freifunk-Router eine besondere Rolle im Freifunk Netz einnimmt, kannst du diese hier angeben.
|
||||
Das kann z.B. die "Backbone" Rolle sein, damit er auf der Freifunk-Knotenkarte entsprechend gekennzeichnet wird.
|
||||
Setze die Rolle nur, wenn du weißt was du machst. Informiere dich bitte vorher, was die entsprechenden Rollen im
|
||||
Freifunk-Netz bewirken.
|
||||
]])
|
||||
|
||||
o = s:option(ListValue, "role", "Rolle")
|
||||
o.default = role
|
||||
o.rmempty = false
|
||||
o:value("node", "Normaler Knoten")
|
||||
o:value("backbone", "Backbone Knoten")
|
||||
|
||||
function f.handle(self, state, data)
|
||||
if state == FORM_VALID then
|
||||
uci:set(config, uci:get_first(config, "purpose"), data.role)
|
||||
|
||||
uci:save(config)
|
||||
uci:commit(config)
|
||||
end
|
||||
end
|
||||
|
||||
return f
|
|
@ -0,0 +1,36 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=gluon-node-purpose
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/gluon-node-purpose
|
||||
SECTION:=gluon
|
||||
CATEGORY:=Gluon
|
||||
TITLE:=Add /etc/config/gluon-node-purpose to uci
|
||||
DEPENDS:=+gluon-core +gluon-node-info
|
||||
endef
|
||||
|
||||
define Package/gluon-node-purpose/description
|
||||
This package adds the section purpose to /etc/config/gluon-node-info.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/gluon-node-purpose/install
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,gluon-node-purpose))
|
|
@ -0,0 +1,4 @@
|
|||
local role = uci:get_first('gluon-node-info', 'purpose', 'role', '')
|
||||
if role ~= '' then
|
||||
return { role = role }
|
||||
end
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/lua
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local uci = require ('luci.model.uci').cursor()
|
||||
|
||||
local config = 'gluon-node-info'
|
||||
|
||||
if not site.default_role then
|
||||
role = ''
|
||||
else
|
||||
role = site.default_role
|
||||
end
|
||||
|
||||
if role ~= '' then
|
||||
uci:section(config, 'purpose')
|
||||
uci:set(config, uci:get_first(config, 'purpose'), 'role', role)
|
||||
end
|
||||
|
||||
uci:save(config)
|
||||
uci:commit(config)
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/lua
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local uci = require('luci.model.uci').cursor()
|
||||
|
||||
local config = 'gluon-node-info'
|
||||
|
||||
if not site.default_role then
|
||||
role = ''
|
||||
else
|
||||
role = site.default_role
|
||||
end
|
||||
|
||||
if not uci:get_first(config, 'purpose') then
|
||||
uci:section(config, 'purpose')
|
||||
end
|
||||
|
||||
if role ~= '' then
|
||||
uci:set(config, uci:get_first(config, 'purpose'), 'role', role)
|
||||
end
|
||||
|
||||
uci:save(config)
|
||||
uci:commit(config)
|
Loading…
Reference in New Issue