Browse Source

Merge branch 'v2015.1.x'

Karsten Böddeker 8 years ago
parent
commit
e3e3f77332

+ 6 - 6
ffho/ffho-banner/files/etc/banner.ffho

@@ -1,15 +1,15 @@
- _____         _ ___         _      _____         _       _   _ ___ _
-|   __|___ ___|_|  _|_ _ ___| |_   |  |  |___ ___| |_ ___| |_|_|  _| |_
-|   __|  _| -_| |  _| | |   | '_|  |     | . |  _|   |_ -|  _| |  _|  _|
-|__|  |_| |___|_|_| |___|_|_|_,_|  |__|__|___|___|_|_|___|_| |_|_| |_|
+   _____         _ ___         _      _____         _       _   _ ___ _
+  |   __|___ ___|_|  _|_ _ ___| |_   |  |  |___ ___| |_ ___| |_|_|  _| |_
+  |   __|  _| -_| |  _| | |   | '_|  |     | . |  _|   |_ -|  _| |  _|  _|
+  |__|  |_| |___|_|_| |___|_|_|_,_|  |__|__|___|___|_|_|___|_| |_|_| |_|
 
-  ---        "Du bist hier Root - mach bloß keinen Scheiß!" (tm)         ---
+  ---       "Du bist hier Root - mach bloß keinen Scheiß!" (tm)        ---
 
   Web    : http://hochstift.freifunk.net/
   Kontakt: kontakt@hochstift.freifunk.net und  (EMail)
            https://youngage.eu/chat/?#ffho     (Chat)
 
   Deine FFHO-Werkzeuge:
-  - ffho-debug        (Debug-Report für Unterstützung senden)
+  - ffpb-debug        (Debug-Report für Unterstützung senden)
   - autoupdater -f    (Firmware-Update erzwingen) 
 

+ 36 - 0
ffho/ffho-config-mode-geo-location/Makefile

@@ -0,0 +1,36 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ffho-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/ffho-config-mode-geo-location
+  SECTION:=gluon
+  CATEGORY:=Gluon
+  TITLE:=Set geographic location of a node
+  DEPENDS:=gluon-config-mode-core-virtual +gluon-node-info
+endef
+
+define Build/Prepare
+	mkdir -p $(PKG_BUILD_DIR)
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+	$(call GluonBuildI18N,ffho-config-mode-geo-location,i18n)
+endef
+
+define Package/ffho-config-mode-geo-location/install
+	$(CP) ./files/* $(1)/
+	$(call GluonInstallI18N,ffho-config-mode-geo-location,$(1))
+endef
+
+$(eval $(call BuildPackage,ffho-config-mode-geo-location))

+ 46 - 0
ffho/ffho-config-mode-geo-location/files/lib/gluon/config-mode/wizard/0400-geo-location.lua

@@ -0,0 +1,46 @@
+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.'))
+
+
+  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")
+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)
+  end
+  uci:save("gluon-node-info")
+  uci:commit("gluon-node-info")
+end
+
+return M

+ 30 - 0
ffho/ffho-config-mode-geo-location/i18n/de.po

@@ -0,0 +1,30 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: ffho-config-mode-geo-location\n"
+"PO-Revision-Date: 2015-10-23 14:45+0200\n"
+"Last-Translator: Karsten Böddeker <freifunk@kb-light.de>\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."
+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."
+
+msgid "Latitude"
+msgstr "Breitengrad"
+
+msgid "Longitude"
+msgstr "Längengrad"
+
+msgid "Show node on the map"
+msgstr "Knoten auf der Karte anzeigen"
+
+msgid "e.g. %s"
+msgstr "z.B. %s"

+ 19 - 0
ffho/ffho-config-mode-geo-location/i18n/ffho-config-mode-geo-location.pot

@@ -0,0 +1,19 @@
+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."
+msgstr ""
+
+msgid "Latitude"
+msgstr ""
+
+msgid "Longitude"
+msgstr ""
+
+msgid "Show node on the map"
+msgstr ""
+
+msgid "e.g. %s"
+msgstr ""

+ 36 - 0
ffho/ffho-config-mode-mesh-vpn/Makefile

@@ -0,0 +1,36 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ffho-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/ffho-config-mode-mesh-vpn
+  SECTION:=gluon
+  CATEGORY:=Gluon
+  TITLE:=Toggle mesh-vpn and bandwidth limit
+  DEPENDS:=gluon-config-mode-core-virtual +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,ffho-config-mode-mesh-vpn,i18n)
+endef
+
+define Package/ffho-config-mode-mesh-vpn/install
+	$(CP) ./files/* $(1)/
+	$(call GluonInstallI18N,ffho-config-mode-mesh-vpn,$(1))
+endef
+
+$(eval $(call BuildPackage,ffho-config-mode-mesh-vpn))

+ 31 - 0
ffho/ffho-config-mode-mesh-vpn/files/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua

@@ -0,0 +1,31 @@
+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 contact = uci:get_first("gluon-node-info", "owner", "contact")
+
+  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
+                                            , contact=contact
+                                            })
+         end
+end

+ 64 - 0
ffho/ffho-config-mode-mesh-vpn/files/lib/gluon/config-mode/wizard/0300-mesh-vpn.lua

@@ -0,0 +1,64 @@
+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

+ 36 - 0
ffho/ffho-config-mode-mesh-vpn/i18n/de.po

@@ -0,0 +1,36 @@
+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."

+ 22 - 0
ffho/ffho-config-mode-mesh-vpn/i18n/ffho-config-mode-mesh-vpn.pot

@@ -0,0 +1,22 @@
+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 ""

+ 39 - 0
ffho/ffho-config-mode-site-select/Makefile

@@ -0,0 +1,39 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ffho-config-mode-site-select
+PKG_VERSION:=0.1
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)
+
+define Package/ffho-config-mode-site-select
+  SECTION:=gluon
+  CATEGORY:=Gluon
+  TITLE:=UI for changing the node-config
+endef
+
+define Build/Prepare
+	mkdir -p $(PKG_BUILD_DIR)
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+	$(call GluonBuildI18N,ffho-config-mode-site-select,i18n)
+endef
+
+define Package/ffho-config-mode-site-select/install
+	mkdir -p $(1)/etc/config/
+	mkdir -p $(1)/lib/gluon/site-select/
+	$(CP) ./files/* $(1)/
+	$(CP) $(GLUON_SITEDIR)/extra/* $(1)/lib/gluon/site-select/
+	DIR=$(1) sh create-config.sh
+	$(call GluonInstallI18N,ffho-config-mode-site-select,$(1))
+endef
+
+$(eval $(call BuildPackage,ffho-config-mode-site-select))

+ 19 - 0
ffho/ffho-config-mode-site-select/README.md

@@ -0,0 +1,19 @@
+ffho-config-mode-site-select
+======================
+
+This Repository contains a Gluon package to choose between different sites after flashing the image. <br>
+This does not apply to the site.mk!
+
+This is a modified Version of gluon-config-mode-site-select
+
+Usage
+-----
+Create a file called sites.conf in $gluondir/site/extra/.
+This file should include a lua-table with the following informations about the different sites
+* site_name
+* site_code
+* ssid
+
+<br>
+Das ganze sieht dann so aus: <br>
+![](http://labor19.net/Hendrik/preview1.png)

+ 7 - 0
ffho/ffho-config-mode-site-select/create-config.sh

@@ -0,0 +1,7 @@
+#!/bin/sh
+
+current_site="$(cat "$GLUON_SITEDIR"/site.conf | grep "site_code" | sed "s/site_code =//; s/,//")"
+
+echo "config site 'current'" >> "$DIR"/etc/config/currentsite
+echo "    option name"$current_site"" >> "$DIR"/etc/config/currentsite
+echo "" >> "$DIR"/etc/config/currentsite

+ 39 - 0
ffho/ffho-config-mode-site-select/files/lib/gluon/config-mode/wizard/0200-site-select.lua

@@ -0,0 +1,39 @@
+local cbi = require "luci.cbi"
+local i18n = require "luci.i18n"
+local uci = luci.model.uci.cursor()
+local site = require 'gluon.site_config'
+local fs = require "nixio.fs"
+local config = require 'gluon.sites'
+
+local M = {}
+
+function M.section(form)
+	local msg = i18n.translate('gluon-config-mode:site-select')
+	local s = form:section(cbi.SimpleSection, nil, msg)
+
+	local o = s:option(cbi.ListValue, "community", i18n.translate("Region"))
+	o.rmempty = false
+	o.optional = false
+
+	if uci:get_first("gluon-setup-mode", "setup_mode", "configured") == "0" then
+		o:value("")
+	else
+		o:value(site.site_code, site.site_name)
+	end
+
+	for index, tmp in pairs(config) do
+		o:value(tmp.site_code, tmp.site_name)
+	end
+end
+
+function M.handle(data)
+	if data.community ~= uci:get('currentsite', 'current', 'name') then
+		uci:set('currentsite', 'current', 'name', data.community)
+		uci:save('currentsite')
+		uci:commit('currentsite')		
+
+		os.execute('sh "/lib/gluon/site-upgrade"')
+	end
+end
+
+return M

+ 6 - 0
ffho/ffho-config-mode-site-select/files/lib/gluon/site-upgrade

@@ -0,0 +1,6 @@
+#!/bin/sh
+#this script is the same as zzz-gluon-upgrade
+
+for script in /lib/gluon/upgrade/*; do
+	"$script"
+done

+ 83 - 0
ffho/ffho-config-mode-site-select/files/lib/gluon/upgrade/002-set-site-config

@@ -0,0 +1,83 @@
+#!/usr/bin/lua
+
+local uci = require 'luci.model.uci'
+local site = require 'gluon.site_config'
+local fs = require "nixio.fs"
+local c = uci.cursor()
+local config = require 'gluon.sites'
+
+local currentsite = c:get("currentsite", "current", "name")
+
+local file = "/etc/sysupgrade.conf"
+local configured = false
+
+function serialize (f,o)
+  if type(o) == "number" then
+    f:write(o)
+  elseif type(o) == "string" then
+    f:write(string.format("%q", o))
+  elseif type(o) == "boolean" then
+    f:write(o and 1 or 0)
+  elseif type(o) == "table" then
+    f:write("{\n")
+    for k,v in pairs(o) do
+      if type(k) == "string" then
+        f:write("  ", k, " = ")
+      end
+      serialize(f,v)
+      f:write(",\n")
+    end
+    f:write("}")
+  else
+    error("cannot serialize a " .. type(o))
+  end
+end
+
+for line in io.lines(file) do
+  if line == "/etc/config/currentsite" then
+    configured = true
+  end
+end
+
+if configured == false then
+  f = io.open(file,"a")
+  f:write("/etc/config/currentsite\n")
+  f:close()
+end
+
+if site.site_code ~= currentsite then
+  if type(config[currentsite]) == "table" then
+    local new = {}
+  
+    new.hostname_prefix = site.hostname_prefix
+    new.site_name = config[currentsite].site_name
+    new.site_code = config[currentsite].site_code
+    new.prefix4 = site.prefix4
+    new.prefix6 = site.prefix6
+    new.additional_prefix6 = site.additional_prefix6
+    new.timezone = site.timezone
+    new.ntp_servers = site.ntp_servers
+    new.opkg_repo = site.opkg_repo
+    new.regdom = site.regdom
+    new.wifi24 = site.wifi24
+    new.wifi5 = site.wifi5
+    new.wifi24.ssid = config[currentsite].ssid
+    new.wifi5.ssid = config[currentsite].ssid
+    new.next_node = site.next_node
+    new.fastd_mesh_vpn = site.fastd_mesh_vpn
+    new.autoupdater = site.autoupdater
+    new.simple_tc = site.simple_tc
+    new.debugserver = site.debugserver
+    new.batman_on_wan = site.batman_on_wan
+
+    file = '/lib/gluon/site.conf'
+    f = io.open(file, "w")
+    serialize(f,new)
+    f:write('\n')
+    f:close()
+  else
+    c:set("currentsite", "current", "name", site.site_code)
+    c:save('currentsite')
+    c:commit('currentsite')
+  end
+end

+ 13 - 0
ffho/ffho-config-mode-site-select/files/usr/lib/lua/gluon/sites.lua

@@ -0,0 +1,13 @@
+local config = '/lib/gluon/site-select/sites.conf'
+
+local function loader()
+   coroutine.yield('return ')
+   coroutine.yield(io.open(config):read('*a'))
+end
+
+-- setfenv doesn't work with Lua 5.2 anymore, but we're using 5.1
+local sites = setfenv(assert(load(coroutine.wrap(loader), 'sites.conf')), {})()
+
+module 'gluon.sites'
+
+return sites

+ 14 - 0
ffho/ffho-config-mode-site-select/i18n/de.po

@@ -0,0 +1,14 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"PO-Revision-Date: 2015-11-02 13:15+0100\n"
+"Last-Translator: Freifunk Hochstift <kontakt@hochstift.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 "Region"
+msgstr "Region"

+ 5 - 0
ffho/ffho-config-mode-site-select/i18n/ffho-config-mode-site-select.pot

@@ -0,0 +1,5 @@
+msgid ""
+msgstr "Content-Type: text/plain; charset=UTF-8"
+
+msgid "Region"
+msgstr ""