Skip to content
Snippets Groups Projects
Commit 216c9ce3 authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

Merge gluon packages

The gluon packages will be maintained in the gluon main repository in the
future.
parents 750d9587 c4f7a526
No related branches found
No related tags found
No related merge requests found
Showing
with 646 additions and 0 deletions
local i18n = require 'luci.i18n'
return function () luci.template.render_string(i18n.translate('gluon-config-mode:reboot')) end
--[[
Copyright 2013 Nils Schneider <nils@nilsschneider.net>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id$
]]--
module("luci.controller.gluon-config-mode.index", package.seeall)
function index()
local uci_state = luci.model.uci.cursor_state()
if uci_state:get_first("gluon-setup-mode", "setup_mode", "running", "0") == "1" then
local root = node()
if not root.target then
root.target = alias("gluon-config-mode")
root.index = true
end
page = node()
page.lock = true
page.target = alias("gluon-config-mode")
page.subindex = true
page.index = false
page = node("gluon-config-mode")
page.title = _("Wizard")
page.target = alias("gluon-config-mode", "wizard")
page.order = 5
page.setuser = "root"
page.setgroup = "root"
page.index = true
entry({"gluon-config-mode", "wizard"}, form("gluon-config-mode/wizard")).index = true
entry({"gluon-config-mode", "reboot"}, call("action_reboot"))
end
end
function action_reboot()
local uci = luci.model.uci.cursor()
uci:set("gluon-setup-mode", uci:get_first("gluon-setup-mode", "setup_mode"), "configured", "1")
uci:save("gluon-setup-mode")
uci:commit("gluon-setup-mode")
if nixio.fork() ~= 0 then
local fs = require "luci.fs"
local parts_dir = "/lib/gluon/config-mode/reboot/"
local files = fs.dir(parts_dir)
table.sort(files)
local parts = {}
for _, entry in ipairs(files) do
if entry:sub(1, 1) ~= '.' then
local f = dofile(parts_dir .. '/' .. entry)
if f ~= nil then
table.insert(parts, f)
end
end
end
local hostname = uci:get_first("system", "system", "hostname")
luci.template.render("gluon-config-mode/reboot", { parts=parts
, hostname=hostname
})
else
debug.setfenv(io.stdout, debug.getfenv(io.open '/dev/null'))
io.stdout:close()
-- Sleep a little so the browser can fetch everything required to
-- display the reboot page, then reboot the device.
nixio.nanosleep(2)
-- Run reboot with popen so it gets its own std filehandles.
io.popen("reboot")
-- Prevent any further execution in this child.
os.exit()
end
end
local wizard_dir = "/lib/gluon/config-mode/wizard/"
local i18n = luci.i18n
local uci = luci.model.uci.cursor()
local fs = require "luci.fs"
local f, s
local wizard = {}
local files = fs.dir(wizard_dir)
table.sort(files)
for _, entry in ipairs(files) do
if entry:sub(1, 1) ~= '.' then
table.insert(wizard, dofile(wizard_dir .. '/' .. entry))
end
end
f = SimpleForm("wizard")
f.reset = false
f.template = "gluon-config-mode/cbi/wizard"
for _, s in ipairs(wizard) do
s.section(f)
end
function f.handle(self, state, data)
if state == FORM_VALID then
for _, s in ipairs(wizard) do
s.handle(data)
end
luci.http.redirect(luci.dispatcher.build_url("gluon-config-mode", "reboot"))
end
return true
end
return f
<%-
local sysconfig = require 'gluon.sysconfig'
local i18n = require 'luci.i18n'
local template = require 'luci.template'
-%>
<h2><%:Welcome!%></h2>
<p>
<%= template.render_string(i18n.translate('gluon-config-mode:welcome'), {hostname=hostname, sysconfig=sysconfig}) %>
</p>
<% if not self.embedded then %>
<form method="post" enctype="multipart/form-data" action="<%=REQUEST_URI%>">
<div>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<input type="hidden" name="cbi.submit" value="1" />
</div>
<% end %>
<div class="cbi-map" id="cbi-<%=self.config%>">
<% if self.title and #self.title > 0 then %><h2><a id="content" name="content"><%=self.title%></a></h2><% end %>
<% if self.description and #self.description > 0 then %><div class="cbi-map-descr"><%=self.description%></div><% end %>
<% self:render_children() %>
<br />
</div>
<%- if self.message then %>
<div><%=self.message%></div>
<%- end %>
<%- if self.errmessage then %>
<div class="error"><%=self.errmessage%></div>
<%- end %>
<% if not self.embedded then %>
<div class="cbi-page-actions">
<%-
if type(self.hidden) == "table" then
for k, v in pairs(self.hidden) do
-%>
<input type="hidden" id="<%=k%>" name="<%=k%>" value="<%=pcdata(v)%>" />
<%-
end
end
%>
<input class="cbi-button cbi-button-save" type="submit" value="<%:Save & restart%>" />
<script type="text/javascript">cbi_d_update();</script>
</div>
</form>
<% end %>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%=luci.i18n.context.lang%>" lang="<%=luci.i18n.context.lang%>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%=hostname%> is rebooting</title>
<link rel="stylesheet" type="text/css" media="screen" href="<%=media%>/cascade.css" />
</head>
<body>
<div id="maincontainer">
<div id="maincontent">
<h2><%:Your node's setup is now complete.%></h2>
<% for k, v in ipairs(parts) do v() end %>
</div>
</div>
</body>
</html>
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"PO-Revision-Date: 2015-03-19 02:07+0100\n"
"Last-Translator: Matthias Schiffer <mschiffer@universe-factory.net>\n"
"Language-Team: German\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#, fuzzy
msgid "Save & restart"
msgstr "Speichern & Neustarten"
msgid "Welcome!"
msgstr "Willkommen!"
msgid "Wizard"
msgstr "Wizard"
msgid "Your node's setup is now complete."
msgstr "Dein Knoten ist nun fertig eingerichtet."
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Save & restart"
msgstr ""
msgid "Welcome!"
msgstr ""
msgid "Wizard"
msgstr ""
msgid "Your node's setup is now complete."
msgstr ""
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-geo-location
PKG_VERSION:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(GLUONDIR)/include/package.mk
PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)
define Package/gluon-config-mode-geo-location
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Set geographic location of a node
DEPENDS:=+gluon-config-mode-core +gluon-node-info
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
$(call GluonBuildI18N,gluon-config-mode-geo-location,i18n)
endef
define Package/gluon-config-mode-geo-location/install
$(CP) ./files/* $(1)/
$(call GluonInstallI18N,gluon-config-mode-geo-location,$(1))
endef
$(eval $(call BuildPackage,gluon-config-mode-geo-location))
local cbi = require "luci.cbi"
local i18n = require "luci.i18n"
local uci = luci.model.uci.cursor()
local M = {}
function M.section(form)
local s = form:section(cbi.SimpleSection, nil, i18n.translate(
'If you want the location of your node to be displayed on the map, '
.. 'you can enter its coordinates here. Specifying the altitude '
.. 'is optional and should only be done if a proper value is known.'))
local o
o = s:option(cbi.Flag, "_location", i18n.translate("Show node on the map"))
o.default = uci:get_first("gluon-node-info", "location", "share_location", o.disabled)
o.rmempty = false
o = s:option(cbi.Value, "_latitude", i18n.translate("Latitude"))
o.default = uci:get_first("gluon-node-info", "location", "latitude")
o:depends("_location", "1")
o.rmempty = false
o.datatype = "float"
o.description = i18n.translatef("e.g. %s", "53.873621")
o = s:option(cbi.Value, "_longitude", i18n.translate("Longitude"))
o.default = uci:get_first("gluon-node-info", "location", "longitude")
o:depends("_location", "1")
o.rmempty = false
o.datatype = "float"
o.description = i18n.translatef("e.g. %s", "10.689901")
o = s:option(cbi.Value, "_altitude", i18n.translate("Altitude"))
o.default = uci:get_first("gluon-node-info", "location", "altitude")
o:depends("_location", "1")
o.rmempty = true
o.datatype = "float"
o.description = i18n.translatef("e.g. %s", "11.51")
end
function M.handle(data)
local sname = uci:get_first("gluon-node-info", "location")
uci:set("gluon-node-info", sname, "share_location", data._location)
if data._location and data._latitude ~= nil and data._longitude ~= nil then
uci:set("gluon-node-info", sname, "latitude", data._latitude)
uci:set("gluon-node-info", sname, "longitude", data._longitude)
if data._altitude ~= nil then
uci:set("gluon-node-info", sname, "altitude", data._altitude)
else
uci:delete("gluon-node-info", sname, "altitude")
end
end
uci:save("gluon-node-info")
uci:commit("gluon-node-info")
end
return M
msgid ""
msgstr ""
"Project-Id-Version: gluon-config-mode-geo-location\n"
"PO-Revision-Date: 2015-03-23 02:18+0100\n"
"Last-Translator: Martin Weinelt <martin@darmstadt.freifunk.net>\n"
"Language-Team: German\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid ""
"If you want the location of your node to be displayed on the map, you can "
"enter its coordinates here. Specifying the altitude is optional and should "
"only be done if a proper value is known."
msgstr ""
"Um deinen Knoten auf der Karte anzeigen zu können, benötigen wir seine "
"Koordinaten. Hier hast du die Möglichkeit, diese zu hinterlegen. Die "
"Höhenangabe ist optional und sollte nur gesetzt werden, wenn ein exakter "
"Wert bekannt ist."
msgid "Latitude"
msgstr "Breitengrad"
msgid "Longitude"
msgstr "Längengrad"
msgid "Altitude"
msgstr "Höhenmeter über Normalnull"
msgid "Show node on the map"
msgstr "Knoten auf der Karte anzeigen"
msgid "e.g. %s"
msgstr "z.B. %s"
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid ""
"If you want the location of your node to be displayed on the map, you can "
"enter its coordinates here. Specifying the altitude is optional and should "
"only be done if a proper value is known."
msgstr ""
msgid "Latitude"
msgstr ""
msgid "Longitude"
msgstr ""
msgid "Show node on the map"
msgstr ""
msgid "e.g. %s"
msgstr ""
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-hostname
PKG_VERSION:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(GLUONDIR)/include/package.mk
PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)
define Package/gluon-config-mode-hostname
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Set the hostname
DEPENDS:=+gluon-config-mode-core
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
$(call GluonBuildI18N,gluon-config-mode-hostname,i18n)
endef
define Package/gluon-config-mode-hostname/install
$(CP) ./files/* $(1)/
$(call GluonInstallI18N,gluon-config-mode-hostname,$(1))
endef
$(eval $(call BuildPackage,gluon-config-mode-hostname))
local cbi = require "luci.cbi"
local i18n = require "luci.i18n"
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", i18n.translate("Node name"))
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
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: PACKAGE VERSION\n"
"PO-Revision-Date: 2015-03-19 00:54+0100\n"
"Last-Translator: Matthias Schiffer <mschiffer@universe-factory.net>\n"
"Language-Team: German\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Node name"
msgstr "Name dieses Knotens"
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Node name"
msgstr ""
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-mesh-vpn
PKG_VERSION:=2
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(GLUONDIR)/include/package.mk
PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)
define Package/gluon-config-mode-mesh-vpn
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Toggle mesh-vpn and bandwidth limit
DEPENDS:=+gluon-config-mode-core +gluon-mesh-vpn-fastd +gluon-simple-tc
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
$(call GluonBuildI18N,gluon-config-mode-mesh-vpn,i18n)
endef
define Package/gluon-config-mode-mesh-vpn/install
$(CP) ./files/* $(1)/
$(call GluonInstallI18N,gluon-config-mode-mesh-vpn,$(1))
endef
$(eval $(call BuildPackage,gluon-config-mode-mesh-vpn))
local uci = luci.model.uci.cursor()
local meshvpn_enabled = uci:get("fastd", "mesh_vpn", "enabled", "0")
if meshvpn_enabled ~= "1" then
return nil
else
local i18n = require "luci.i18n"
local util = require "luci.util"
local site = require 'gluon.site_config'
local sysconfig = require 'gluon.sysconfig'
local pubkey = util.trim(util.exec("/etc/init.d/fastd show_key " .. "mesh_vpn"))
local hostname = uci:get_first("system", "system", "hostname")
local msg = [[<p>]] .. i18n.translate('gluon-config-mode:pubkey') .. [[</p>
<div class="the-key">
# <%= hostname %>
<br/>
<%= pubkey %>
</div>]]
return function ()
luci.template.render_string(msg, { pubkey=pubkey
, hostname=hostname
, site=site
, sysconfig=sysconfig
})
end
end
local cbi = require "luci.cbi"
local i18n = require "luci.i18n"
local uci = luci.model.uci.cursor()
local M = {}
function M.section(form)
local msg = i18n.translate('Your internet connection can be used to establish an ' ..
'encrypted connection with other nodes. ' ..
'Enable this option if there are no other nodes reachable ' ..
'over WLAN in your vicinity or you want to make a part of ' ..
'your connection\'s bandwidth available for the network. You can limit how ' ..
'much bandwidth the node will use at most.')
local s = form:section(cbi.SimpleSection, nil, msg)
local o
o = s:option(cbi.Flag, "_meshvpn", i18n.translate("Use internet connection (mesh VPN)"))
o.default = uci:get_bool("fastd", "mesh_vpn", "enabled") and o.enabled or o.disabled
o.rmempty = false
o = s:option(cbi.Flag, "_limit_enabled", i18n.translate("Limit bandwidth"))
o:depends("_meshvpn", "1")
o.default = uci:get_bool("gluon-simple-tc", "mesh_vpn", "enabled") and o.enabled or o.disabled
o.rmempty = false
o = s:option(cbi.Value, "_limit_ingress", i18n.translate("Downstream (kbit/s)"))
o:depends("_limit_enabled", "1")
o.value = uci:get("gluon-simple-tc", "mesh_vpn", "limit_ingress")
o.rmempty = false
o.datatype = "integer"
o = s:option(cbi.Value, "_limit_egress", i18n.translate("Upstream (kbit/s)"))
o:depends("_limit_enabled", "1")
o.value = uci:get("gluon-simple-tc", "mesh_vpn", "limit_egress")
o.rmempty = false
o.datatype = "integer"
end
function M.handle(data)
uci:set("fastd", "mesh_vpn", "enabled", data._meshvpn)
uci:save("fastd")
uci:commit("fastd")
-- checks for nil needed due to o:depends(...)
if data._limit_enabled ~= nil then
uci:set("gluon-simple-tc", "mesh_vpn", "interface")
uci:set("gluon-simple-tc", "mesh_vpn", "enabled", data._limit_enabled)
uci:set("gluon-simple-tc", "mesh_vpn", "ifname", "mesh-vpn")
if data._limit_ingress ~= nil then
uci:set("gluon-simple-tc", "mesh_vpn", "limit_ingress", data._limit_ingress)
end
if data._limit_egress ~= nil then
uci:set("gluon-simple-tc", "mesh_vpn", "limit_egress", data._limit_egress)
end
uci:commit("gluon-simple-tc")
uci:commit("gluon-simple-tc")
end
end
return M
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"PO-Revision-Date: 2015-03-19 22:05+0100\n"
"Last-Translator: Matthias Schiffer <mschiffer@universe-factory.net>\n"
"Language-Team: German\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Downstream (kbit/s)"
msgstr "Downstream (kbit/s)"
msgid "Limit bandwidth"
msgstr "Bandbreite begrenzen"
msgid "Upstream (kbit/s)"
msgstr "Upstream (kbit/s)"
msgid "Use internet connection (mesh VPN)"
msgstr "Internetverbindung nutzen (Mesh-VPN)"
msgid ""
"Your internet connection can be used to establish an encrypted connection "
"with other nodes. Enable this option if there are no other nodes reachable "
"over WLAN in your vicinity or you want to make a part of your connection's "
"bandwidth available for the network. You can limit how much bandwidth the "
"node will use at most."
msgstr ""
"Dein Knoten kann deine Internetverbindung nutzen um darüber eine "
"verschlüsselte Verbindung zu anderen Knoten aufzubauen. Die dafür "
"genutzte Bandbreite kannst du beschränken. Aktiviere die Option, falls keine "
"per WLAN erreichbaren Nachbarknoten in deiner Nähe sind oder du deine "
"Internetverbindung für das Mesh-Netzwerk zur Verfügung stellen möchtest."
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Downstream (kbit/s)"
msgstr ""
msgid "Limit bandwidth"
msgstr ""
msgid "Upstream (kbit/s)"
msgstr ""
msgid "Use internet connection (mesh VPN)"
msgstr ""
msgid ""
"Your internet connection can be used to establish an encrypted connection "
"with other nodes. Enable this option if there are no other nodes reachable "
"over WLAN in your vicinity or you want to make a part of your connection's "
"bandwidth available for the network. You can limit how much bandwidth the "
"node will use at most."
msgstr ""
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment