From d9902c0664fc6b98862e0d0b03c6cca317f0d74e Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 30 Jan 2013 21:20:58 +0100 Subject: [PATCH 001/453] Adjustments for the Gluon project --- package/gluon-config-mode/Makefile | 38 +++++++++++ .../files/etc/config/config_mode | 3 + .../files/etc/hotplug.d/button/50-config-mode | 29 ++++++++ .../files/etc/init.d/config_mode | 53 +++++++++++++++ .../lua/luci/controller/freifunk/index.lua | 13 ++++ .../lua/luci/controller/freifunk/wizard.lua | 30 ++++++++ .../model/cbi/freifunk-wizard/hostname.lua | 38 +++++++++++ .../model/cbi/freifunk-wizard/meshvpn.lua | 67 ++++++++++++++++++ .../model/cbi/freifunk-wizard/password.lua | 43 ++++++++++++ .../lua/luci/tools/freifunk-wizard/nav.lua | 43 ++++++++++++ .../luci/view/freifunk-wizard/completed.htm | 16 +++++ .../lua/luci/view/freifunk-wizard/footer.htm | 19 ++++++ .../lua/luci/view/freifunk-wizard/header.htm | 24 +++++++ .../luci/view/freifunk-wizard/meshvpn-key.htm | 18 +++++ .../lib/lua/luci/view/freifunk-wizard/nav.htm | 15 ++++ .../lua/luci/view/freifunk-wizard/welcome.htm | 19 ++++++ .../luci/view/freifunk-wizard/wizardform.htm | 68 +++++++++++++++++++ 17 files changed, 536 insertions(+) create mode 100644 package/gluon-config-mode/Makefile create mode 100644 package/gluon-config-mode/files/etc/config/config_mode create mode 100755 package/gluon-config-mode/files/etc/hotplug.d/button/50-config-mode create mode 100755 package/gluon-config-mode/files/etc/init.d/config_mode create mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/controller/freifunk/index.lua create mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/controller/freifunk/wizard.lua create mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/hostname.lua create mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/meshvpn.lua create mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/password.lua create mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/tools/freifunk-wizard/nav.lua create mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/completed.htm create mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/footer.htm create mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/header.htm create mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/meshvpn-key.htm create mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/nav.htm create mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/welcome.htm create mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/wizardform.htm diff --git a/package/gluon-config-mode/Makefile b/package/gluon-config-mode/Makefile new file mode 100644 index 00000000..2cdac318 --- /dev/null +++ b/package/gluon-config-mode/Makefile @@ -0,0 +1,38 @@ +# Copyright (C) 2012 Nils Schneider +# This is free software, licensed under the Apache 2.0 license. + +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-config-mode +PKG_RELEASE:=0.0.1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-config-mode + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Luci based config mode for user friendly setup of new meshnodes + DEPENDS:=+luci-mod-admin-core +endef + +define Package/gluon-config-mode/description + Luci based config mode +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-config-mode/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-config-mode)) diff --git a/package/gluon-config-mode/files/etc/config/config_mode b/package/gluon-config-mode/files/etc/config/config_mode new file mode 100644 index 00000000..179b22bf --- /dev/null +++ b/package/gluon-config-mode/files/etc/config/config_mode @@ -0,0 +1,3 @@ +config wizard + option enabled '1' + option configured '0' diff --git a/package/gluon-config-mode/files/etc/hotplug.d/button/50-config-mode b/package/gluon-config-mode/files/etc/hotplug.d/button/50-config-mode new file mode 100755 index 00000000..0e4e8a89 --- /dev/null +++ b/package/gluon-config-mode/files/etc/hotplug.d/button/50-config-mode @@ -0,0 +1,29 @@ +#!/bin/sh + + +wait=3 + + +wait_config_mode() { + sleep $wait + uci set 'config_mode.@wizard[0].enabled=1' + uci commit config_mode + reboot +} + + +if [ "$BUTTON" = wps -o "$BUTTON" = reset ]; then + case "$ACTION" in + pressed) + wait_config_mode & + PID=$! + echo $PID > /tmp/.wait_config_mode + ;; + released) + if [ -r /tmp/.wait_config_mode ]; then + kill $(cat /tmp/.wait_config_mode) + rm /tmp/.wait_config_mode + fi + ;; + esac +fi diff --git a/package/gluon-config-mode/files/etc/init.d/config_mode b/package/gluon-config-mode/files/etc/init.d/config_mode new file mode 100755 index 00000000..e4b5efb2 --- /dev/null +++ b/package/gluon-config-mode/files/etc/init.d/config_mode @@ -0,0 +1,53 @@ +#!/bin/sh /etc/rc.common + +START=12 + + +config_mode_iface=eth0 +config_mode_addr=192.168.1.1 +config_mode_plen=24 + +config_mode_dnsname=freifunk +config_mode_dhcp_range=192.168.1.2,192.168.1.254 + +check_enable() { + config_get enabled "$1" enabled + config_get configured "$1" configured + + if [ "$enabled" = 1 -o "$configured" != 1 ]; then + export enable=1 + fi +} + +start() { + enable=0 + config_load config_mode + config_foreach check_enable wizard + + if [ "$enable" = '1' ]; then + lua -luci -e 'require "luci.model.uci"; uci_state=luci.model.uci.cursor_state(); uci_state:section("config_mode", "wizard", nil, { running = "1" }); uci_state:save("config_mode")' + uci set 'config_mode.@wizard[0].enabled=0' + uci commit config_mode + + ip addr add $config_mode_addr/$config_mode_plen dev $config_mode_iface + ip link set up dev $config_mode_iface + + /etc/init.d/telnet start + /etc/init.d/dropbear start + /etc/init.d/uhttpd start + /etc/init.d/led start + + # correctly finish firstboot + /etc/init.d/done boot + + echo "$config_mode_addr $config_mode_dnsname" > /tmp/hosts.config_mode + dnsmasq -h -H /tmp/hosts.config_mode -R -F interface:$config_mode_iface,$config_mode_dhcp_range -l /tmp/dhcp.leases -O option:router + + . /etc/diag.sh + get_status_led + status_led_set_timer 1000 300 + + # block further boot + while true; do sleep 1; done + fi +} diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/freifunk/index.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/freifunk/index.lua new file mode 100644 index 00000000..cc2bcadb --- /dev/null +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/freifunk/index.lua @@ -0,0 +1,13 @@ +module("luci.controller.freifunk.index", package.seeall) + + +function index() + local uci_state = luci.model.uci.cursor_state() + + if uci_state:get_first("config_mode", "wizard", "running", "0") == "1" then + local root = node() + root.target = alias("wizard", "welcome") + root.index = true + end +end + diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/freifunk/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/freifunk/wizard.lua new file mode 100644 index 00000000..ab64f4f8 --- /dev/null +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/freifunk/wizard.lua @@ -0,0 +1,30 @@ +module("luci.controller.freifunk.wizard", package.seeall) + +function index() + local uci_state = luci.model.uci.cursor_state() + if uci_state:get_first("config_mode", "wizard", "running", "0") == "1" then + entry({"wizard", "welcome"}, template("freifunk-wizard/welcome"), "Willkommen", 10).dependent=false + entry({"wizard", "password"}, form("freifunk-wizard/password"), "Passwort", 20).dependent=false + entry({"wizard", "hostname"}, form("freifunk-wizard/hostname"), "Hostname", 30).dependent=false + entry({"wizard", "meshvpn"}, form("freifunk-wizard/meshvpn"), "Mesh-VPN", 40).dependent=false + entry({"wizard", "meshvpn", "pubkey"}, template("freifunk-wizard/meshvpn-key"), "Mesh-VPN Key", 1).dependent=false + entry({"wizard", "completed"}, template("freifunk-wizard/completed"), "Fertig", 50).dependent=false + entry({"wizard", "completed", "reboot"}, call("reboot"), "reboot", 1).dependent=false + end +end + +function reboot() + local uci = luci.model.uci.cursor() + + uci:foreach("config_mode", "wizard", + function(s) + uci:set("config_mode", s[".name"], "configured", "1") + end + ) + + uci:save("config_mode") + uci:commit("config_mode") + + luci.sys.reboot() +end + diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/hostname.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/hostname.lua new file mode 100644 index 00000000..ed387f9f --- /dev/null +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/hostname.lua @@ -0,0 +1,38 @@ +local uci = luci.model.uci.cursor() + +local nav = require "luci.tools.freifunk-wizard.nav" + +local f = SimpleForm("hostname", "Name deines Freifunkknotens", "Als nächstes solltest du einem Freifunkknoten einen individuellen Namen geben. Dieser hilft dir und auch uns den Überblick zu behalten.") +f.template = "freifunk-wizard/wizardform" + +hostname = f:field(Value, "hostname", "Hostname") +hostname.value = uci:get_first("system", "system", "hostname") +hostname.rmempty = false + +function hostname.validate(self, value, section) + return value +end + +function f.handle(self, state, data) + if state == FORM_VALID then + local stat = true + uci:foreach("system", "system", function(s) + stat = stat and uci:set("system", s[".name"], "hostname", data.hostname) + end + ) + + stat = stat and uci:save("system") + stat = stat and uci:commit("system") + + if stat then + nav.maybe_redirect_to_successor() + f.message = "Hostname geändert!" + else + f.errmessage = "Fehler!" + end + end + + return true +end + +return f diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/meshvpn.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/meshvpn.lua new file mode 100644 index 00000000..6ca35c8a --- /dev/null +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/meshvpn.lua @@ -0,0 +1,67 @@ +local meshvpn_name = "mesh_vpn" + +local uci = luci.model.uci.cursor() +local nav = require "luci.tools.freifunk-wizard.nav" + +local f = SimpleForm("meshvpn", "Mesh-VPN", "

Um deinen Freifunkknoten auch über das Internet mit dem Freifunk-Netzwerk zu verbinden, kann das Mesh-VPN aktiviert werden.\ +Dies erlaubt es, den Freifunk-Knoten zu betreiben, auch wenn es keine anderen Knoten in deiner Umgebung gibt, mit denen eine WLAN-Verbindung möglich ist.

\ +

Dabei wird zur Kommunikation ein verschlüsselter Tunnel verwendet, sodass für den Anschluss-Inhaber keinerlei Risiken entstehen.

\ +

Damit das Mesh-VPN deine Internet-Verbindung nicht unverhältnismäßig auslastet, kann die Bandbreite begrenzt werden. Wenn du zum Beispiel eine DSL-16000-Leitung hast\ +und maximal ein Viertel der Leitung zur Verfügung stellen willst, muss als Downstream-Bandbreite 4000 kbit/s eingetragen werden.

\ +

Um das Freifunk-Netz nicht zu sehr auszubremsen, bitten wir darum, mindestens 1000 kbit/s im Downstream und 100 kbit/s im Upstream bereitzustellen.

") +f.template = "freifunk-wizard/wizardform" + +meshvpn = f:field(Flag, "meshvpn", "Mesh-VPN aktivieren?") +meshvpn.default = string.format("%d", uci:get("fastd", meshvpn_name, "enabled", "0")) +meshvpn.rmempty = false + +tc = f:field(Flag, "tc", "Bandbreitenbegrenzung aktivieren?") +tc.default = string.format("%d", uci:get_first("freifunk", "bandwidth", "enabled", "0")) +tc.rmempty = false + +downstream = f:field(Value, "downstream", "Downstream-Bandbreite (kbit/s)") +downstream.value = uci:get_first("freifunk", "bandwidth", "downstream", "0") +upstream = f:field(Value, "upstream", "Upstream-Bandbreite (kbit/s)") +upstream.value = uci:get_first("freifunk", "bandwidth", "upstream", "0") + +function f.handle(self, state, data) + if state == FORM_VALID then + local stat = false + uci:set("fastd", meshvpn_name, "enabled", data.meshvpn) + uci:save("fastd") + uci:commit("fastd") + + uci:foreach("freifunk", "bandwidth", function(s) + uci:set("freifunk", s[".name"], "upstream", data.upstream) + uci:set("freifunk", s[".name"], "downstream", data.downstream) + uci:set("freifunk", s[".name"], "enabled", data.tc) + end + ) + + uci:save("freifunk") + uci:commit("freifunk") + + if data.meshvpn == "1" then + local secret = uci:get("fastd", meshvpn_name, "secret") + if not secret or not secret:match("%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x") then + luci.sys.call("/etc/init.d/haveged start") + local f = io.popen("fastd --generate-key --machine-readable", "r") + local secret = f:read("*a") + f:close() + luci.sys.call("/etc/init.d/haveged stop") + + uci:set("fastd", meshvpn_name, "secret", secret) + uci:save("fastd") + uci:commit("fastd") + + end + luci.http.redirect(luci.dispatcher.build_url("wizard", "meshvpn", "pubkey")) + else + nav.maybe_redirect_to_successor() + end + end + + return true +end + +return f diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/password.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/password.lua new file mode 100644 index 00000000..b752b848 --- /dev/null +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/password.lua @@ -0,0 +1,43 @@ +local nav = require "luci.tools.freifunk-wizard.nav" + +f = SimpleForm("password", "Administrator-Passwort setzen", "

Damit nur du Zugriff auf deinen Freifunkknoten hast, solltest du jetzt ein Passwort vergeben. \ +Da man mit Hilfe von diesem beliebige Einstellungen geändert werden können, sollte es möglichst sicher sein.

\ +

Bitte beachte dazu folgende Hinweise:

\ +") +f.template = "freifunk-wizard/wizardform" + +pw1 = f:field(Value, "pw1", "Passwort") +pw1.password = true +pw1.rmempty = false + +pw2 = f:field(Value, "pw2", "Wiederholung") +pw2.password = true +pw2.rmempty = false + +function pw2.validate(self, value, section) + return pw1:formvalue(section) == value and value +end + +function f.handle(self, state, data) + if state == FORM_VALID then + local stat = luci.sys.user.setpasswd("root", data.pw1) == 0 + + if stat then + nav.maybe_redirect_to_successor() + f.message = "Passwort geändert!" + else + f.errmessage = "Fehler!" + end + + data.pw1 = nil + data.pw2 = nil + end + + return true +end + +return f diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/tools/freifunk-wizard/nav.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/tools/freifunk-wizard/nav.lua new file mode 100644 index 00000000..ec6c0a12 --- /dev/null +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/tools/freifunk-wizard/nav.lua @@ -0,0 +1,43 @@ +module("luci.tools.freifunk-wizard.nav", package.seeall) + +function maybe_redirect_to_successor() + local pre, suc = get() + + if suc then + luci.http.redirect(luci.dispatcher.build_url("wizard", suc.href)) + end +end + +function get() + + local disp = require "luci.dispatcher" + + local request = disp.context.path + local category = request[1] + local cattree = category and disp.node(category) + + local childs = disp.node_childs(cattree) + + local predecessor = nil + local successor = nil + + if #childs > 0 then + local found_pre = false + for i, r in ipairs(childs) do + local nnode = cattree.nodes[r] + nnode.href = r + + if r == request[2] then + found_pre = true + elseif found_pre and successor == nil then + successor = nnode + end + + if not found_pre then + predecessor = nnode + end + end + end + + return predecessor, successor +end diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/completed.htm b/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/completed.htm new file mode 100644 index 00000000..3c096b7d --- /dev/null +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/completed.htm @@ -0,0 +1,16 @@ +<% + local disp = require "luci.dispatcher" +%> +<%+header%> +

Konfiguration abgeschlossen

+ +

Die Konfiguration deines Freifunkknotens ist nun abgeschlossen. Damit sie aktiv wird, muss der Knoten neugestartet werden.

+ +

Um später wieder in den Konfiguration-Modus zurückzukehren, zum Beispiel um die Konfiguration zu verändern oder ein Firmware-Upgrade durchzuführen, + muss der QSS-Button am Gehäuse für einige Sekunden gedrückt gehalten werden, während der Knoten läuft. Der Knoten wird dann neu starten und in + den Konfigurationsmodus zurückkehren.

+ +

+ ">Jetzt neustarten! +

+<%+footer%> diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/footer.htm b/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/footer.htm new file mode 100644 index 00000000..57e20f31 --- /dev/null +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/footer.htm @@ -0,0 +1,19 @@ +<% local xtime +if exectime then + xtime = (string.format("%.2fs", os.clock() - exectime)) +end %> + + + + + + + + diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/header.htm b/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/header.htm new file mode 100644 index 00000000..7c28bc43 --- /dev/null +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/header.htm @@ -0,0 +1,24 @@ +<% + local fs = require "luci.fs" + local sys = require "luci.sys" + local http = require "luci.http" + local disp = require "luci.dispatcher" + + local hostname = sys.hostname() +%> + + + + + + +<%=striptags( hostname )%> - Wizard + + + + +
+ + diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/meshvpn-key.htm b/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/meshvpn-key.htm new file mode 100644 index 00000000..781dd11b --- /dev/null +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/meshvpn-key.htm @@ -0,0 +1,18 @@ +<% + local meshvpn_name = "mesh_vpn" + local address = "freifunk.luebeck@asta.uni-luebeck.de" + + local disp = require "luci.dispatcher" + local f = io.popen("/etc/init.d/fastd show_key " .. meshvpn_name, "r") + local key = f:read("*a") + f:close() + +%> +<%+header%> +

Schlüsselaustausch

+

Dies ist der öffentliche Schlüssel deines Freifunkknotens. Bitte schicke ihn an <%=address%>, um ihn auf den Freifunkservern eintragen zu lassen. Sobald der Schlüssel eingetragen wurde, kann dein Knoten das Mesh-VPN nutzen.

+
+ <%=key%> +
+<%+freifunk-wizard/nav%> +<%+footer%> diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/nav.htm b/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/nav.htm new file mode 100644 index 00000000..ca46eaee --- /dev/null +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/nav.htm @@ -0,0 +1,15 @@ +<% + local nav = require "luci.tools.freifunk-wizard.nav" + local predecessor, successor = nav.get() +%> + +
+ +<% if successor then %> + ">Weiter +<% end %> + +<% if predecessor then %> + ">Zurück +<% end %> +
diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/welcome.htm b/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/welcome.htm new file mode 100644 index 00000000..259f4d85 --- /dev/null +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/welcome.htm @@ -0,0 +1,19 @@ +<% + local disp = require "luci.dispatcher" + local nav = require "luci.tools.freifunk-wizard.nav" + local predecessor, successor = nav.get() +%> +<%+header%> +

Willkommen auf deinem Freifunkknoten!

+

Danke, dass du Freifunk unterstützt.

+

Dieser Wizard hilft dir nun deinen Knoten einzurichten. Dabei führt er dich schrittweise durch die wichtigsten Punkte.

+ +
+<% if successor then %> + ">Knoten neu einrichten +<% end %> + + ">Firmwareupgrade einspielen +
+<%+footer%> + diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/wizardform.htm b/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/wizardform.htm new file mode 100644 index 00000000..875f448b --- /dev/null +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/wizardform.htm @@ -0,0 +1,68 @@ +<% if not self.embedded then %> +
+
+ + +
+<% end %> +
+ <% if self.title and #self.title > 0 then %>

<%=self.title%>

<% end %> + <% if self.description and #self.description > 0 then %>
<%=self.description%>
<% end %> + <% self:render_children() %> +
+
+<%- if self.message then %> +
<%=self.message%>
+<%- end %> +<%- if self.errmessage then %> +
<%=self.errmessage%>
+<%- end %> +<% if not self.embedded then %> +
+<%- + if type(self.hidden) == "table" then + for k, v in pairs(self.hidden) do +-%> + +<%- + end + end +%> +
+<% if redirect then %> +
+ +
+<% end %> +<%- if self.flow and self.flow.skip then %> + +<% end %> +<%- if self.submit ~= false then %> + +<% end %> +<%- if self.reset ~= false then %> + +<% end %> +<%- if self.cancel ~= false and self.on_cancel then %> + +<% end %> +<% + local nav = require "luci.tools.freifunk-wizard.nav" + local predecessor, successor = nav.get() +%> + <% if predecessor then %> + "> + Zurück + + <% end %> + +
+
+
+<% end %> From 19b611f8abc0e3c1b90e6541741eeee7beaf74cb Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 31 Jan 2013 10:23:27 +0100 Subject: [PATCH 002/453] Add gluon-core package This is the most basic core of the Gluon framework. Most upgrade scripts will have to be rewritten and/or moved to other packages. --- package/gluon-core/Makefile | 35 ++++++++++ .../files/etc/uci-defaults/zzz-gluon-upgrade | 69 +++++++++++++++++++ .../core/0.3.1/010-freifunk-migrate-config | 16 +++++ .../core/0.3.1/011-freifunk-disable-services | 4 ++ .../core/0.3.1/012-freifunk-migrate-network | 18 +++++ .../0.3.1/013-freifunk-migrate-batman-adv | 17 +++++ .../gluon/upgrade/core/0.3.1/020-lff-wireless | 6 ++ .../gluon/upgrade/core/0.3.1/021-lff-fastd | 9 +++ .../0.3.2/010-freifunk-migrate-batman-adv | 5 ++ .../core/0.3.2/011-update-avahi-daemon-conf | 6 ++ .../core/0.3.2/020-lff-migrate-mesh-vpn | 33 +++++++++ .../upgrade/core/0.3.2/021-lff-migrate-peers | 11 +++ .../0.3.3/010-freifunk-migrate-batman-adv | 38 ++++++++++ .../upgrade/core/initial/010-freifunk-system | 40 +++++++++++ .../upgrade/core/initial/011-freifunk-network | 64 +++++++++++++++++ .../initial/012-freifunk-disable-services | 5 ++ .../upgrade/core/initial/020-lff-wireless | 25 +++++++ .../gluon-core/files/lib/upgrade/keep.d/gluon | 1 + 18 files changed, 402 insertions(+) create mode 100644 package/gluon-core/Makefile create mode 100755 package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade create mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/010-freifunk-migrate-config create mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/011-freifunk-disable-services create mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/012-freifunk-migrate-network create mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/013-freifunk-migrate-batman-adv create mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/020-lff-wireless create mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/021-lff-fastd create mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/0.3.2/010-freifunk-migrate-batman-adv create mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/0.3.2/011-update-avahi-daemon-conf create mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/0.3.2/020-lff-migrate-mesh-vpn create mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/0.3.2/021-lff-migrate-peers create mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/0.3.3/010-freifunk-migrate-batman-adv create mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/initial/010-freifunk-system create mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/initial/011-freifunk-network create mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/initial/012-freifunk-disable-services create mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/initial/020-lff-wireless create mode 100644 package/gluon-core/files/lib/upgrade/keep.d/gluon diff --git a/package/gluon-core/Makefile b/package/gluon-core/Makefile new file mode 100644 index 00000000..73034980 --- /dev/null +++ b/package/gluon-core/Makefile @@ -0,0 +1,35 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-core +PKG_VERSION:=0.3.2.99 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-core + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Base files of Gluon +endef + +define Package/gluon-core/description + The core of the Gluon community wifi mesh firmware framework +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-core/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-core)) diff --git a/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade b/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade new file mode 100755 index 00000000..3b9fc07d --- /dev/null +++ b/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade @@ -0,0 +1,69 @@ +#!/bin/sh + + +UPGRADE_DIR=/lib/gluon/upgrade +VERSION_DIR=/lib/gluon/version + + +version_of() { + opkg status "gluon-$1" | grep '^Version: ' | cut -d' ' -f 2 +} + +oldversion_of() { + oldversion="$(cat "$VERSION_DIR"/"$1" 2>/dev/null)" + + # Legacy support + if [ -z "$oldversion" ]; then oldversion="$(cat /etc/.freifunk_version_keep 2>/dev/null)"; fi + if [ -z "$oldversion" ]; then oldversion="$(cat /etc/.lff_version_keep 2>/dev/null)"; fi + if [ -z "$oldversion" ]; then oldversion="$(cat /etc/.kff_version_keep 2>/dev/null)"; fi + + echo "$oldversion" +} + +do_dir() { + if [ -d "$1" ]; then + local s + for s in "$1"/*; do "$s"; done + fi +} + + +version="$(version_of gluon-core)" + +oldversion="$(cat "$VERSION_FILE" 2>/dev/null)" +if [ -z "$oldversion" ]; then oldversion="$(cat "$VERSION_FILE_FREIFUNK" 2>/dev/null)"; fi +if [ -z "$oldversion" ]; then oldversion="$(cat "$VERSION_FILE_LFF" 2>/dev/null)"; fi +if [ -z "$oldversion" ]; then oldversion="$(cat "$VERSION_FILE_KFF" 2>/dev/null)"; fi + +( + cd "$UPGRADE_DIR" + + for component in *; do ( + local version="$(version_of "$component")" + if [ -z "$version" ]; then continue; fi + + cd "$component" + + local oldversion="$(oldversion_of "$component")" + if [ -z "$oldversion" ]; then + do_dir initial + else + local v + + for v in *; do + if [ "$v" = initial -o "$v" = invariant -o "$v" = version ]; then continue; fi + + # The return value of opkg compare-versions is negated + if ! opkg compare-versions "$v" '>>' "$oldversion"; then + do_dir "$v" + fi + done + fi + + do_dir invariant + + echo "$version" > "$VERSION_DIR"/"$component" + ) done +) + +rm -f "$VERSION_FILE_FREIFUNK" "$VERSION_FILE_LFF" "$VERSION_FILE_KFF" diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/010-freifunk-migrate-config b/package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/010-freifunk-migrate-config new file mode 100755 index 00000000..8f6d7026 --- /dev/null +++ b/package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/010-freifunk-migrate-config @@ -0,0 +1,16 @@ +#!/bin/sh + + +[ -r /etc/config/ffhl ] || exit 0 + +cp /etc/config/ffhl /etc/config/config_mode +mv /etc/config/ffhl /etc/config/freifunk + +uci -q batch </dev/null || true +) + +rmdir -p /etc/fastd/ffhl-mesh-vpn/peers 2>/dev/null || true diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/0.3.3/010-freifunk-migrate-batman-adv b/package/gluon-core/files/lib/gluon/upgrade/core/0.3.3/010-freifunk-migrate-batman-adv new file mode 100755 index 00000000..ba32c95b --- /dev/null +++ b/package/gluon-core/files/lib/gluon/upgrade/core/0.3.3/010-freifunk-migrate-batman-adv @@ -0,0 +1,38 @@ +#!/bin/sh + +. /lib/ar71xx.sh + +local board="$(ar71xx_board_name)" + +uci -q batch < Date: Thu, 31 Jan 2013 11:36:18 +0100 Subject: [PATCH 003/453] More makefiles for some basic packages --- package/gluon-config-mode/Makefile | 5 ++-- package/gluon-core/Makefile | 2 +- package/gluon-mesh-batman-adv/Makefile | 36 ++++++++++++++++++++++++++ package/gluon-mesh-vpn-fastd/Makefile | 36 ++++++++++++++++++++++++++ 4 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 package/gluon-mesh-batman-adv/Makefile create mode 100644 package/gluon-mesh-vpn-fastd/Makefile diff --git a/package/gluon-config-mode/Makefile b/package/gluon-config-mode/Makefile index 2cdac318..927ca318 100644 --- a/package/gluon-config-mode/Makefile +++ b/package/gluon-config-mode/Makefile @@ -4,7 +4,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-config-mode -PKG_RELEASE:=0.0.1 +PKG_VERSION:=0.3.2.99 +PKG_RELEASE:=1 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) @@ -14,7 +15,7 @@ define Package/gluon-config-mode SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci based config mode for user friendly setup of new meshnodes - DEPENDS:=+luci-mod-admin-core + DEPENDS:=+gluon-core +luci-mod-admin-core endef define Package/gluon-config-mode/description diff --git a/package/gluon-core/Makefile b/package/gluon-core/Makefile index 73034980..c0979a1b 100644 --- a/package/gluon-core/Makefile +++ b/package/gluon-core/Makefile @@ -15,7 +15,7 @@ define Package/gluon-core endef define Package/gluon-core/description - The core of the Gluon community wifi mesh firmware framework + Gluon community wifi mesh firmware framework: core endef define Build/Prepare diff --git a/package/gluon-mesh-batman-adv/Makefile b/package/gluon-mesh-batman-adv/Makefile new file mode 100644 index 00000000..8a818a80 --- /dev/null +++ b/package/gluon-mesh-batman-adv/Makefile @@ -0,0 +1,36 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-mesh-batman-adv +PKG_VERSION:=0.3.2.99 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-mesh-batman-adv + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Support for batman-adv meshing + DEPENDS:=+gluon-core +endef + +define Package/gluon-mesh-batman-adv/description + Gluon community wifi mesh firmware framework: batman-adv support +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-mesh-batman-adv/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-mesh-batman-adv)) diff --git a/package/gluon-mesh-vpn-fastd/Makefile b/package/gluon-mesh-vpn-fastd/Makefile new file mode 100644 index 00000000..777cb024 --- /dev/null +++ b/package/gluon-mesh-vpn-fastd/Makefile @@ -0,0 +1,36 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-mesh-vpn-fastd +PKG_VERSION:=0.3.2.99 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-mesh-vpn-fastd + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Support for connecting batman-adv meshes via fastd + DEPENDS:=+gluon-core +gluon-mesh-batman-adv +fastd +endef + +define Package/gluon-mesh-vpn-fastd/description + Gluon community wifi mesh firmware framework: fastd support +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-mesh-vpn-fastd/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-mesh-vpn-fastd)) From a7e22f30b315586ff494998c99a1c3ee23dc8a7a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 31 Jan 2013 16:15:32 +0100 Subject: [PATCH 004/453] Move batman-adv migration scripts to gluon-mesh-batman-adv package --- .../gluon/upgrade/mesh-batman-adv/0.3.1/010-migrate-batman-adv} | 0 .../gluon/upgrade/mesh-batman-adv/0.3.2/010-migrate-batman-adv} | 0 .../gluon/upgrade/mesh-batman-adv/0.3.3/010-migrate-batman-adv} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename package/{gluon-core/files/lib/gluon/upgrade/core/0.3.1/013-freifunk-migrate-batman-adv => gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/0.3.1/010-migrate-batman-adv} (100%) rename package/{gluon-core/files/lib/gluon/upgrade/core/0.3.2/010-freifunk-migrate-batman-adv => gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/0.3.2/010-migrate-batman-adv} (100%) rename package/{gluon-core/files/lib/gluon/upgrade/core/0.3.3/010-freifunk-migrate-batman-adv => gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/0.3.3/010-migrate-batman-adv} (100%) diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/013-freifunk-migrate-batman-adv b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/0.3.1/010-migrate-batman-adv similarity index 100% rename from package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/013-freifunk-migrate-batman-adv rename to package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/0.3.1/010-migrate-batman-adv diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/0.3.2/010-freifunk-migrate-batman-adv b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/0.3.2/010-migrate-batman-adv similarity index 100% rename from package/gluon-core/files/lib/gluon/upgrade/core/0.3.2/010-freifunk-migrate-batman-adv rename to package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/0.3.2/010-migrate-batman-adv diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/0.3.3/010-freifunk-migrate-batman-adv b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/0.3.3/010-migrate-batman-adv similarity index 100% rename from package/gluon-core/files/lib/gluon/upgrade/core/0.3.3/010-freifunk-migrate-batman-adv rename to package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/0.3.3/010-migrate-batman-adv From eecf9b06fd5a5ddd690029f164ffc5a7b3e2eb80 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 31 Jan 2013 16:24:29 +0100 Subject: [PATCH 005/453] Move disable-services script to invariant directory --- .../gluon/upgrade/core/0.3.1/011-freifunk-disable-services | 4 ---- .../010-disable-services} | 0 2 files changed, 4 deletions(-) delete mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/011-freifunk-disable-services rename package/gluon-core/files/lib/gluon/upgrade/core/{initial/012-freifunk-disable-services => invariant/010-disable-services} (100%) diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/011-freifunk-disable-services b/package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/011-freifunk-disable-services deleted file mode 100755 index ac58cd66..00000000 --- a/package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/011-freifunk-disable-services +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -/etc/init.d/dnsmasq disable -/etc/init.d/telnet disable diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/012-freifunk-disable-services b/package/gluon-core/files/lib/gluon/upgrade/core/invariant/010-disable-services similarity index 100% rename from package/gluon-core/files/lib/gluon/upgrade/core/initial/012-freifunk-disable-services rename to package/gluon-core/files/lib/gluon/upgrade/core/invariant/010-disable-services From 6f41a9b7bf7e6f3349b867c203ba30419a823fbd Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 11 Feb 2013 21:48:36 +0100 Subject: [PATCH 006/453] Add stub setup script so the package is not empty --- .../gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd diff --git a/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd new file mode 100644 index 00000000..0f6d3cfa --- /dev/null +++ b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd @@ -0,0 +1,3 @@ +#!/bin/sh + +# TODO From fb65dfe12dca3161abf7932e69c687d706be3819 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 12 Feb 2013 00:05:55 +0100 Subject: [PATCH 007/453] Make gluon-mesh-batman-adv depend on kmod-batman-adv --- package/gluon-mesh-batman-adv/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-mesh-batman-adv/Makefile b/package/gluon-mesh-batman-adv/Makefile index 8a818a80..7bb38bb1 100644 --- a/package/gluon-mesh-batman-adv/Makefile +++ b/package/gluon-mesh-batman-adv/Makefile @@ -12,7 +12,7 @@ define Package/gluon-mesh-batman-adv SECTION:=gluon CATEGORY:=Gluon TITLE:=Support for batman-adv meshing - DEPENDS:=+gluon-core + DEPENDS:=+gluon-core +kmod-batman-adv endef define Package/gluon-mesh-batman-adv/description From 7affd55c1b9afd1d74d4baa47c0859b924cc20f7 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 19 Feb 2013 00:18:14 +0100 Subject: [PATCH 008/453] Add some gluon-config-mode dependencies --- package/gluon-config-mode/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/gluon-config-mode/Makefile b/package/gluon-config-mode/Makefile index 927ca318..001d41d5 100644 --- a/package/gluon-config-mode/Makefile +++ b/package/gluon-config-mode/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-config-mode PKG_VERSION:=0.3.2.99 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) @@ -15,7 +15,7 @@ define Package/gluon-config-mode SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci based config mode for user friendly setup of new meshnodes - DEPENDS:=+gluon-core +luci-mod-admin-core + DEPENDS:=+gluon-core +uhttpd +dnsmasq +luci-mod-admin-core endef define Package/gluon-config-mode/description From 05fb012ae4444d7074ec368f2385533566c7cac9 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 28 Sep 2013 18:40:37 +0200 Subject: [PATCH 009/453] Generate wifi config --- package/gluon-core/Makefile | 1 + .../lib/gluon/upgrade/core/initial/020-wireless} | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) rename package/gluon-core/{files/lib/gluon/upgrade/core/initial/020-lff-wireless => generate/lib/gluon/upgrade/core/initial/020-wireless} (67%) diff --git a/package/gluon-core/Makefile b/package/gluon-core/Makefile index c0979a1b..ca892ecb 100644 --- a/package/gluon-core/Makefile +++ b/package/gluon-core/Makefile @@ -30,6 +30,7 @@ endef define Package/gluon-core/install $(CP) ./files/* $(1)/ + $(GLUON_GENERATE) ./generate/* $(1)/ endef $(eval $(call BuildPackage,gluon-core)) diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/020-lff-wireless b/package/gluon-core/generate/lib/gluon/upgrade/core/initial/020-wireless similarity index 67% rename from package/gluon-core/files/lib/gluon/upgrade/core/initial/020-lff-wireless rename to package/gluon-core/generate/lib/gluon/upgrade/core/initial/020-wireless index 18e9c7cd..ca9cc329 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/020-lff-wireless +++ b/package/gluon-core/generate/lib/gluon/upgrade/core/initial/020-wireless @@ -4,7 +4,7 @@ uci -q batch < Date: Sat, 28 Sep 2013 21:24:13 +0200 Subject: [PATCH 010/453] Some work on the next-node anycast address --- package/gluon-next-node/Makefile | 36 +++++++++++++++++++ .../generate/etc/init.d/gluon-next-node | 25 +++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 package/gluon-next-node/Makefile create mode 100644 package/gluon-next-node/generate/etc/init.d/gluon-next-node diff --git a/package/gluon-next-node/Makefile b/package/gluon-next-node/Makefile new file mode 100644 index 00000000..aa51c20f --- /dev/null +++ b/package/gluon-next-node/Makefile @@ -0,0 +1,36 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-next-node +PKG_VERSION:=0.3.2.99 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-next-node + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Next-node anycast address + DEPENDS:=+gluon-core +gluon-mesh-batman-adv +iproute2 +kmod-macvlan +endef + +define Package/gluon-next-node/description + Gluon community wifi mesh firmware framework: next-node anycast address +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-next-node/install + $(GLUON_GENERATE) ./generate/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-next-node)) diff --git a/package/gluon-next-node/generate/etc/init.d/gluon-next-node b/package/gluon-next-node/generate/etc/init.d/gluon-next-node new file mode 100644 index 00000000..963a63c8 --- /dev/null +++ b/package/gluon-next-node/generate/etc/init.d/gluon-next-node @@ -0,0 +1,25 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2013 Project Gluon + +START=95 + + +start() { + ip link add link br-mesh name local-node type macvlan + ip link set local-node address @next_node.mac@ + + ip address add @next_node.ip4@/32 dev local-node + ip route add @next_node.prefix4@ dev br-freifunk + + ip address add @next_node.ip6@/128 dev local-node + ip route add @next_node.prefix6@ dev br-freifunk + + ip link set local-node up +} + +stop() { + ip route del @next_node.prefix4@ dev br-freifunk + ip route del @next_node.prefix6@ dev br-freifunk + ip link set local-node down + ip link del local-node +} From 6543ef972505963f0891836ace73eda302abf358 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 28 Sep 2013 21:45:04 +0200 Subject: [PATCH 011/453] Adjust some old scripts to gluon (TODO: reimplement backwards compatiblity) --- .../core/0.3.1/010-freifunk-migrate-config | 16 --------- .../core/0.3.1/012-freifunk-migrate-network | 18 ---------- .../gluon/upgrade/core/0.3.1/020-lff-wireless | 6 ---- .../gluon/upgrade/core/0.3.1/021-lff-fastd | 9 ----- .../core/0.3.2/011-update-avahi-daemon-conf | 6 ---- .../core/0.3.2/020-lff-migrate-mesh-vpn | 33 ------------------- .../upgrade/core/0.3.2/021-lff-migrate-peers | 11 ------- .../{010-freifunk-system => 010-gluon-system} | 2 +- ...011-freifunk-network => 011-gluon-network} | 14 ++++---- .../gluon/upgrade/core/initial/020-wireless | 12 +++---- 10 files changed, 14 insertions(+), 113 deletions(-) delete mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/010-freifunk-migrate-config delete mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/012-freifunk-migrate-network delete mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/020-lff-wireless delete mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/021-lff-fastd delete mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/0.3.2/011-update-avahi-daemon-conf delete mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/0.3.2/020-lff-migrate-mesh-vpn delete mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/0.3.2/021-lff-migrate-peers rename package/gluon-core/files/lib/gluon/upgrade/core/initial/{010-freifunk-system => 010-gluon-system} (93%) rename package/gluon-core/files/lib/gluon/upgrade/core/initial/{011-freifunk-network => 011-gluon-network} (83%) diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/010-freifunk-migrate-config b/package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/010-freifunk-migrate-config deleted file mode 100755 index 8f6d7026..00000000 --- a/package/gluon-core/files/lib/gluon/upgrade/core/0.3.1/010-freifunk-migrate-config +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - - -[ -r /etc/config/ffhl ] || exit 0 - -cp /etc/config/ffhl /etc/config/config_mode -mv /etc/config/ffhl /etc/config/freifunk - -uci -q batch </dev/null || true -) - -rmdir -p /etc/fastd/ffhl-mesh-vpn/peers 2>/dev/null || true diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/010-freifunk-system b/package/gluon-core/files/lib/gluon/upgrade/core/initial/010-gluon-system similarity index 93% rename from package/gluon-core/files/lib/gluon/upgrade/core/initial/010-freifunk-system rename to package/gluon-core/files/lib/gluon/upgrade/core/initial/010-gluon-system index 376ba8f7..635b5a53 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/010-freifunk-system +++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/010-gluon-system @@ -34,7 +34,7 @@ EOF esac uci -q batch < Date: Sat, 28 Sep 2013 22:03:20 +0200 Subject: [PATCH 012/453] Add ebtables package --- package/gluon-ebtables/Makefile | 36 +++++++++ .../files/etc/init.d/gluon-ebtables | 74 +++++++++++++++++++ .../files/lib/gluon/ebtables/.keep | 0 3 files changed, 110 insertions(+) create mode 100644 package/gluon-ebtables/Makefile create mode 100755 package/gluon-ebtables/files/etc/init.d/gluon-ebtables create mode 100644 package/gluon-ebtables/files/lib/gluon/ebtables/.keep diff --git a/package/gluon-ebtables/Makefile b/package/gluon-ebtables/Makefile new file mode 100644 index 00000000..64a18e7b --- /dev/null +++ b/package/gluon-ebtables/Makefile @@ -0,0 +1,36 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-ebtables +PKG_VERSION:=0.3.2.99 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-ebtables + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Ebtables support + DEPENDS:=+gluon-core +ebtables +kmod-ebtables-ipv4 +kmod-ebtables-ipv6 +endef + +define Package/gluon-ebtables/description + Gluon community wifi mesh firmware framework: ebtables support +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-ebtables/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-ebtables)) diff --git a/package/gluon-ebtables/files/etc/init.d/gluon-ebtables b/package/gluon-ebtables/files/etc/init.d/gluon-ebtables new file mode 100755 index 00000000..cbc3d6ae --- /dev/null +++ b/package/gluon-ebtables/files/etc/init.d/gluon-ebtables @@ -0,0 +1,74 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2013 Project Gluon +# +# Firewall script for inserting and removing ebtables rules. +# +# Example format, for filtering any IPv4 multicast packets to the SSDP UDP port: +# rule FORWARD --logical-out br-client -d Multicast -p IPv4 --ip-protocol udp --ip-destination-port 5355 -j DROP +# +# Removing all rules: +# $ ./firewall-ebtables stop +# Inserting all rules: +# $ ./firewall-ebtables start +# Inserting a specific rule file: +# $ ./firewall-ebtables start /lib/gluon/ebtables/100-mcast-chain +# Removing a specific rule file: +# $ ./firewall-ebtables stop /lib/gluon/ebtables/100-mcast-chain + + +START=19 +STOP=91 + + +exec_file() { + local file="$1" + + sh -c " + eval 'rule() { + $EBTABLES_RULE + }' + eval 'chain() { + $EBTABLES_CHAIN + }' + source \"$1\" + " - "$file" +} + +exec_all() { + local sort_arg="$1" + + local old_ifs="$IFS" + IFS=' +' + for file in `find /lib/gluon/ebtables -type f | sort $sort_arg`; do + exec_file "$file" + done + IFS="$old_ifs" +} + + +start() { + ( + export EBTABLES_RULE='ebtables -A "$@"' + export EBTABLES_CHAIN='ebtables -N "$1" -P "$2"' + + if [ -z "$1" ]; then + exec_all '' + else + exec_file "$1" + fi + ) +} + +stop() { + ( + export EBTABLES_RULE='ebtables -D "$@"' + export EBTABLES_CHAIN='ebtables -X "$1"' + + if [ -z "$1" ]; then + exec_all '-r' + else + exec_file "$1" + fi + ) +} diff --git a/package/gluon-ebtables/files/lib/gluon/ebtables/.keep b/package/gluon-ebtables/files/lib/gluon/ebtables/.keep new file mode 100644 index 00000000..e69de29b From 7c55b5060eebdb5cfb4a505406eb402e3a1384e7 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 28 Sep 2013 22:15:37 +0200 Subject: [PATCH 013/453] gluon-next-node: add ebtables rules --- package/gluon-next-node/Makefile | 2 +- .../gluon-next-node/generate/lib/gluon/ebtables/250-next-node | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 package/gluon-next-node/generate/lib/gluon/ebtables/250-next-node diff --git a/package/gluon-next-node/Makefile b/package/gluon-next-node/Makefile index aa51c20f..55ff4a1b 100644 --- a/package/gluon-next-node/Makefile +++ b/package/gluon-next-node/Makefile @@ -12,7 +12,7 @@ define Package/gluon-next-node SECTION:=gluon CATEGORY:=Gluon TITLE:=Next-node anycast address - DEPENDS:=+gluon-core +gluon-mesh-batman-adv +iproute2 +kmod-macvlan + DEPENDS:=+gluon-core +gluon-ebtables +gluon-mesh-batman-adv +iproute2 +kmod-macvlan endef define Package/gluon-next-node/description diff --git a/package/gluon-next-node/generate/lib/gluon/ebtables/250-next-node b/package/gluon-next-node/generate/lib/gluon/ebtables/250-next-node new file mode 100644 index 00000000..3c4cb49f --- /dev/null +++ b/package/gluon-next-node/generate/lib/gluon/ebtables/250-next-node @@ -0,0 +1,4 @@ +rule FORWARD --logical-out br-freifunk -o bat0 -d @next_node.mac@ -j DROP +rule OUTPUT --logical-out br-freifunk -o bat0 -d @next_node.mac@ -j DROP +rule FORWARD --logical-out br-freifunk -o bat0 -s @next_node.mac@ -j DROP +rule OUTPUT --logical-out br-freifunk -o bat0 -s @next_node.mac@ -j DROP From 62397f8920b18147fca63ecfb7194fdb7ac5dcd6 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 28 Sep 2013 22:33:53 +0200 Subject: [PATCH 014/453] gluon-next-node: some minor fixes --- package/gluon-next-node/Makefile | 2 +- package/gluon-next-node/generate/etc/init.d/gluon-next-node | 0 2 files changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 package/gluon-next-node/generate/etc/init.d/gluon-next-node diff --git a/package/gluon-next-node/Makefile b/package/gluon-next-node/Makefile index 55ff4a1b..ec145839 100644 --- a/package/gluon-next-node/Makefile +++ b/package/gluon-next-node/Makefile @@ -12,7 +12,7 @@ define Package/gluon-next-node SECTION:=gluon CATEGORY:=Gluon TITLE:=Next-node anycast address - DEPENDS:=+gluon-core +gluon-ebtables +gluon-mesh-batman-adv +iproute2 +kmod-macvlan + DEPENDS:=+gluon-core +gluon-ebtables +gluon-mesh-batman-adv +ip +kmod-macvlan endef define Package/gluon-next-node/description diff --git a/package/gluon-next-node/generate/etc/init.d/gluon-next-node b/package/gluon-next-node/generate/etc/init.d/gluon-next-node old mode 100644 new mode 100755 From 4783a52a713fc3e4a7689600e1acea7ae223b719 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 28 Sep 2013 23:13:57 +0200 Subject: [PATCH 015/453] Add hostname prefix config --- .../lib/gluon/upgrade/core/initial/010-gluon-system | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename package/gluon-core/{files => generate}/lib/gluon/upgrade/core/initial/010-gluon-system (92%) diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/010-gluon-system b/package/gluon-core/generate/lib/gluon/upgrade/core/initial/010-gluon-system similarity index 92% rename from package/gluon-core/files/lib/gluon/upgrade/core/initial/010-gluon-system rename to package/gluon-core/generate/lib/gluon/upgrade/core/initial/010-gluon-system index 635b5a53..d2803ff9 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/010-gluon-system +++ b/package/gluon-core/generate/lib/gluon/upgrade/core/initial/010-gluon-system @@ -34,7 +34,7 @@ EOF esac uci -q batch < Date: Sat, 28 Sep 2013 23:18:36 +0200 Subject: [PATCH 016/453] new basic configmode --- package/gluon-config-mode/Makefile | 2 +- .../files/etc/config/config_mode | 3 - .../files/etc/config/configmode | 4 + .../files/etc/hotplug.d/button/50-config-mode | 29 ------- .../files/etc/hotplug.d/button/50-configmode | 29 +++++++ .../files/etc/init.d/config_mode | 53 ------------- .../files/etc/init.d/configmode | 54 +++++++++++++ .../luci/controller/configmode/configmode.lua | 65 +++++++++++++++ .../lua/luci/controller/freifunk/index.lua | 13 --- .../lua/luci/controller/freifunk/wizard.lua | 30 ------- .../lua/luci/model/cbi/configmode/wizard.lua | 79 +++++++++++++++++++ .../model/cbi/freifunk-wizard/hostname.lua | 38 --------- .../model/cbi/freifunk-wizard/meshvpn.lua | 67 ---------------- .../model/cbi/freifunk-wizard/password.lua | 43 ---------- .../usr/lib/lua/luci/tools/configmode.lua | 29 +++++++ .../lua/luci/tools/freifunk-wizard/nav.lua | 43 ---------- .../lib/lua/luci/view/configmode/reboot.htm | 43 ++++++++++ .../luci/view/freifunk-wizard/completed.htm | 16 ---- .../lua/luci/view/freifunk-wizard/footer.htm | 19 ----- .../lua/luci/view/freifunk-wizard/header.htm | 24 ------ .../luci/view/freifunk-wizard/meshvpn-key.htm | 18 ----- .../lib/lua/luci/view/freifunk-wizard/nav.htm | 15 ---- .../lua/luci/view/freifunk-wizard/welcome.htm | 19 ----- .../luci/view/freifunk-wizard/wizardform.htm | 68 ---------------- 24 files changed, 304 insertions(+), 499 deletions(-) delete mode 100644 package/gluon-config-mode/files/etc/config/config_mode create mode 100644 package/gluon-config-mode/files/etc/config/configmode delete mode 100755 package/gluon-config-mode/files/etc/hotplug.d/button/50-config-mode create mode 100755 package/gluon-config-mode/files/etc/hotplug.d/button/50-configmode delete mode 100755 package/gluon-config-mode/files/etc/init.d/config_mode create mode 100755 package/gluon-config-mode/files/etc/init.d/configmode create mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua delete mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/controller/freifunk/index.lua delete mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/controller/freifunk/wizard.lua create mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/configmode/wizard.lua delete mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/hostname.lua delete mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/meshvpn.lua delete mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/password.lua create mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/tools/configmode.lua delete mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/tools/freifunk-wizard/nav.lua create mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/view/configmode/reboot.htm delete mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/completed.htm delete mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/footer.htm delete mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/header.htm delete mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/meshvpn-key.htm delete mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/nav.htm delete mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/welcome.htm delete mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/wizardform.htm diff --git a/package/gluon-config-mode/Makefile b/package/gluon-config-mode/Makefile index 001d41d5..37035086 100644 --- a/package/gluon-config-mode/Makefile +++ b/package/gluon-config-mode/Makefile @@ -15,7 +15,7 @@ define Package/gluon-config-mode SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci based config mode for user friendly setup of new meshnodes - DEPENDS:=+gluon-core +uhttpd +dnsmasq +luci-mod-admin-core + DEPENDS:=+gluon-core +uhttpd +dnsmasq +luci-mod-admin-core +luci-mod-failsafe +ip +luci-theme-openwrt +haveged endef define Package/gluon-config-mode/description diff --git a/package/gluon-config-mode/files/etc/config/config_mode b/package/gluon-config-mode/files/etc/config/config_mode deleted file mode 100644 index 179b22bf..00000000 --- a/package/gluon-config-mode/files/etc/config/config_mode +++ /dev/null @@ -1,3 +0,0 @@ -config wizard - option enabled '1' - option configured '0' diff --git a/package/gluon-config-mode/files/etc/config/configmode b/package/gluon-config-mode/files/etc/config/configmode new file mode 100644 index 00000000..d5e91003 --- /dev/null +++ b/package/gluon-config-mode/files/etc/config/configmode @@ -0,0 +1,4 @@ +config wizard + option enabled '1' + option configured '0' + option keyaddress 'keys@luebeck.freifunk.net' diff --git a/package/gluon-config-mode/files/etc/hotplug.d/button/50-config-mode b/package/gluon-config-mode/files/etc/hotplug.d/button/50-config-mode deleted file mode 100755 index 0e4e8a89..00000000 --- a/package/gluon-config-mode/files/etc/hotplug.d/button/50-config-mode +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - - -wait=3 - - -wait_config_mode() { - sleep $wait - uci set 'config_mode.@wizard[0].enabled=1' - uci commit config_mode - reboot -} - - -if [ "$BUTTON" = wps -o "$BUTTON" = reset ]; then - case "$ACTION" in - pressed) - wait_config_mode & - PID=$! - echo $PID > /tmp/.wait_config_mode - ;; - released) - if [ -r /tmp/.wait_config_mode ]; then - kill $(cat /tmp/.wait_config_mode) - rm /tmp/.wait_config_mode - fi - ;; - esac -fi diff --git a/package/gluon-config-mode/files/etc/hotplug.d/button/50-configmode b/package/gluon-config-mode/files/etc/hotplug.d/button/50-configmode new file mode 100755 index 00000000..d5032d21 --- /dev/null +++ b/package/gluon-config-mode/files/etc/hotplug.d/button/50-configmode @@ -0,0 +1,29 @@ +#!/bin/sh + + +wait=3 + + +wait_configmode() { + sleep $wait + uci set 'configmode.@wizard[0].enabled=1' + uci commit configmode + reboot +} + + +if [ "$BUTTON" = wps -o "$BUTTON" = reset ]; then + case "$ACTION" in + pressed) + wait_configmode & + PID=$! + echo $PID > /tmp/.wait_configmode + ;; + released) + if [ -r /tmp/.wait_configmode ]; then + kill $(cat /tmp/.wait_configmode) + rm /tmp/.wait_configmode + fi + ;; + esac +fi diff --git a/package/gluon-config-mode/files/etc/init.d/config_mode b/package/gluon-config-mode/files/etc/init.d/config_mode deleted file mode 100755 index e4b5efb2..00000000 --- a/package/gluon-config-mode/files/etc/init.d/config_mode +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh /etc/rc.common - -START=12 - - -config_mode_iface=eth0 -config_mode_addr=192.168.1.1 -config_mode_plen=24 - -config_mode_dnsname=freifunk -config_mode_dhcp_range=192.168.1.2,192.168.1.254 - -check_enable() { - config_get enabled "$1" enabled - config_get configured "$1" configured - - if [ "$enabled" = 1 -o "$configured" != 1 ]; then - export enable=1 - fi -} - -start() { - enable=0 - config_load config_mode - config_foreach check_enable wizard - - if [ "$enable" = '1' ]; then - lua -luci -e 'require "luci.model.uci"; uci_state=luci.model.uci.cursor_state(); uci_state:section("config_mode", "wizard", nil, { running = "1" }); uci_state:save("config_mode")' - uci set 'config_mode.@wizard[0].enabled=0' - uci commit config_mode - - ip addr add $config_mode_addr/$config_mode_plen dev $config_mode_iface - ip link set up dev $config_mode_iface - - /etc/init.d/telnet start - /etc/init.d/dropbear start - /etc/init.d/uhttpd start - /etc/init.d/led start - - # correctly finish firstboot - /etc/init.d/done boot - - echo "$config_mode_addr $config_mode_dnsname" > /tmp/hosts.config_mode - dnsmasq -h -H /tmp/hosts.config_mode -R -F interface:$config_mode_iface,$config_mode_dhcp_range -l /tmp/dhcp.leases -O option:router - - . /etc/diag.sh - get_status_led - status_led_set_timer 1000 300 - - # block further boot - while true; do sleep 1; done - fi -} diff --git a/package/gluon-config-mode/files/etc/init.d/configmode b/package/gluon-config-mode/files/etc/init.d/configmode new file mode 100755 index 00000000..7055d130 --- /dev/null +++ b/package/gluon-config-mode/files/etc/init.d/configmode @@ -0,0 +1,54 @@ +#!/bin/sh /etc/rc.common + +START=12 + + +configmode_iface=eth0 +configmode_addr=192.168.1.1 +configmode_plen=24 + +configmode_dnsname=freifunk +configmode_dhcp_range=192.168.1.2,192.168.1.254 + +check_enable() { + config_get enabled "$1" enabled + config_get configured "$1" configured + + if [ "$enabled" = 1 -o "$configured" != 1 ]; then + export enable=1 + fi +} + +start() { + enable=0 + config_load configmode + config_foreach check_enable wizard + + if [ "$enable" = '1' ]; then + lua -luci -e 'require "luci.model.uci"; uci_state=luci.model.uci.cursor_state(); uci_state:section("configmode", "wizard", nil, { running = "1" }); uci_state:save("configmode")' + uci set 'configmode.@wizard[0].enabled=0' + uci commit configmode + + ip addr add $configmode_addr/$configmode_plen dev $configmode_iface + ip link set up dev $configmode_iface + + /etc/init.d/haveged start + /etc/init.d/telnet start + /etc/init.d/dropbear start + /etc/init.d/uhttpd start + /etc/init.d/led start + + # correctly finish firstboot + /etc/init.d/done boot + + echo "$configmode_addr $configmode_dnsname" > /tmp/hosts.configmode + dnsmasq -h -H /tmp/hosts.configmode -R -F interface:$configmode_iface,$configmode_dhcp_range -l /tmp/dhcp.leases -O option:router + + . /etc/diag.sh + get_status_led + status_led_set_timer 1000 300 + + # block further boot + while true; do sleep 1; done + fi +} diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua new file mode 100644 index 00000000..d9f850fc --- /dev/null +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua @@ -0,0 +1,65 @@ +--[[ +Copyright 2013 Nils Schneider + +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.configmode.configmode", package.seeall) + +local meshvpn_name = "mesh_vpn" + +function index() + local uci_state = luci.model.uci.cursor_state() + + if uci_state:get_first("configmode", "wizard", "running", "0") == "1" then + local root = node() + if not root.target then + root.target = alias("configmode") + root.index = true + end + + page = node() + page.lock = true + page.target = alias("configmode") + page.subindex = true + page.index = false + + page = node("configmode") + page.title = _("Configmode") + page.target = alias("configmode", "wizard") + page.order = 5 + page.setuser = "root" + page.setgroup = "root" + page.index = true + + entry({"configmode", "wizard"}, form("configmode/wizard"), _("Wizard"), 10).index = true + entry({"configmode", "reboot"}, call("action_reboot")) + end +end + +function action_reboot() + local configmode = require "luci.tools.configmode" + local pubkey + local uci = luci.model.uci.cursor() + local address = uci:get_first("configmode", "wizard", "keyaddress") + local meshvpn_enabled = uci:get("fastd", meshvpn_name, "enabled", "0") + if meshvpn_enabled == "1" then + pubkey = configmode.get_fastd_pubkey(meshvpn_name) + end + luci.template.render("configmode/reboot", {pubkey=pubkey, address=address}) + + uci:foreach("configmode", "wizard", function(s) + uci:set("configmode", s[".name"], "configured", "1") + uci:set("configmode", s[".name"], "enabled", "0") + end) + uci:save("configmode") + uci:commit("configmode") + + luci.sys.reboot() +end diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/freifunk/index.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/freifunk/index.lua deleted file mode 100644 index cc2bcadb..00000000 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/freifunk/index.lua +++ /dev/null @@ -1,13 +0,0 @@ -module("luci.controller.freifunk.index", package.seeall) - - -function index() - local uci_state = luci.model.uci.cursor_state() - - if uci_state:get_first("config_mode", "wizard", "running", "0") == "1" then - local root = node() - root.target = alias("wizard", "welcome") - root.index = true - end -end - diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/freifunk/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/freifunk/wizard.lua deleted file mode 100644 index ab64f4f8..00000000 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/freifunk/wizard.lua +++ /dev/null @@ -1,30 +0,0 @@ -module("luci.controller.freifunk.wizard", package.seeall) - -function index() - local uci_state = luci.model.uci.cursor_state() - if uci_state:get_first("config_mode", "wizard", "running", "0") == "1" then - entry({"wizard", "welcome"}, template("freifunk-wizard/welcome"), "Willkommen", 10).dependent=false - entry({"wizard", "password"}, form("freifunk-wizard/password"), "Passwort", 20).dependent=false - entry({"wizard", "hostname"}, form("freifunk-wizard/hostname"), "Hostname", 30).dependent=false - entry({"wizard", "meshvpn"}, form("freifunk-wizard/meshvpn"), "Mesh-VPN", 40).dependent=false - entry({"wizard", "meshvpn", "pubkey"}, template("freifunk-wizard/meshvpn-key"), "Mesh-VPN Key", 1).dependent=false - entry({"wizard", "completed"}, template("freifunk-wizard/completed"), "Fertig", 50).dependent=false - entry({"wizard", "completed", "reboot"}, call("reboot"), "reboot", 1).dependent=false - end -end - -function reboot() - local uci = luci.model.uci.cursor() - - uci:foreach("config_mode", "wizard", - function(s) - uci:set("config_mode", s[".name"], "configured", "1") - end - ) - - uci:save("config_mode") - uci:commit("config_mode") - - luci.sys.reboot() -end - diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/configmode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/configmode/wizard.lua new file mode 100644 index 00000000..59d56aaa --- /dev/null +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/configmode/wizard.lua @@ -0,0 +1,79 @@ +local configmode = require "luci.tools.configmode" +local meshvpn_name = "mesh_vpn" +local uci = luci.model.uci.cursor() +local f, s, o + +-- prepare fastd key as early as possible +configmode.setup_fastd_secret(meshvpn_name) + +f = SimpleForm("wizard", "Wizard", "Lorem ipsum...") + +s = f:section(SimpleSection, "Grundeinstellungen", nil) + +o = s:option(Value, "_hostname", "Knotenname") +o.value = uci:get_first("system", "system", "hostname") +o.rmempty = false +o.datatype = "hostname" + +o = s:option(Flag, "_meshvpn", "Mesh-VPN aktivieren?") +o.default = string.format("%d", uci:get("fastd", meshvpn_name, "enabled", "0")) +o.rmempty = false + +o = s:option(Flag, "_bwlimit", "Bandbreitenbegrenzung aktivieren?") +o.default = string.format("%d", uci:get_first("freifunk", "bandwidth", "enabled", "0")) +o.rmempty = false + +o = s:option(Flag, "_autoupdate", "Automatische Updates aktivieren?") +o.default = string.format("%d", uci:get_first("autoupdater", "autoupdater", "enabled", "0")) +o.rmempty = false + +s = f:section(SimpleSection, "GPS Koordinaten", "Hier kannst du die GPS Koordinaten deines Knotens festlegen damit er in der Karte angezeigt werden kann.") + +o = s:option(Value, "_latitude", "Breitengrad") +o.default = string.format("%f", uci:get_first("system", "location", "latitude", "0")) +o.rmempty = false +o.datatype = "float" + +o = s:option(Value, "_longitude", "Längengrad") +o.default = string.format("%f", uci:get_first("system", "location", "longitude", "0")) +o.rmempty = false +o.datatype = "float" + +function f.handle(self, state, data) + if state == FORM_VALID then + local stat = false + + uci:foreach("autoupdater", "autoupdater", function(s) + uci:set("autoupdater", s[".name"], "enabled", data._autoupdate) + end) + uci:save("autoupdater") + uci:commit("autoupdater") + + uci:foreach("freifunk", "bandwidth", function(s) + uci:set("freifunk", s[".name"], "enabled", data._bwlimit) + end) + uci:save("freifunk") + uci:commit("freifunk") + + uci:set("fastd", meshvpn_name, "enabled", data._meshvpn) + uci:save("fastd") + uci:commit("fastd") + + uci:foreach("system", "system", function(s) + uci:set("system", s[".name"], "hostname", data._hostname) + end) + + uci:foreach("system", "location", function(s) + uci:set("system", s[".name"], "latitude", data._latitude) + uci:set("system", s[".name"], "longitude", data._longitude) + end) + uci:save("system") + uci:commit("system") + + luci.http.redirect(luci.dispatcher.build_url("configmode", "reboot")) + end + + return true +end + +return f diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/hostname.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/hostname.lua deleted file mode 100644 index ed387f9f..00000000 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/hostname.lua +++ /dev/null @@ -1,38 +0,0 @@ -local uci = luci.model.uci.cursor() - -local nav = require "luci.tools.freifunk-wizard.nav" - -local f = SimpleForm("hostname", "Name deines Freifunkknotens", "Als nächstes solltest du einem Freifunkknoten einen individuellen Namen geben. Dieser hilft dir und auch uns den Überblick zu behalten.") -f.template = "freifunk-wizard/wizardform" - -hostname = f:field(Value, "hostname", "Hostname") -hostname.value = uci:get_first("system", "system", "hostname") -hostname.rmempty = false - -function hostname.validate(self, value, section) - return value -end - -function f.handle(self, state, data) - if state == FORM_VALID then - local stat = true - uci:foreach("system", "system", function(s) - stat = stat and uci:set("system", s[".name"], "hostname", data.hostname) - end - ) - - stat = stat and uci:save("system") - stat = stat and uci:commit("system") - - if stat then - nav.maybe_redirect_to_successor() - f.message = "Hostname geändert!" - else - f.errmessage = "Fehler!" - end - end - - return true -end - -return f diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/meshvpn.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/meshvpn.lua deleted file mode 100644 index 6ca35c8a..00000000 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/meshvpn.lua +++ /dev/null @@ -1,67 +0,0 @@ -local meshvpn_name = "mesh_vpn" - -local uci = luci.model.uci.cursor() -local nav = require "luci.tools.freifunk-wizard.nav" - -local f = SimpleForm("meshvpn", "Mesh-VPN", "

Um deinen Freifunkknoten auch über das Internet mit dem Freifunk-Netzwerk zu verbinden, kann das Mesh-VPN aktiviert werden.\ -Dies erlaubt es, den Freifunk-Knoten zu betreiben, auch wenn es keine anderen Knoten in deiner Umgebung gibt, mit denen eine WLAN-Verbindung möglich ist.

\ -

Dabei wird zur Kommunikation ein verschlüsselter Tunnel verwendet, sodass für den Anschluss-Inhaber keinerlei Risiken entstehen.

\ -

Damit das Mesh-VPN deine Internet-Verbindung nicht unverhältnismäßig auslastet, kann die Bandbreite begrenzt werden. Wenn du zum Beispiel eine DSL-16000-Leitung hast\ -und maximal ein Viertel der Leitung zur Verfügung stellen willst, muss als Downstream-Bandbreite 4000 kbit/s eingetragen werden.

\ -

Um das Freifunk-Netz nicht zu sehr auszubremsen, bitten wir darum, mindestens 1000 kbit/s im Downstream und 100 kbit/s im Upstream bereitzustellen.

") -f.template = "freifunk-wizard/wizardform" - -meshvpn = f:field(Flag, "meshvpn", "Mesh-VPN aktivieren?") -meshvpn.default = string.format("%d", uci:get("fastd", meshvpn_name, "enabled", "0")) -meshvpn.rmempty = false - -tc = f:field(Flag, "tc", "Bandbreitenbegrenzung aktivieren?") -tc.default = string.format("%d", uci:get_first("freifunk", "bandwidth", "enabled", "0")) -tc.rmempty = false - -downstream = f:field(Value, "downstream", "Downstream-Bandbreite (kbit/s)") -downstream.value = uci:get_first("freifunk", "bandwidth", "downstream", "0") -upstream = f:field(Value, "upstream", "Upstream-Bandbreite (kbit/s)") -upstream.value = uci:get_first("freifunk", "bandwidth", "upstream", "0") - -function f.handle(self, state, data) - if state == FORM_VALID then - local stat = false - uci:set("fastd", meshvpn_name, "enabled", data.meshvpn) - uci:save("fastd") - uci:commit("fastd") - - uci:foreach("freifunk", "bandwidth", function(s) - uci:set("freifunk", s[".name"], "upstream", data.upstream) - uci:set("freifunk", s[".name"], "downstream", data.downstream) - uci:set("freifunk", s[".name"], "enabled", data.tc) - end - ) - - uci:save("freifunk") - uci:commit("freifunk") - - if data.meshvpn == "1" then - local secret = uci:get("fastd", meshvpn_name, "secret") - if not secret or not secret:match("%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x") then - luci.sys.call("/etc/init.d/haveged start") - local f = io.popen("fastd --generate-key --machine-readable", "r") - local secret = f:read("*a") - f:close() - luci.sys.call("/etc/init.d/haveged stop") - - uci:set("fastd", meshvpn_name, "secret", secret) - uci:save("fastd") - uci:commit("fastd") - - end - luci.http.redirect(luci.dispatcher.build_url("wizard", "meshvpn", "pubkey")) - else - nav.maybe_redirect_to_successor() - end - end - - return true -end - -return f diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/password.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/password.lua deleted file mode 100644 index b752b848..00000000 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/freifunk-wizard/password.lua +++ /dev/null @@ -1,43 +0,0 @@ -local nav = require "luci.tools.freifunk-wizard.nav" - -f = SimpleForm("password", "Administrator-Passwort setzen", "

Damit nur du Zugriff auf deinen Freifunkknoten hast, solltest du jetzt ein Passwort vergeben. \ -Da man mit Hilfe von diesem beliebige Einstellungen geändert werden können, sollte es möglichst sicher sein.

\ -

Bitte beachte dazu folgende Hinweise:

\ -
    \ -
  • Es sollte in keinem Wörterbuch vorkommen.
  • \ -
  • Es sollte mehr als acht Zeichen beinhalten.
  • \ -
  • Es sollte auch Zahlen & Sonderzeichen enthalten.
  • \ -
") -f.template = "freifunk-wizard/wizardform" - -pw1 = f:field(Value, "pw1", "Passwort") -pw1.password = true -pw1.rmempty = false - -pw2 = f:field(Value, "pw2", "Wiederholung") -pw2.password = true -pw2.rmempty = false - -function pw2.validate(self, value, section) - return pw1:formvalue(section) == value and value -end - -function f.handle(self, state, data) - if state == FORM_VALID then - local stat = luci.sys.user.setpasswd("root", data.pw1) == 0 - - if stat then - nav.maybe_redirect_to_successor() - f.message = "Passwort geändert!" - else - f.errmessage = "Fehler!" - end - - data.pw1 = nil - data.pw2 = nil - end - - return true -end - -return f diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/tools/configmode.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/tools/configmode.lua new file mode 100644 index 00000000..3b4c8b6b --- /dev/null +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/tools/configmode.lua @@ -0,0 +1,29 @@ +local luci = require "luci" +local io = require "io" + +module "luci.tools.configmode" + +function setup_fastd_secret(name) + local uci = luci.model.uci.cursor() + local secret = uci:get("fastd", name, "secret") + + if not secret or not secret:match("%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x") then + local f = io.popen("fastd --generate-key --machine-readable", "r") + local secret = f:read("*a") + f:close() + + uci:set("fastd", name, "secret", secret) + uci:save("fastd") + uci:commit("fastd") + end +end + +function get_fastd_pubkey(name) + local f = io.popen("/etc/init.d/fastd show_key " .. name, "r") + local key = f:read("*a") + f:close() + + return key +end + + diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/tools/freifunk-wizard/nav.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/tools/freifunk-wizard/nav.lua deleted file mode 100644 index ec6c0a12..00000000 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/tools/freifunk-wizard/nav.lua +++ /dev/null @@ -1,43 +0,0 @@ -module("luci.tools.freifunk-wizard.nav", package.seeall) - -function maybe_redirect_to_successor() - local pre, suc = get() - - if suc then - luci.http.redirect(luci.dispatcher.build_url("wizard", suc.href)) - end -end - -function get() - - local disp = require "luci.dispatcher" - - local request = disp.context.path - local category = request[1] - local cattree = category and disp.node(category) - - local childs = disp.node_childs(cattree) - - local predecessor = nil - local successor = nil - - if #childs > 0 then - local found_pre = false - for i, r in ipairs(childs) do - local nnode = cattree.nodes[r] - nnode.href = r - - if r == request[2] then - found_pre = true - elseif found_pre and successor == nil then - successor = nnode - end - - if not found_pre then - predecessor = nnode - end - end - end - - return predecessor, successor -end diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/configmode/reboot.htm b/package/gluon-config-mode/files/usr/lib/lua/luci/view/configmode/reboot.htm new file mode 100644 index 00000000..4ef5a1d0 --- /dev/null +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/view/configmode/reboot.htm @@ -0,0 +1,43 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +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$ + +-%> + + + + <%=luci.sys.hostname()%> - <% if title then %><%=title%><% else %><%:Rebooting...%><% end %> + + + +
+
+

Geschafft! Dein Freifunkknoten ist nun fertig eingerichtet.

+ <% if pubkey then %> +
+

+ Dies ist der öffentliche Schlüssel deines Freifunkknotens. Bitte schicke ihn an <%=address%>, um ihn auf den Freifunkservern eintragen zu lassen. Sobald der Schlüssel eingetragen wurde, kann dein Knoten das Mesh-VPN nutzen. +

+
+ <%=pubkey%> +
+
+ <% end %> +
+

+ Dein Knoten startet jetzt neu. Anschließend wird er versuchen sich mit anderen Knoten in der Nähe zu verbinden. Wir wünschen dir viel Spaß dabei Freifunk zu erkunden! +

+
+
+
+ + diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/completed.htm b/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/completed.htm deleted file mode 100644 index 3c096b7d..00000000 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/completed.htm +++ /dev/null @@ -1,16 +0,0 @@ -<% - local disp = require "luci.dispatcher" -%> -<%+header%> -

Konfiguration abgeschlossen

- -

Die Konfiguration deines Freifunkknotens ist nun abgeschlossen. Damit sie aktiv wird, muss der Knoten neugestartet werden.

- -

Um später wieder in den Konfiguration-Modus zurückzukehren, zum Beispiel um die Konfiguration zu verändern oder ein Firmware-Upgrade durchzuführen, - muss der QSS-Button am Gehäuse für einige Sekunden gedrückt gehalten werden, während der Knoten läuft. Der Knoten wird dann neu starten und in - den Konfigurationsmodus zurückkehren.

- -

- ">Jetzt neustarten! -

-<%+footer%> diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/footer.htm b/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/footer.htm deleted file mode 100644 index 57e20f31..00000000 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/footer.htm +++ /dev/null @@ -1,19 +0,0 @@ -<% local xtime -if exectime then - xtime = (string.format("%.2fs", os.clock() - exectime)) -end %> - - - -
- - - - diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/header.htm b/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/header.htm deleted file mode 100644 index 7c28bc43..00000000 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/header.htm +++ /dev/null @@ -1,24 +0,0 @@ -<% - local fs = require "luci.fs" - local sys = require "luci.sys" - local http = require "luci.http" - local disp = require "luci.dispatcher" - - local hostname = sys.hostname() -%> - - - - - - -<%=striptags( hostname )%> - Wizard - - - - -
- - diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/meshvpn-key.htm b/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/meshvpn-key.htm deleted file mode 100644 index 781dd11b..00000000 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/meshvpn-key.htm +++ /dev/null @@ -1,18 +0,0 @@ -<% - local meshvpn_name = "mesh_vpn" - local address = "freifunk.luebeck@asta.uni-luebeck.de" - - local disp = require "luci.dispatcher" - local f = io.popen("/etc/init.d/fastd show_key " .. meshvpn_name, "r") - local key = f:read("*a") - f:close() - -%> -<%+header%> -

Schlüsselaustausch

-

Dies ist der öffentliche Schlüssel deines Freifunkknotens. Bitte schicke ihn an <%=address%>, um ihn auf den Freifunkservern eintragen zu lassen. Sobald der Schlüssel eingetragen wurde, kann dein Knoten das Mesh-VPN nutzen.

-
- <%=key%> -
-<%+freifunk-wizard/nav%> -<%+footer%> diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/nav.htm b/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/nav.htm deleted file mode 100644 index ca46eaee..00000000 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/nav.htm +++ /dev/null @@ -1,15 +0,0 @@ -<% - local nav = require "luci.tools.freifunk-wizard.nav" - local predecessor, successor = nav.get() -%> - -
- -<% if successor then %> - ">Weiter -<% end %> - -<% if predecessor then %> - ">Zurück -<% end %> -
diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/welcome.htm b/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/welcome.htm deleted file mode 100644 index 259f4d85..00000000 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/welcome.htm +++ /dev/null @@ -1,19 +0,0 @@ -<% - local disp = require "luci.dispatcher" - local nav = require "luci.tools.freifunk-wizard.nav" - local predecessor, successor = nav.get() -%> -<%+header%> -

Willkommen auf deinem Freifunkknoten!

-

Danke, dass du Freifunk unterstützt.

-

Dieser Wizard hilft dir nun deinen Knoten einzurichten. Dabei führt er dich schrittweise durch die wichtigsten Punkte.

- -
-<% if successor then %> - ">Knoten neu einrichten -<% end %> - - ">Firmwareupgrade einspielen -
-<%+footer%> - diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/wizardform.htm b/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/wizardform.htm deleted file mode 100644 index 875f448b..00000000 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/view/freifunk-wizard/wizardform.htm +++ /dev/null @@ -1,68 +0,0 @@ -<% if not self.embedded then %> -
-
- - -
-<% end %> -
- <% if self.title and #self.title > 0 then %>

<%=self.title%>

<% end %> - <% if self.description and #self.description > 0 then %>
<%=self.description%>
<% end %> - <% self:render_children() %> -
-
-<%- if self.message then %> -
<%=self.message%>
-<%- end %> -<%- if self.errmessage then %> -
<%=self.errmessage%>
-<%- end %> -<% if not self.embedded then %> -
-<%- - if type(self.hidden) == "table" then - for k, v in pairs(self.hidden) do --%> - -<%- - end - end -%> -
-<% if redirect then %> -
- -
-<% end %> -<%- if self.flow and self.flow.skip then %> - -<% end %> -<%- if self.submit ~= false then %> - -<% end %> -<%- if self.reset ~= false then %> - -<% end %> -<%- if self.cancel ~= false and self.on_cancel then %> - -<% end %> -<% - local nav = require "luci.tools.freifunk-wizard.nav" - local predecessor, successor = nav.get() -%> - <% if predecessor then %> - "> - Zurück - - <% end %> - -
-
-
-<% end %> From f2d9bdaba79c5fb6f888c6fa68e20471b97fc46f Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 28 Sep 2013 23:32:34 +0200 Subject: [PATCH 017/453] Fix MAC address getters for current OpenWRT --- .../files/lib/gluon/upgrade/core/initial/011-gluon-network | 4 ++-- .../generate/lib/gluon/upgrade/core/initial/010-gluon-system | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network index 0614c811..d03a7ffa 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network +++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network @@ -34,10 +34,10 @@ EOF get_main_address() { case "$board" in tl-wdr3600|tl-wdr4300) - uci get wireless.radio1.macaddr + cat /sys/class/ieee80211/phy1/macaddress ;; *) - uci get wireless.radio0.macaddr + cat /sys/class/ieee80211/phy0/macaddress ;; esac } diff --git a/package/gluon-core/generate/lib/gluon/upgrade/core/initial/010-gluon-system b/package/gluon-core/generate/lib/gluon/upgrade/core/initial/010-gluon-system index d2803ff9..8b38d33e 100755 --- a/package/gluon-core/generate/lib/gluon/upgrade/core/initial/010-gluon-system +++ b/package/gluon-core/generate/lib/gluon/upgrade/core/initial/010-gluon-system @@ -7,7 +7,7 @@ board="$(ar71xx_board_name)" case "$board" in tl-wdr3600|\ tl-wdr4300) - macaddr="$(uci get wireless.radio1.macaddr)" + macaddr="$(cat /sys/class/ieee80211/phy1/macaddress)" uci -q batch < Date: Sun, 29 Sep 2013 14:42:00 +0200 Subject: [PATCH 018/453] gluon-next-node: generated config: move prefix information out of next-node scope --- .../gluon-next-node/generate/etc/init.d/gluon-next-node | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/gluon-next-node/generate/etc/init.d/gluon-next-node b/package/gluon-next-node/generate/etc/init.d/gluon-next-node index 963a63c8..bdf26fec 100755 --- a/package/gluon-next-node/generate/etc/init.d/gluon-next-node +++ b/package/gluon-next-node/generate/etc/init.d/gluon-next-node @@ -9,17 +9,17 @@ start() { ip link set local-node address @next_node.mac@ ip address add @next_node.ip4@/32 dev local-node - ip route add @next_node.prefix4@ dev br-freifunk + ip route add @prefix4@ dev br-freifunk ip address add @next_node.ip6@/128 dev local-node - ip route add @next_node.prefix6@ dev br-freifunk + ip route add @prefix6@ dev br-freifunk ip link set local-node up } stop() { - ip route del @next_node.prefix4@ dev br-freifunk - ip route del @next_node.prefix6@ dev br-freifunk + ip route del @prefix4@ dev br-freifunk + ip route del @prefix6@ dev br-freifunk ip link set local-node down ip link del local-node } From b1c14b2b970a6eddbedfe104de82e7137e37f0f3 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 29 Sep 2013 21:55:57 +0200 Subject: [PATCH 019/453] Add gluon-cron package --- package/gluon-cron/Makefile | 40 +++ .../gluon-cron/files/etc/init.d/gluon-cron | 18 + package/gluon-cron/files/lib/gluon/cron/.keep | 0 package/gluon-cron/src/Makefile | 3 + package/gluon-cron/src/gluon-crond.c | 316 ++++++++++++++++++ 5 files changed, 377 insertions(+) create mode 100644 package/gluon-cron/Makefile create mode 100755 package/gluon-cron/files/etc/init.d/gluon-cron create mode 100644 package/gluon-cron/files/lib/gluon/cron/.keep create mode 100644 package/gluon-cron/src/Makefile create mode 100644 package/gluon-cron/src/gluon-crond.c diff --git a/package/gluon-cron/Makefile b/package/gluon-cron/Makefile new file mode 100644 index 00000000..70321181 --- /dev/null +++ b/package/gluon-cron/Makefile @@ -0,0 +1,40 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-cron +PKG_VERSION:=0.3.2.99 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-cron + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Cron support + DEPENDS:=+gluon-core +endef + +define Package/gluon-cron/description + Gluon community wifi mesh firmware framework: cron support +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) + $(CP) ./src/* $(PKG_BUILD_DIR)/ +endef + +define Build/Configure +endef + +define Build/Compile + CFLAGS="$(TARGET_CFLAGS)" CPPFLAGS="$(TARGET_CPPFLAGS)" $(MAKE) -C $(PKG_BUILD_DIR) $(TARGET_CONFIGURE_OPTS) +endef + +define Package/gluon-cron/install + $(CP) ./files/* $(1)/ + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/gluon-crond $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,gluon-cron)) diff --git a/package/gluon-cron/files/etc/init.d/gluon-cron b/package/gluon-cron/files/etc/init.d/gluon-cron new file mode 100755 index 00000000..27a05e1d --- /dev/null +++ b/package/gluon-cron/files/etc/init.d/gluon-cron @@ -0,0 +1,18 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2013 Project Gluon + +START=50 + +SERVICE_USE_PID=1 +SERVICE_WRITE_PID=1 +SERVICE_DAEMONIZE=1 + +CRONDIR=/lib/gluon/cron + +start () { + service_start /usr/sbin/gluon-crond "$CRONDIR" +} + +stop() { + service_stop /usr/sbin/gluon-crond +} diff --git a/package/gluon-cron/files/lib/gluon/cron/.keep b/package/gluon-cron/files/lib/gluon/cron/.keep new file mode 100644 index 00000000..e69de29b diff --git a/package/gluon-cron/src/Makefile b/package/gluon-cron/src/Makefile new file mode 100644 index 00000000..3f4c7a50 --- /dev/null +++ b/package/gluon-cron/src/Makefile @@ -0,0 +1,3 @@ +all: gluon-crond + +gluon-crond: gluon-crond.c diff --git a/package/gluon-cron/src/gluon-crond.c b/package/gluon-cron/src/gluon-crond.c new file mode 100644 index 00000000..52ca2afd --- /dev/null +++ b/package/gluon-cron/src/gluon-crond.c @@ -0,0 +1,316 @@ +/* + Copyright (c) 2013, Matthias Schiffer + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +typedef struct job { + struct job *next; + + uint64_t minutes; + uint32_t hours; + uint32_t doms; + uint16_t months; + uint8_t dows; + + char *command; +} job_t; + + +static const char const *const MONTHS[12] = { + "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec" +}; + +static const char const *const WEEKDAYS[7] = { + "sun", "mon", "tue", "wed", "thu", "fri", "sat" +}; + + +static const char *crondir; + +static job_t *jobs = NULL; + + +static void usage(void) { + fprintf(stderr, "Usage: gluon-crond \n"); +} + + +static inline uint64_t bit(unsigned b) { + return ((uint64_t)1) << b; +} + +static int strict_atoi(const char *s) { + char *end; + int ret = strtol(s, &end, 10); + + if (*end) + return -1; + else + return ret; +} + +static uint64_t parse_strings(const char *input, const char *const *strings, size_t n) { + size_t i; + for (i = 0; i < n; i++) { + if (strcasecmp(input, strings[i]) == 0) + return bit(i); + } + + return 0; +} + +static uint64_t parse_times(char *input, unsigned min, unsigned n) { + uint64_t ret = 0; + int step = 1; + + char *comma = strchr(input, ','); + if (comma) { + *comma = 0; + ret = parse_times(comma+1, min, n); + + if (!ret) + return 0; + } + + char *slash = strchr(input, '/'); + if (slash) { + *slash = 0; + step = strict_atoi(slash+1); + + if (step <= 0) + return 0; + } + + int begin, end; + char *minus = strchr(input, '-'); + if (minus) { + *minus = 0; + begin = strict_atoi(input); + end = strict_atoi(minus+1); + } + else if (strcmp(input, "*") == 0) { + begin = min; + end = min+n-1; + } + else { + begin = end = strict_atoi(input); + } + + if (begin < min || end < min) + return 0; + + int i; + for (i = begin-min; i <= end-min; i += step) + ret |= bit(i % n); + + return ret; +} + +static int handle_line(const char *line) { + job_t job = {}; + int ret = -1; + char *columns[5]; + int i; + int len; + + int matches = sscanf(line, "%ms %ms %ms %ms %ms %n", &columns[0], &columns[1], &columns[2], &columns[3], &columns[4], &len); + if (matches != 5 && matches != 6) { + if (matches <= 0) + ret = 0; + + goto end; + } + + job.minutes = parse_times(columns[0], 0, 60); + if (!job.minutes) + goto end; + + job.hours = parse_times(columns[1], 0, 24); + if (!job.hours) + goto end; + + job.doms = parse_times(columns[2], 1, 31); + if (!job.doms) + goto end; + + + job.months = parse_strings(columns[3], MONTHS, 12); + + if (!job.months) + job.months = parse_times(columns[3], 1, 12); + if (!job.months) + goto end; + + job.dows = parse_strings(columns[4], WEEKDAYS, 7); + if (!job.dows) + job.dows = parse_times(columns[4], 0, 7); + if (!job.dows) + goto end; + + job.command = strdup(line+len); + + job_t *jobp = malloc(sizeof(job_t)); + *jobp = job; + + jobp->next = jobs; + jobs = jobp; + + ret = 0; + + end: + for (i = 0; i < matches; i++) + free(columns[i]); + + return ret; +} + + +static void read_crontab(const char *name) { + FILE *file = fopen(name, "r"); + if (!file) { + syslog(LOG_WARNING, "unable to read crontab `%s'", name); + return; + } + + char line[16384]; + unsigned lineno = 0; + + while (fgets(line, sizeof(line), file)) { + lineno++; + + char *comment = strchr(line, '#'); + if (comment) + *comment = 0; + + if (handle_line(line)) + syslog(LOG_WARNING, "syntax error in `%s', line %u", name, lineno); + } + + fclose(file); +} + + +static void read_crondir(void) { + DIR *dir; + + if (chdir(crondir) || ((dir = opendir(".")) == NULL)) { + fprintf(stderr, "Unable to read crondir `%s'\n", crondir); + usage(); + exit(1); + } + + struct dirent *ent; + while ((ent = readdir(dir)) != NULL) { + if (ent->d_name[0] == '.') + continue; + + read_crontab(ent->d_name); + } + + closedir(dir); +} + + +static void run_job(const job_t *job) { + pid_t pid = fork(); + if (pid == 0) { + execl("/bin/sh", "/bin/sh", "-c", job->command, (char*)NULL); + syslog(LOG_ERR, "unable to run job: exec failed"); + _exit(1); + } + else if (pid < 0) { + syslog(LOG_ERR, "unable to run job: fork failed"); + } +} + + +static void check_job(const job_t *job, const struct tm *tm) { + if (!(job->minutes & bit(tm->tm_min))) + return; + + if (!(job->hours & bit(tm->tm_hour))) + return; + + if (!(job->doms & bit(tm->tm_mday-1))) + return; + + if (!(job->months & bit(tm->tm_mon))) + return; + + if (!(job->dows & bit(tm->tm_wday))) + return; + + run_job(job); +} + + +int main(int argc, char *argv[]) { + if (argc != 2) { + usage(); + + exit(argc < 2 ? 0 : 1); + } + + crondir = argv[1]; + + signal(SIGCHLD, SIG_IGN); + + read_crondir(); + + time_t t = time(NULL); + struct tm *tm = localtime(&t); + int minute = tm->tm_min; + + while (1) { + sleep(60 - t%60); + + t = time(NULL); + tm = localtime(&t); + + minute = (minute+1)%60; + if (tm->tm_min != minute) { + /* clock has moved, don't execute jobs */ + minute = tm->tm_min; + continue; + } + + job_t *job; + for (job = jobs; job; job = job->next) + check_job(job, tm); + } +} From 8476bf5a2b0f4c43df435748f5d9656a2c83edb1 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Sun, 29 Sep 2013 22:06:03 +0200 Subject: [PATCH 020/453] configmode: remove tab "Wizard" in basic mode --- .../files/usr/lib/lua/luci/controller/configmode/configmode.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua index d9f850fc..b99b5590 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua @@ -38,7 +38,7 @@ function index() page.setgroup = "root" page.index = true - entry({"configmode", "wizard"}, form("configmode/wizard"), _("Wizard"), 10).index = true + entry({"configmode", "wizard"}, form("configmode/wizard")).index = true entry({"configmode", "reboot"}, call("action_reboot")) end end From 639e300a93a1f73ffb8f0ae987b4960700875c44 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 29 Sep 2013 22:16:59 +0200 Subject: [PATCH 021/453] gluon-crond: fix matches == 6 case --- package/gluon-cron/src/gluon-crond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-cron/src/gluon-crond.c b/package/gluon-cron/src/gluon-crond.c index 52ca2afd..9ca9d891 100644 --- a/package/gluon-cron/src/gluon-crond.c +++ b/package/gluon-cron/src/gluon-crond.c @@ -193,7 +193,7 @@ static int handle_line(const char *line) { ret = 0; end: - for (i = 0; i < matches; i++) + for (i = 0; i < matches && i < 5; i++) free(columns[i]); return ret; From 9402824e1425548ffae289bd5324296c63548fc2 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Sun, 29 Sep 2013 22:38:12 +0200 Subject: [PATCH 022/453] autoupdater: simple autoupdater updated to use gluon-cron --- package/gluon-autoupdater/Makefile | 32 ++++ package/gluon-autoupdater/README.md | 5 + .../files/etc/config/autoupdater | 19 +++ .../files/lib/gluon/cron/autoupdater | 1 + .../files/usr/sbin/autoupdate | 140 ++++++++++++++++++ package/gluon-autoupdater/manifest.sample | 4 + 6 files changed, 201 insertions(+) create mode 100644 package/gluon-autoupdater/Makefile create mode 100644 package/gluon-autoupdater/README.md create mode 100644 package/gluon-autoupdater/files/etc/config/autoupdater create mode 100644 package/gluon-autoupdater/files/lib/gluon/cron/autoupdater create mode 100755 package/gluon-autoupdater/files/usr/sbin/autoupdate create mode 100644 package/gluon-autoupdater/manifest.sample diff --git a/package/gluon-autoupdater/Makefile b/package/gluon-autoupdater/Makefile new file mode 100644 index 00000000..559a783e --- /dev/null +++ b/package/gluon-autoupdater/Makefile @@ -0,0 +1,32 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=autoupdater +PKG_RELEASE:=0.1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/autoupdater + SECTION:=admin + CATEGORY:=Administration + DEPENDS:=+ecdsautils +gluon-cron + TITLE:=Automatically update firmware +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/autoupdater/install + $(CP) ./files/* $(1)/ + chmod +x $(1)/usr/sbin/autoupdate +endef + +$(eval $(call BuildPackage,autoupdater)) diff --git a/package/gluon-autoupdater/README.md b/package/gluon-autoupdater/README.md new file mode 100644 index 00000000..1caf1813 --- /dev/null +++ b/package/gluon-autoupdater/README.md @@ -0,0 +1,5 @@ +Models +====== + +tp-link-tl-wr741n/nd-v4 +tp-link-tl-wr1043n/nd-v1 diff --git a/package/gluon-autoupdater/files/etc/config/autoupdater b/package/gluon-autoupdater/files/etc/config/autoupdater new file mode 100644 index 00000000..d86d1c27 --- /dev/null +++ b/package/gluon-autoupdater/files/etc/config/autoupdater @@ -0,0 +1,19 @@ +config autoupdater + option enabled 0 + option branch "stable" + option url 'http://[fdef:ffc0:3dd7::8]/~freifunk/firmware/autoupdate' + + # The updater will run once per hour and perform an update with a certain + # probability. + # 1.0 - perform an update every hour + # 0.5 - on average, perform an update every two hours + # 0.0 - inhibit any automatic updates + option probability 0.5 + + # Minimum valid signatures required to perform the update + option good_signatures 2 + + # List of public keys + list pubkey 'beea7da92ed0c19563b6c259162b4cb471aa2fdf9d3939d05fea2cf498ea7642' + list pubkey 'c75c9390cf5d7cc49a388d35f831ca379060cf7bca8c6e3d2d1ea31604597c42' + list pubkey '03e9514f137f0467c0f0ac108892c0da2b71f1039b30f863331cbd5701abd042' diff --git a/package/gluon-autoupdater/files/lib/gluon/cron/autoupdater b/package/gluon-autoupdater/files/lib/gluon/cron/autoupdater new file mode 100644 index 00000000..740503b1 --- /dev/null +++ b/package/gluon-autoupdater/files/lib/gluon/cron/autoupdater @@ -0,0 +1 @@ +0 * * * * /usr/sbin/autoupdate diff --git a/package/gluon-autoupdater/files/usr/sbin/autoupdate b/package/gluon-autoupdater/files/usr/sbin/autoupdate new file mode 100755 index 00000000..079cae2b --- /dev/null +++ b/package/gluon-autoupdater/files/usr/sbin/autoupdate @@ -0,0 +1,140 @@ +#!/bin/sh + +if test $(uci get autoupdater.@autoupdater[0].enabled) != 1; then + echo "autoupdater is disabled" + exit 0 +fi + +PROBABILITY=$(uci get autoupdater.@autoupdater[0].probability) + +if test "a$1" != "a-f"; then + echo | awk "END{srand();exit rand() > $PROBABILITY}" + if test $? -ne 0; then + echo "No autoupdate this time. Use -f to override" + exit 0 + fi +fi + +BASE=$(uci get autoupdater.@autoupdater[0].url) +PUBKEYS=$(uci get autoupdater.@autoupdater[0].pubkey) +GOOD_SIGNATURES=$(uci get autoupdater.@autoupdater[0].good_signatures) +BRANCH=$(uci get autoupdater.@autoupdater[0].branch) + +VERSION_FILE=/etc/firmware_version + +newer_than() { + local old="$(printf '%s\n%s\n' "$1" "$2" | sort -n | head -n 1)" + test "$1" != "$old" +} + +cleanup() { + rm -f $manifest + rm -f $fw_image + rm -f $manifest_upper + rm -f $manifest_lower +} + +trap cleanup INT TERM EXIT PIPE + +my_model="$(cat /tmp/sysinfo/model | sed 's/ /-/g' | tr '[A-Z]' '[a-z]')" + +case "$my_model" in + "tl-wdr4300") + case "$(tplink_get_hwid)" in + "360000"*) + my_model="tl-wdr3600" + ;; + esac + ;; +esac + +if [ ! -f "$VERSION_FILE" ]; then + echo "Couldn't determine firmware version!" >&2 + exit 1 +fi + +my_version="$(cat "$VERSION_FILE")" + +fw_image=$(mktemp) +manifest=$(mktemp) +manifest_upper=$(mktemp) +manifest_lower=$(mktemp) + +wget -O$manifest "$BASE"/manifest + +if test $? -ne 0; then + echo "Couldn't fetch manifest" >&2 + exit 1 +fi + +seperator_line=$(cat $manifest|grep -n "^---$"|cut -d: -f1|head -n1) + +if test -z "$seperator_line"; then + echo "Couldn't find --- marker!" >&2 + exit 1 +fi + +head -n$(($seperator_line-1)) $manifest > $manifest_upper +tail -n+$(($seperator_line+1)) $manifest > $manifest_lower + +signatures="" +while read sig; do + echo "$sig" | grep -q "^[0-9a-f]\{128\}$" + if test $? -ne 0; then + continue + fi + signatures="$signatures -s $sig" +done < $manifest_lower + +pubkeys="" +for key in $PUBKEYS; do + pubkeys="$pubkeys -p $key" +done + +ecdsaverify -n $GOOD_SIGNATURES $pubkeys $signatures $manifest_upper + +if test $? -ne 0; then + echo "Not enough valid signatures!" >&2 + exit 1 +fi + +grep -q "^BRANCH=${BRANCH}$" $manifest_upper + +if test $? -ne 0; then + echo "Wrong branch. We'are on ${BRANCH}" >&2 + exit 1 +fi + +my_firmware=$(grep "^${my_model} " $manifest_upper) + +if test $? -ne 0; then + echo "No matching firmware found (model ${my_model})" >&2 + exit 1 +fi + +fw_version=$(echo "${my_firmware}"|cut -d' ' -f2) +fw_md5=$(echo "${my_firmware}"|cut -d' ' -f3) +fw_file=$(echo "${my_firmware}"|cut -d' ' -f4) + +if newer_than "$fw_version" "$my_version"; then + echo "New version available" + wget -O$fw_image "${BASE}/${fw_file}" + if test $? -ne 0; then + echo "Error downloading image" >&2 + exit 1 + fi + + image_md5=$(md5sum "$fw_image"|cut -b-32) + if test "$image_md5" != "$fw_md5"; then + echo "Invalid image checksum" >&2 + exit 1 + fi + + echo "Upgrading firmware." + + sysupgrade "${fw_image}" +else + echo "No new firmware available" +fi + +exit 0 diff --git a/package/gluon-autoupdater/manifest.sample b/package/gluon-autoupdater/manifest.sample new file mode 100644 index 00000000..0d302ab2 --- /dev/null +++ b/package/gluon-autoupdater/manifest.sample @@ -0,0 +1,4 @@ +BRANCH=stable + +# board ver md5sum filename +tl-wdr4300 0.4 73e0788596850798d8e02a9ac577d201 sysupgrade-wdr4300.bin From 1666df3cbfe16c4fe65270771ed3a9a77530642a Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Mon, 30 Sep 2013 00:12:21 +0200 Subject: [PATCH 023/453] configmode: initscript takes care of enabled-flag --- .../files/usr/lib/lua/luci/controller/configmode/configmode.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua index b99b5590..5c12c493 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua @@ -56,7 +56,6 @@ function action_reboot() uci:foreach("configmode", "wizard", function(s) uci:set("configmode", s[".name"], "configured", "1") - uci:set("configmode", s[".name"], "enabled", "0") end) uci:save("configmode") uci:commit("configmode") From 91d70b98c797fa518d29d3e9706b3a3de016426c Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Mon, 30 Sep 2013 00:12:45 +0200 Subject: [PATCH 024/453] autoupdater: fix Makefile --- package/gluon-autoupdater/Makefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/package/gluon-autoupdater/Makefile b/package/gluon-autoupdater/Makefile index 559a783e..a79501ff 100644 --- a/package/gluon-autoupdater/Makefile +++ b/package/gluon-autoupdater/Makefile @@ -1,15 +1,16 @@ include $(TOPDIR)/rules.mk -PKG_NAME:=autoupdater +PKG_NAME:=gluon-autoupdater +PKG_VERSION:=0.3.2.99 PKG_RELEASE:=0.1 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) include $(INCLUDE_DIR)/package.mk -define Package/autoupdater - SECTION:=admin - CATEGORY:=Administration +define Package/gluon-autoupdater + SECTION:=gluon + CATEGORY:=Gluon DEPENDS:=+ecdsautils +gluon-cron TITLE:=Automatically update firmware endef @@ -24,9 +25,9 @@ endef define Build/Compile endef -define Package/autoupdater/install +define Package/gluon-autoupdater/install $(CP) ./files/* $(1)/ chmod +x $(1)/usr/sbin/autoupdate endef -$(eval $(call BuildPackage,autoupdater)) +$(eval $(call BuildPackage,gluon-autoupdater)) From 663b419cd51cfbbb7da62bc00d07393d28872c57 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Mon, 30 Sep 2013 00:55:38 +0200 Subject: [PATCH 025/453] configmode: read pubkey message from site configuration --- package/gluon-config-mode/Makefile | 1 + .../files/etc/config/configmode | 1 - .../luci/controller/configmode/configmode.lua | 3 +- .../lib/lua/luci/view/configmode/reboot.htm | 43 ------------------- .../lib/lua/luci/view/configmode/reboot.htm | 43 +++++++++++++++++++ 5 files changed, 45 insertions(+), 46 deletions(-) delete mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/view/configmode/reboot.htm create mode 100644 package/gluon-config-mode/generate/usr/lib/lua/luci/view/configmode/reboot.htm diff --git a/package/gluon-config-mode/Makefile b/package/gluon-config-mode/Makefile index 37035086..8a081aad 100644 --- a/package/gluon-config-mode/Makefile +++ b/package/gluon-config-mode/Makefile @@ -34,6 +34,7 @@ endef define Package/gluon-config-mode/install $(CP) ./files/* $(1)/ + $(GLUON_GENERATE) ./generate/* $(1)/ endef $(eval $(call BuildPackage,gluon-config-mode)) diff --git a/package/gluon-config-mode/files/etc/config/configmode b/package/gluon-config-mode/files/etc/config/configmode index d5e91003..ff348bb8 100644 --- a/package/gluon-config-mode/files/etc/config/configmode +++ b/package/gluon-config-mode/files/etc/config/configmode @@ -1,4 +1,3 @@ config wizard option enabled '1' option configured '0' - option keyaddress 'keys@luebeck.freifunk.net' diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua index 5c12c493..71a1a60f 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua @@ -47,12 +47,11 @@ function action_reboot() local configmode = require "luci.tools.configmode" local pubkey local uci = luci.model.uci.cursor() - local address = uci:get_first("configmode", "wizard", "keyaddress") local meshvpn_enabled = uci:get("fastd", meshvpn_name, "enabled", "0") if meshvpn_enabled == "1" then pubkey = configmode.get_fastd_pubkey(meshvpn_name) end - luci.template.render("configmode/reboot", {pubkey=pubkey, address=address}) + luci.template.render("configmode/reboot", {pubkey=pubkey}) uci:foreach("configmode", "wizard", function(s) uci:set("configmode", s[".name"], "configured", "1") diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/configmode/reboot.htm b/package/gluon-config-mode/files/usr/lib/lua/luci/view/configmode/reboot.htm deleted file mode 100644 index 4ef5a1d0..00000000 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/view/configmode/reboot.htm +++ /dev/null @@ -1,43 +0,0 @@ -<%# -LuCI - Lua Configuration Interface -Copyright 2008 Steven Barth -Copyright 2008 Jo-Philipp Wich - -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$ - --%> - - - - <%=luci.sys.hostname()%> - <% if title then %><%=title%><% else %><%:Rebooting...%><% end %> - - - -
-
-

Geschafft! Dein Freifunkknoten ist nun fertig eingerichtet.

- <% if pubkey then %> -
-

- Dies ist der öffentliche Schlüssel deines Freifunkknotens. Bitte schicke ihn an <%=address%>, um ihn auf den Freifunkservern eintragen zu lassen. Sobald der Schlüssel eingetragen wurde, kann dein Knoten das Mesh-VPN nutzen. -

-
- <%=pubkey%> -
-
- <% end %> -
-

- Dein Knoten startet jetzt neu. Anschließend wird er versuchen sich mit anderen Knoten in der Nähe zu verbinden. Wir wünschen dir viel Spaß dabei Freifunk zu erkunden! -

-
-
-
- - diff --git a/package/gluon-config-mode/generate/usr/lib/lua/luci/view/configmode/reboot.htm b/package/gluon-config-mode/generate/usr/lib/lua/luci/view/configmode/reboot.htm new file mode 100644 index 00000000..c60dc9cf --- /dev/null +++ b/package/gluon-config-mode/generate/usr/lib/lua/luci/view/configmode/reboot.htm @@ -0,0 +1,43 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +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$ + +-%> + + + + <%=luci.sys.hostname()%> - <% if title then %><%=title%><% else %><%:Rebooting...%><% end %> + + + +
+
+

Geschafft! Dein Freifunkknoten ist nun fertig eingerichtet.

+ <% if pubkey then %> +
+

+ @configmode.msg_pubkey@ +

+
+ <%=pubkey%> +
+
+ <% end %> +
+

+ Dein Knoten startet jetzt neu. Anschließend wird er versuchen sich mit anderen Knoten in der Nähe zu verbinden. Wir wünschen dir viel Spaß dabei Freifunk zu erkunden! +

+
+
+
+ + From 1044a446b84740963180576b34b0c63169be46ca Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Mon, 30 Sep 2013 01:07:31 +0200 Subject: [PATCH 026/453] autoupdater: enable by default --- package/gluon-autoupdater/files/etc/config/autoupdater | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-autoupdater/files/etc/config/autoupdater b/package/gluon-autoupdater/files/etc/config/autoupdater index d86d1c27..9702ef21 100644 --- a/package/gluon-autoupdater/files/etc/config/autoupdater +++ b/package/gluon-autoupdater/files/etc/config/autoupdater @@ -1,5 +1,5 @@ config autoupdater - option enabled 0 + option enabled 1 option branch "stable" option url 'http://[fdef:ffc0:3dd7::8]/~freifunk/firmware/autoupdate' From b6045bb1aa6f551ec0779792e929c6215ea8e9d6 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 30 Sep 2013 14:36:53 +0200 Subject: [PATCH 027/453] gluon-next-node: fix interface names --- .../generate/etc/init.d/gluon-next-node | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package/gluon-next-node/generate/etc/init.d/gluon-next-node b/package/gluon-next-node/generate/etc/init.d/gluon-next-node index bdf26fec..897e2d8d 100755 --- a/package/gluon-next-node/generate/etc/init.d/gluon-next-node +++ b/package/gluon-next-node/generate/etc/init.d/gluon-next-node @@ -5,21 +5,21 @@ START=95 start() { - ip link add link br-mesh name local-node type macvlan + ip link add link br-client name local-node type macvlan ip link set local-node address @next_node.mac@ ip address add @next_node.ip4@/32 dev local-node - ip route add @prefix4@ dev br-freifunk + ip route add @prefix4@ dev br-client ip address add @next_node.ip6@/128 dev local-node - ip route add @prefix6@ dev br-freifunk + ip route add @prefix6@ dev br-client ip link set local-node up } stop() { - ip route del @prefix4@ dev br-freifunk - ip route del @prefix6@ dev br-freifunk + ip route del @prefix4@ dev br-client + ip route del @prefix6@ dev br-client ip link set local-node down ip link del local-node } From b0b95ae135e05f366fbec443281ab7fb718d2ba5 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Mon, 30 Sep 2013 14:42:01 +0200 Subject: [PATCH 028/453] configmode: migrate uci config of pre 0.4 firmwares --- .../lib/gluon/upgrade/configmode/0.4/001-migrate-uci-config | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 package/gluon-config-mode/files/lib/gluon/upgrade/configmode/0.4/001-migrate-uci-config diff --git a/package/gluon-config-mode/files/lib/gluon/upgrade/configmode/0.4/001-migrate-uci-config b/package/gluon-config-mode/files/lib/gluon/upgrade/configmode/0.4/001-migrate-uci-config new file mode 100755 index 00000000..e3ff8f2c --- /dev/null +++ b/package/gluon-config-mode/files/lib/gluon/upgrade/configmode/0.4/001-migrate-uci-config @@ -0,0 +1,6 @@ +#!/bin/sh + +OLD_CFG=/etc/config/config_mode +NEW_CFG=/etc/config/configmode + +[ -f $OLD_CFG ] && mv $OLD_CFG $NEW_CFG From a2539ead029cdaa3fd39e5c2fbab18eb2f944516 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Mon, 30 Sep 2013 15:14:01 +0200 Subject: [PATCH 029/453] configmode: show current bandwidth limit in wizard --- .../files/usr/lib/lua/luci/model/cbi/configmode/wizard.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/configmode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/configmode/wizard.lua index 59d56aaa..44fcce2d 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/configmode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/configmode/wizard.lua @@ -19,9 +19,14 @@ o = s:option(Flag, "_meshvpn", "Mesh-VPN aktivieren?") o.default = string.format("%d", uci:get("fastd", meshvpn_name, "enabled", "0")) o.rmempty = false +local upstream, downstream +upstream = string.format("%d KBit/s", uci:get_first("freifunk", "bandwidth", "upstream")) +downstream = string.format("%d KBit/s", uci:get_first("freifunk", "bandwidth", "downstream")) + o = s:option(Flag, "_bwlimit", "Bandbreitenbegrenzung aktivieren?") o.default = string.format("%d", uci:get_first("freifunk", "bandwidth", "enabled", "0")) o.rmempty = false +o.description = downstream .. " Downstream / " .. upstream .. " Upstream" o = s:option(Flag, "_autoupdate", "Automatische Updates aktivieren?") o.default = string.format("%d", uci:get_first("autoupdater", "autoupdater", "enabled", "0")) From 8ada602570a23161568b7b15d41720a6af4d03d3 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Mon, 30 Sep 2013 16:24:37 +0200 Subject: [PATCH 030/453] configmode: move upgrade script from 0.4 to invariant --- .../upgrade/configmode/{0.4 => invariant}/001-migrate-uci-config | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename package/gluon-config-mode/files/lib/gluon/upgrade/configmode/{0.4 => invariant}/001-migrate-uci-config (100%) diff --git a/package/gluon-config-mode/files/lib/gluon/upgrade/configmode/0.4/001-migrate-uci-config b/package/gluon-config-mode/files/lib/gluon/upgrade/configmode/invariant/001-migrate-uci-config similarity index 100% rename from package/gluon-config-mode/files/lib/gluon/upgrade/configmode/0.4/001-migrate-uci-config rename to package/gluon-config-mode/files/lib/gluon/upgrade/configmode/invariant/001-migrate-uci-config From 346c96b4a270ac2ccba457d2c66c6d35694e4cc9 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 30 Sep 2013 16:24:18 +0200 Subject: [PATCH 031/453] gluon-ebtables: add missing mod-ipt-core dependency --- package/gluon-ebtables/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-ebtables/Makefile b/package/gluon-ebtables/Makefile index 64a18e7b..051b374b 100644 --- a/package/gluon-ebtables/Makefile +++ b/package/gluon-ebtables/Makefile @@ -12,7 +12,7 @@ define Package/gluon-ebtables SECTION:=gluon CATEGORY:=Gluon TITLE:=Ebtables support - DEPENDS:=+gluon-core +ebtables +kmod-ebtables-ipv4 +kmod-ebtables-ipv6 + DEPENDS:=+gluon-core +ebtables +kmod-ebtables-ipv4 +kmod-ebtables-ipv6 +kmod-ipt-core endef define Package/gluon-ebtables/description From b72a7d0b590961b8a63ecffac193fa04888edf26 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Mon, 30 Sep 2013 16:59:22 +0200 Subject: [PATCH 032/453] gluon-release: creates /lib/gluon/release --- package/gluon-release/Makefile | 36 +++++++++++++++++++ .../gluon-release/generate/lib/gluon/release | 1 + 2 files changed, 37 insertions(+) create mode 100644 package/gluon-release/Makefile create mode 100644 package/gluon-release/generate/lib/gluon/release diff --git a/package/gluon-release/Makefile b/package/gluon-release/Makefile new file mode 100644 index 00000000..1d72f737 --- /dev/null +++ b/package/gluon-release/Makefile @@ -0,0 +1,36 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-release +PKG_VERSION:=1 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-release + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=A file containing the current release + DEPENDS:=+gluon-core +endef + +define Package/gluon-release/description + This packages creates /lib/gluon/release. +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-release/install + $(GLUON_GENERATE) ./generate/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-release)) diff --git a/package/gluon-release/generate/lib/gluon/release b/package/gluon-release/generate/lib/gluon/release new file mode 100644 index 00000000..b42b71b1 --- /dev/null +++ b/package/gluon-release/generate/lib/gluon/release @@ -0,0 +1 @@ +@release@ From 18f0fc63664ba6537c04a67945fb2c49eff6ad10 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Mon, 30 Sep 2013 16:59:49 +0200 Subject: [PATCH 033/453] gluon-autoupdater: read version from /lib/gluon/release --- package/gluon-autoupdater/Makefile | 2 +- package/gluon-autoupdater/files/usr/sbin/autoupdate | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/gluon-autoupdater/Makefile b/package/gluon-autoupdater/Makefile index a79501ff..09c398de 100644 --- a/package/gluon-autoupdater/Makefile +++ b/package/gluon-autoupdater/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/package.mk define Package/gluon-autoupdater SECTION:=gluon CATEGORY:=Gluon - DEPENDS:=+ecdsautils +gluon-cron + DEPENDS:=+ecdsautils +gluon-cron +gluon-release TITLE:=Automatically update firmware endef diff --git a/package/gluon-autoupdater/files/usr/sbin/autoupdate b/package/gluon-autoupdater/files/usr/sbin/autoupdate index 079cae2b..f7a2208b 100755 --- a/package/gluon-autoupdater/files/usr/sbin/autoupdate +++ b/package/gluon-autoupdater/files/usr/sbin/autoupdate @@ -20,7 +20,7 @@ PUBKEYS=$(uci get autoupdater.@autoupdater[0].pubkey) GOOD_SIGNATURES=$(uci get autoupdater.@autoupdater[0].good_signatures) BRANCH=$(uci get autoupdater.@autoupdater[0].branch) -VERSION_FILE=/etc/firmware_version +VERSION_FILE=/lib/gluon/release newer_than() { local old="$(printf '%s\n%s\n' "$1" "$2" | sort -n | head -n 1)" From 225f15f9e17a7628dbb9b68182d2d0fdbfed507e Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 30 Sep 2013 17:38:04 +0200 Subject: [PATCH 034/453] gluon-next-node: add ebtables to filter IP packets with the next-node address --- .../generate/lib/gluon/ebtables/250-next-node | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/package/gluon-next-node/generate/lib/gluon/ebtables/250-next-node b/package/gluon-next-node/generate/lib/gluon/ebtables/250-next-node index 3c4cb49f..f6fa7d1a 100644 --- a/package/gluon-next-node/generate/lib/gluon/ebtables/250-next-node +++ b/package/gluon-next-node/generate/lib/gluon/ebtables/250-next-node @@ -2,3 +2,13 @@ rule FORWARD --logical-out br-freifunk -o bat0 -d @next_node.mac@ -j DROP rule OUTPUT --logical-out br-freifunk -o bat0 -d @next_node.mac@ -j DROP rule FORWARD --logical-out br-freifunk -o bat0 -s @next_node.mac@ -j DROP rule OUTPUT --logical-out br-freifunk -o bat0 -s @next_node.mac@ -j DROP + +rule FORWARD --logical-out br-freifunk -o bat0 -p IPv4 --ip-destination @next_node.ip4@ -j DROP +rule OUTPUT --logical-out br-freifunk -o bat0 -p IPv4 --ip-destination @next_node.ip4@ -j DROP +rule FORWARD --logical-out br-freifunk -o bat0 -p IPv4 --ip-source @next_node.ip4@ -j DROP +rule OUTPUT --logical-out br-freifunk -o bat0 -p IPv4 --ip-source @next_node.ip4@ -j DROP + +rule FORWARD --logical-out br-freifunk -o bat0 -p IPv6 --ip6-destination @next_node.ip6@ -j DROP +rule OUTPUT --logical-out br-freifunk -o bat0 -p IPv6 --ip6-destination @next_node.ip6@ -j DROP +rule FORWARD --logical-out br-freifunk -o bat0 -p IPv6 --ip6-source @next_node.ip6@ -j DROP +rule OUTPUT --logical-out br-freifunk -o bat0 -p IPv6 --ip6-source @next_node.ip6@ -j DROP From e352326a9bbee0a832ce8fe0f33f26d7c3b42c5f Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Mon, 30 Sep 2013 18:39:26 +0200 Subject: [PATCH 035/453] gluon-config-mode: do not depend on luci-mod-failsafe (gluon-luci-admin will provide it's functionality) --- package/gluon-config-mode/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-config-mode/Makefile b/package/gluon-config-mode/Makefile index 8a081aad..4c95217b 100644 --- a/package/gluon-config-mode/Makefile +++ b/package/gluon-config-mode/Makefile @@ -15,7 +15,7 @@ define Package/gluon-config-mode SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci based config mode for user friendly setup of new meshnodes - DEPENDS:=+gluon-core +uhttpd +dnsmasq +luci-mod-admin-core +luci-mod-failsafe +ip +luci-theme-openwrt +haveged + DEPENDS:=+gluon-core +uhttpd +dnsmasq +luci-mod-admin-core +ip +luci-theme-openwrt +haveged endef define Package/gluon-config-mode/description From 20caa3662aaa45b531dab44b70afd926c553108c Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 30 Sep 2013 17:52:08 +0200 Subject: [PATCH 036/453] gluon-next-node: set accept_ra to 0 --- package/gluon-next-node/generate/etc/init.d/gluon-next-node | 1 + 1 file changed, 1 insertion(+) diff --git a/package/gluon-next-node/generate/etc/init.d/gluon-next-node b/package/gluon-next-node/generate/etc/init.d/gluon-next-node index 897e2d8d..cee7d7b0 100755 --- a/package/gluon-next-node/generate/etc/init.d/gluon-next-node +++ b/package/gluon-next-node/generate/etc/init.d/gluon-next-node @@ -6,6 +6,7 @@ START=95 start() { ip link add link br-client name local-node type macvlan + echo 0 > /proc/sys/net/ipv6/conf/local-node/accept_ra ip link set local-node address @next_node.mac@ ip address add @next_node.ip4@/32 dev local-node From 946438f21544c9fcfdedc395a89e583c500c83a2 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 30 Sep 2013 18:29:52 +0200 Subject: [PATCH 037/453] gluon-core: remove deprecated accept_ra settings --- .../files/lib/gluon/upgrade/core/initial/011-gluon-network | 2 -- 1 file changed, 2 deletions(-) diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network index d03a7ffa..31c605fc 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network +++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network @@ -10,7 +10,6 @@ delete network.lan set network.wan.type='bridge' set network.wan.proto='dhcp' -set network.wan.accept_ra='0' set network.wan.auto='1' set network.client='interface' @@ -18,7 +17,6 @@ set network.client.ifname='$lan_ifname bat0' set network.client.type='bridge' set network.client.proto='none' set network.client.auto='1' -set network.client.accept_ra='1' set network.mesh='interface' set network.mesh.proto='batadv' From e684418cb31bcc5290e0e45273e1b7d7538faa97 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 30 Sep 2013 18:46:24 +0200 Subject: [PATCH 038/453] Use odhcp6c for interface configuration --- package/gluon-core/Makefile | 1 + .../files/lib/gluon/upgrade/core/initial/011-gluon-network | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package/gluon-core/Makefile b/package/gluon-core/Makefile index ca892ecb..2e0ce851 100644 --- a/package/gluon-core/Makefile +++ b/package/gluon-core/Makefile @@ -12,6 +12,7 @@ define Package/gluon-core SECTION:=gluon CATEGORY:=Gluon TITLE:=Base files of Gluon + DEPENDS:=+odhcp6c endef define Package/gluon-core/description diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network index 31c605fc..c2086228 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network +++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network @@ -15,8 +15,9 @@ set network.wan.auto='1' set network.client='interface' set network.client.ifname='$lan_ifname bat0' set network.client.type='bridge' -set network.client.proto='none' -set network.client.auto='1' +set network.client.proto='dhcpv6' +set network.client.reqprefix='no' +set network.client.peerdns='0' set network.mesh='interface' set network.mesh.proto='batadv' From fdf19830d7d39a5b66e6b8c1657f5cc6c3fc6760 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 30 Sep 2013 21:29:52 +0200 Subject: [PATCH 039/453] gluon-mesh-vpn-fastd: generate fastd config from site configuration --- package/gluon-mesh-vpn-fastd/Makefile | 4 +- package/gluon-mesh-vpn-fastd/fastd.pl | 59 +++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 package/gluon-mesh-vpn-fastd/fastd.pl diff --git a/package/gluon-mesh-vpn-fastd/Makefile b/package/gluon-mesh-vpn-fastd/Makefile index 777cb024..d2322682 100644 --- a/package/gluon-mesh-vpn-fastd/Makefile +++ b/package/gluon-mesh-vpn-fastd/Makefile @@ -27,10 +27,12 @@ define Build/Configure endef define Build/Compile + $(GLUON_CONFIGURE) fastd.pl > $(PKG_BUILD_DIR)/fastd.sh endef define Package/gluon-mesh-vpn-fastd/install - $(CP) ./files/* $(1)/ + $(INSTALL_DIR) $(1)/lib/gluon/upgrade/mesh-vpn-fastd/invariant + $(INSTALL_BIN) $(PKG_BUILD_DIR)/fastd.sh $(1)/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd endef $(eval $(call BuildPackage,gluon-mesh-vpn-fastd)) diff --git a/package/gluon-mesh-vpn-fastd/fastd.pl b/package/gluon-mesh-vpn-fastd/fastd.pl new file mode 100644 index 00000000..85bc7e28 --- /dev/null +++ b/package/gluon-mesh-vpn-fastd/fastd.pl @@ -0,0 +1,59 @@ +my $cfg = $CONFIG->{fastd_mesh_vpn}; +my $backbone = $cfg->{backbone}; + +my $add_methods = ''; +for (@{$cfg->{methods}}) { + $add_methods .= "add_list fastd.mesh_vpn.method='$_'\n"; +} + +my $set_peer_limit; +if ($backbone->{limit}) { + $set_peer_limit = "set fastd.mesh_vpn_backbone.peer_limit='$backbone->{limit}'\n"; +} +else { + $set_peer_limit = "delete fastd.mesh_vpn_backbone.peer_limit\n"; +} + +print <{peers}}) { + my $peer = $backbone->{peers}->{$name}; + print <{remotes}}) { + print "add_list fastd.mesh_vpn_backbone_peer_$name.remote='$_'\n"; + } +} + +print < Date: Mon, 30 Sep 2013 21:39:11 +0200 Subject: [PATCH 040/453] gluon-next-node: fix ebtables interface name --- .../generate/lib/gluon/ebtables/250-next-node | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/package/gluon-next-node/generate/lib/gluon/ebtables/250-next-node b/package/gluon-next-node/generate/lib/gluon/ebtables/250-next-node index f6fa7d1a..08b70dad 100644 --- a/package/gluon-next-node/generate/lib/gluon/ebtables/250-next-node +++ b/package/gluon-next-node/generate/lib/gluon/ebtables/250-next-node @@ -1,14 +1,14 @@ -rule FORWARD --logical-out br-freifunk -o bat0 -d @next_node.mac@ -j DROP -rule OUTPUT --logical-out br-freifunk -o bat0 -d @next_node.mac@ -j DROP -rule FORWARD --logical-out br-freifunk -o bat0 -s @next_node.mac@ -j DROP -rule OUTPUT --logical-out br-freifunk -o bat0 -s @next_node.mac@ -j DROP +rule FORWARD --logical-out br-client -o bat0 -d @next_node.mac@ -j DROP +rule OUTPUT --logical-out br-client -o bat0 -d @next_node.mac@ -j DROP +rule FORWARD --logical-out br-client -o bat0 -s @next_node.mac@ -j DROP +rule OUTPUT --logical-out br-client -o bat0 -s @next_node.mac@ -j DROP -rule FORWARD --logical-out br-freifunk -o bat0 -p IPv4 --ip-destination @next_node.ip4@ -j DROP -rule OUTPUT --logical-out br-freifunk -o bat0 -p IPv4 --ip-destination @next_node.ip4@ -j DROP -rule FORWARD --logical-out br-freifunk -o bat0 -p IPv4 --ip-source @next_node.ip4@ -j DROP -rule OUTPUT --logical-out br-freifunk -o bat0 -p IPv4 --ip-source @next_node.ip4@ -j DROP +rule FORWARD --logical-out br-client -o bat0 -p IPv4 --ip-destination @next_node.ip4@ -j DROP +rule OUTPUT --logical-out br-client -o bat0 -p IPv4 --ip-destination @next_node.ip4@ -j DROP +rule FORWARD --logical-out br-client -o bat0 -p IPv4 --ip-source @next_node.ip4@ -j DROP +rule OUTPUT --logical-out br-client -o bat0 -p IPv4 --ip-source @next_node.ip4@ -j DROP -rule FORWARD --logical-out br-freifunk -o bat0 -p IPv6 --ip6-destination @next_node.ip6@ -j DROP -rule OUTPUT --logical-out br-freifunk -o bat0 -p IPv6 --ip6-destination @next_node.ip6@ -j DROP -rule FORWARD --logical-out br-freifunk -o bat0 -p IPv6 --ip6-source @next_node.ip6@ -j DROP -rule OUTPUT --logical-out br-freifunk -o bat0 -p IPv6 --ip6-source @next_node.ip6@ -j DROP +rule FORWARD --logical-out br-client -o bat0 -p IPv6 --ip6-destination @next_node.ip6@ -j DROP +rule OUTPUT --logical-out br-client -o bat0 -p IPv6 --ip6-destination @next_node.ip6@ -j DROP +rule FORWARD --logical-out br-client -o bat0 -p IPv6 --ip6-source @next_node.ip6@ -j DROP +rule OUTPUT --logical-out br-client -o bat0 -p IPv6 --ip6-source @next_node.ip6@ -j DROP From fd4222f65d7a656cb4393e3b87000ed7ac33019b Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Mon, 30 Sep 2013 23:31:35 +0200 Subject: [PATCH 041/453] gluon-autoupdater: read config from site.conf --- package/gluon-autoupdater/Makefile | 4 +++- package/gluon-autoupdater/autoupdater.pl | 23 +++++++++++++++++++ .../files/etc/config/autoupdater | 2 +- .../files/usr/sbin/autoupdate | 12 +++++----- 4 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 package/gluon-autoupdater/autoupdater.pl diff --git a/package/gluon-autoupdater/Makefile b/package/gluon-autoupdater/Makefile index 09c398de..43d9beb9 100644 --- a/package/gluon-autoupdater/Makefile +++ b/package/gluon-autoupdater/Makefile @@ -23,11 +23,13 @@ define Build/Configure endef define Build/Compile + $(GLUON_CONFIGURE) autoupdater.pl > $(PKG_BUILD_DIR)/autoupdater.sh endef define Package/gluon-autoupdater/install $(CP) ./files/* $(1)/ - chmod +x $(1)/usr/sbin/autoupdate + $(INSTALL_DIR) $(1)/lib/gluon/upgrade/autoupdater/initial + $(INSTALL_BIN) $(PKG_BUILD_DIR)/autoupdater.sh $(1)/lib/gluon/upgrade/autoupdater/initial/010-autoupdater endef $(eval $(call BuildPackage,gluon-autoupdater)) diff --git a/package/gluon-autoupdater/autoupdater.pl b/package/gluon-autoupdater/autoupdater.pl new file mode 100644 index 00000000..88bac9f6 --- /dev/null +++ b/package/gluon-autoupdater/autoupdater.pl @@ -0,0 +1,23 @@ +my $cfg = $CONFIG->{autoupdater}; + +print <<'END'; +#/bin/sh + +uci -q batch < $PROBABILITY}" @@ -15,10 +15,10 @@ if test "a$1" != "a-f"; then fi fi -BASE=$(uci get autoupdater.@autoupdater[0].url) -PUBKEYS=$(uci get autoupdater.@autoupdater[0].pubkey) -GOOD_SIGNATURES=$(uci get autoupdater.@autoupdater[0].good_signatures) -BRANCH=$(uci get autoupdater.@autoupdater[0].branch) +BASE=$(uci get autoupdater.default.url) +PUBKEYS=$(uci get autoupdater.default.pubkey) +GOOD_SIGNATURES=$(uci get autoupdater.default.good_signatures) +BRANCH=$(uci get autoupdater.default.branch) VERSION_FILE=/lib/gluon/release From fa1774a4e69b0237212d9d6f10df236d73842249 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 1 Oct 2013 20:16:24 +0200 Subject: [PATCH 042/453] Remove batman-adv specific parts of gluon-core --- .../files/lib/gluon/core/sysconfig/.keep | 0 .../files/lib/gluon/functions/sysconfig.sh | 10 +++++ .../gluon/upgrade/core/initial/001-sysconfig | 20 ++++++++++ .../upgrade/core/initial/011-gluon-network | 38 +------------------ .../gluon-core/files/lib/upgrade/keep.d/gluon | 2 + 5 files changed, 34 insertions(+), 36 deletions(-) create mode 100644 package/gluon-core/files/lib/gluon/core/sysconfig/.keep create mode 100644 package/gluon-core/files/lib/gluon/functions/sysconfig.sh create mode 100644 package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig diff --git a/package/gluon-core/files/lib/gluon/core/sysconfig/.keep b/package/gluon-core/files/lib/gluon/core/sysconfig/.keep new file mode 100644 index 00000000..e69de29b diff --git a/package/gluon-core/files/lib/gluon/functions/sysconfig.sh b/package/gluon-core/files/lib/gluon/functions/sysconfig.sh new file mode 100644 index 00000000..40acf689 --- /dev/null +++ b/package/gluon-core/files/lib/gluon/functions/sysconfig.sh @@ -0,0 +1,10 @@ +SYSCONFIGDIR=/lib/gluon/core/sysconfig + + +sysconfig() { + cat "$SYSCONFIGDIR/$1" +} + +sysconfig_set() { + echo -n "$2" > "$SYSCONFIGDIR/$1" +} diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig b/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig new file mode 100644 index 00000000..1affcb46 --- /dev/null +++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig @@ -0,0 +1,20 @@ +#!/bin/sh + +. /lib/gluon/functions/sysconfig.sh +. /lib/ar71xx.sh + + +get_primary_mac() { + case "$(ar71xx_board_name)" in + tl-wdr3600|tl-wdr4300) + cat /sys/class/ieee80211/phy1/macaddress + ;; + *) + cat /sys/class/ieee80211/phy0/macaddress + ;; + esac +} + + +sysconfig_set lan_ifname "$(uci get network.lan.ifname)" +sysconfig_set primary_mac "$(get_primary_mac)" diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network index c2086228..28211d71 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network +++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network @@ -1,9 +1,7 @@ #!/bin/sh -. /lib/ar71xx.sh -local lan_ifname="$(uci get network.lan.ifname)" -local board="$(ar71xx_board_name)" +. /lib/gluon/functions/sysconfig.sh uci -q batch < Date: Tue, 1 Oct 2013 20:22:54 +0200 Subject: [PATCH 043/453] gluon-core: always handle core scripts first --- .../files/etc/uci-defaults/zzz-gluon-upgrade | 57 +++++++++++-------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade b/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade index 3b9fc07d..6be362ed 100755 --- a/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade +++ b/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade @@ -27,8 +27,36 @@ do_dir() { fi } +do_component() { + local component="$1" + local version="$(version_of "$component")" + if [ -z "$version" ]; then continue; fi -version="$(version_of gluon-core)" + cd "$component" + + local oldversion="$(oldversion_of "$component")" + if [ -z "$oldversion" ]; then + do_dir initial + else + local v + + for v in *; do + if [ "$v" = initial -o "$v" = invariant -o "$v" = version ]; then continue; fi + + # The return value of opkg compare-versions is negated + if ! opkg compare-versions "$v" '>>' "$oldversion"; then + do_dir "$v" + fi + done + fi + + do_dir invariant + + echo "$version" > "$VERSION_DIR"/"$component" +} + + +version="$(version_of core)" oldversion="$(cat "$VERSION_FILE" 2>/dev/null)" if [ -z "$oldversion" ]; then oldversion="$(cat "$VERSION_FILE_FREIFUNK" 2>/dev/null)"; fi @@ -38,31 +66,12 @@ if [ -z "$oldversion" ]; then oldversion="$(cat "$VERSION_FILE_KFF" 2>/dev/null) ( cd "$UPGRADE_DIR" + do_compoment core + for component in *; do ( - local version="$(version_of "$component")" - if [ -z "$version" ]; then continue; fi - - cd "$component" - - local oldversion="$(oldversion_of "$component")" - if [ -z "$oldversion" ]; then - do_dir initial - else - local v - - for v in *; do - if [ "$v" = initial -o "$v" = invariant -o "$v" = version ]; then continue; fi - - # The return value of opkg compare-versions is negated - if ! opkg compare-versions "$v" '>>' "$oldversion"; then - do_dir "$v" - fi - done + if [ "$component" != 'core' ]; then + do_component "$component" fi - - do_dir invariant - - echo "$version" > "$VERSION_DIR"/"$component" ) done ) From 7771cd9f2e4038f4417ae73edae0e0c96ed495b1 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 1 Oct 2013 20:47:18 +0200 Subject: [PATCH 044/453] gluon-core: make 001-sysconfig executable --- .../gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig b/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig old mode 100644 new mode 100755 From d508728da645bdb8b3c359d1d50b8d387b2e38ed Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 1 Oct 2013 20:50:07 +0200 Subject: [PATCH 045/453] gluon-core: fix typo --- package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade b/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade index 6be362ed..da82ab8b 100755 --- a/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade +++ b/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade @@ -66,7 +66,7 @@ if [ -z "$oldversion" ]; then oldversion="$(cat "$VERSION_FILE_KFF" 2>/dev/null) ( cd "$UPGRADE_DIR" - do_compoment core + do_component core for component in *; do ( if [ "$component" != 'core' ]; then From 568cfbf398d1966c787d6748298c2f8f71dcfe76 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 1 Oct 2013 20:52:06 +0200 Subject: [PATCH 046/453] gluon-core: ensure version stamp dir existence --- package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade b/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade index da82ab8b..fe1897d8 100755 --- a/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade +++ b/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade @@ -5,6 +5,9 @@ UPGRADE_DIR=/lib/gluon/upgrade VERSION_DIR=/lib/gluon/version +mkdir -p "$VERSION_DIR" + + version_of() { opkg status "gluon-$1" | grep '^Version: ' | cut -d' ' -f 2 } From 00a97602a4aa78803ad8567d2510d26bf1f6ee83 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 1 Oct 2013 21:12:36 +0200 Subject: [PATCH 047/453] gluon-core: upgrade: fix directory movement --- .../files/etc/uci-defaults/zzz-gluon-upgrade | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade b/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade index fe1897d8..751f4d71 100755 --- a/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade +++ b/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade @@ -35,27 +35,29 @@ do_component() { local version="$(version_of "$component")" if [ -z "$version" ]; then continue; fi - cd "$component" + ( + cd "$component" - local oldversion="$(oldversion_of "$component")" - if [ -z "$oldversion" ]; then - do_dir initial - else - local v + local oldversion="$(oldversion_of "$component")" + if [ -z "$oldversion" ]; then + do_dir initial + else + local v - for v in *; do - if [ "$v" = initial -o "$v" = invariant -o "$v" = version ]; then continue; fi + for v in *; do + if [ "$v" = initial -o "$v" = invariant -o "$v" = version ]; then continue; fi - # The return value of opkg compare-versions is negated - if ! opkg compare-versions "$v" '>>' "$oldversion"; then - do_dir "$v" - fi - done - fi + # The return value of opkg compare-versions is negated + if ! opkg compare-versions "$v" '>>' "$oldversion"; then + do_dir "$v" + fi + done + fi - do_dir invariant + do_dir invariant - echo "$version" > "$VERSION_DIR"/"$component" + echo "$version" > "$VERSION_DIR"/"$component" + ) } @@ -66,16 +68,14 @@ if [ -z "$oldversion" ]; then oldversion="$(cat "$VERSION_FILE_FREIFUNK" 2>/dev/ if [ -z "$oldversion" ]; then oldversion="$(cat "$VERSION_FILE_LFF" 2>/dev/null)"; fi if [ -z "$oldversion" ]; then oldversion="$(cat "$VERSION_FILE_KFF" 2>/dev/null)"; fi -( - cd "$UPGRADE_DIR" +cd "$UPGRADE_DIR" - do_component core +do_component core - for component in *; do ( - if [ "$component" != 'core' ]; then - do_component "$component" - fi - ) done -) +for component in *; do + if [ "$component" != 'core' ]; then + do_component "$component" + fi +done rm -f "$VERSION_FILE_FREIFUNK" "$VERSION_FILE_LFF" "$VERSION_FILE_KFF" From 54ba93f4bf185887f217a432ead552e9d7349b44 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 1 Oct 2013 21:37:45 +0200 Subject: [PATCH 048/453] gluon-mesh-batman-adv: configure batman-adv --- .../0.3.1/010-migrate-batman-adv | 17 ------- .../0.3.2/010-migrate-batman-adv | 5 --- .../0.3.3/010-migrate-batman-adv | 38 ---------------- .../upgrade/mesh-batman-adv/initial/011-mesh | 45 +++++++++++++++++++ 4 files changed, 45 insertions(+), 60 deletions(-) delete mode 100755 package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/0.3.1/010-migrate-batman-adv delete mode 100755 package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/0.3.2/010-migrate-batman-adv delete mode 100755 package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/0.3.3/010-migrate-batman-adv create mode 100755 package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/011-mesh diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/0.3.1/010-migrate-batman-adv b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/0.3.1/010-migrate-batman-adv deleted file mode 100755 index 46f297f7..00000000 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/0.3.1/010-migrate-batman-adv +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -local interfaces='' -local interfaces_old="$(uci get batman-adv.bat0.interfaces)" - -for interface in $interfaces_old; do - if [ $interface != br-wan ]; then interfaces="${interfaces:+${interfaces} }$interface"; fi -done - -uci set batman-adv.bat0.interfaces="$interfaces" - -old_interval="$(uci -q get batman-adv.bat0.orig_interval)" -if [ -z "$old_interval" -o "$old_interval" = 1000 ]; then - uci set batman-adv.bat0.orig_interval=5000 -fi - -uci commit batman-adv diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/0.3.2/010-migrate-batman-adv b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/0.3.2/010-migrate-batman-adv deleted file mode 100755 index 6275f32a..00000000 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/0.3.2/010-migrate-batman-adv +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - - -uci set batman-adv.bat0.interfaces="mesh-vpn $(uci -q get batman-adv.bat0.interfaces)" -uci commit batman-adv diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/0.3.3/010-migrate-batman-adv b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/0.3.3/010-migrate-batman-adv deleted file mode 100755 index ba32c95b..00000000 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/0.3.3/010-migrate-batman-adv +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -. /lib/ar71xx.sh - -local board="$(ar71xx_board_name)" - -uci -q batch < Date: Tue, 1 Oct 2013 10:08:08 +0200 Subject: [PATCH 049/453] gluon-autoupdater: rename script to autoupdater (was autoupdate) --- package/gluon-autoupdater/files/lib/gluon/cron/autoupdater | 2 +- .../files/usr/sbin/{autoupdate => autoupdater} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename package/gluon-autoupdater/files/usr/sbin/{autoupdate => autoupdater} (100%) diff --git a/package/gluon-autoupdater/files/lib/gluon/cron/autoupdater b/package/gluon-autoupdater/files/lib/gluon/cron/autoupdater index 740503b1..1beebca1 100644 --- a/package/gluon-autoupdater/files/lib/gluon/cron/autoupdater +++ b/package/gluon-autoupdater/files/lib/gluon/cron/autoupdater @@ -1 +1 @@ -0 * * * * /usr/sbin/autoupdate +0 * * * * /usr/sbin/autoupdater diff --git a/package/gluon-autoupdater/files/usr/sbin/autoupdate b/package/gluon-autoupdater/files/usr/sbin/autoupdater similarity index 100% rename from package/gluon-autoupdater/files/usr/sbin/autoupdate rename to package/gluon-autoupdater/files/usr/sbin/autoupdater From 09855e0c80b118d532782f99dfcb410520e6c6ae Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 2 Oct 2013 13:19:39 +0200 Subject: [PATCH 050/453] gluon-mesh-vpn-fastd: set mesh_vpn.enabled flag --- package/gluon-mesh-vpn-fastd/fastd.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/package/gluon-mesh-vpn-fastd/fastd.pl b/package/gluon-mesh-vpn-fastd/fastd.pl index 85bc7e28..45c810cd 100644 --- a/package/gluon-mesh-vpn-fastd/fastd.pl +++ b/package/gluon-mesh-vpn-fastd/fastd.pl @@ -19,6 +19,7 @@ print <{enabled} set fastd.mesh_vpn.syslog_level='verbose' delete fastd.mesh_vpn.config delete fastd.mesh_vpn.config_peer_dir From f637e923f5d1320a9c8bc48274bf8ab2a5034299 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 2 Oct 2013 13:33:47 +0200 Subject: [PATCH 051/453] gluon-autoupdater: new branch specification It is now possible to specific multiple branches like this: config branch stable option url ... list pubkey ... ... config branch testing ... and select one in autoupdater.settings: config autoupdater settings option branch "stable" --- package/gluon-autoupdater/Makefile | 12 ++--- package/gluon-autoupdater/autoupdater.pl | 23 ---------- .../files/etc/config/autoupdater | 34 +++++++------- .../lib/gluon/upgrade/autoupdater/010-initial | 3 ++ .../upgrade/autoupdater/initial/010-initial | 3 ++ .../files/usr/sbin/autoupdater | 13 +++--- package/gluon-autoupdater/invariant.pl | 44 +++++++++++++++++++ .../invariant/001-migrate-uci-config | 6 +++ 8 files changed, 87 insertions(+), 51 deletions(-) delete mode 100644 package/gluon-autoupdater/autoupdater.pl create mode 100755 package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/010-initial create mode 100755 package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/initial/010-initial create mode 100644 package/gluon-autoupdater/invariant.pl create mode 100755 package/gluon-config-mode/files/lib/gluon/upgrade/config-mode/invariant/001-migrate-uci-config diff --git a/package/gluon-autoupdater/Makefile b/package/gluon-autoupdater/Makefile index 43d9beb9..8d6ae755 100644 --- a/package/gluon-autoupdater/Makefile +++ b/package/gluon-autoupdater/Makefile @@ -1,8 +1,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-autoupdater -PKG_VERSION:=0.3.2.99 -PKG_RELEASE:=0.1 +PKG_VERSION:=0.1 +PKG_RELEASE:=1 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/package.mk define Package/gluon-autoupdater SECTION:=gluon CATEGORY:=Gluon - DEPENDS:=+ecdsautils +gluon-cron +gluon-release + DEPENDS:=+ecdsautils +gluon-cron +gluon-release +gluon-location TITLE:=Automatically update firmware endef @@ -23,13 +23,13 @@ define Build/Configure endef define Build/Compile - $(GLUON_CONFIGURE) autoupdater.pl > $(PKG_BUILD_DIR)/autoupdater.sh + $(GLUON_CONFIGURE) invariant.pl > $(PKG_BUILD_DIR)/invariant.sh endef define Package/gluon-autoupdater/install $(CP) ./files/* $(1)/ - $(INSTALL_DIR) $(1)/lib/gluon/upgrade/autoupdater/initial - $(INSTALL_BIN) $(PKG_BUILD_DIR)/autoupdater.sh $(1)/lib/gluon/upgrade/autoupdater/initial/010-autoupdater + $(INSTALL_DIR) $(1)/lib/gluon/upgrade/autoupdater/invariant + $(INSTALL_BIN) $(PKG_BUILD_DIR)/invariant.sh $(1)/lib/gluon/upgrade/autoupdater/invariant/010-autoupdater endef $(eval $(call BuildPackage,gluon-autoupdater)) diff --git a/package/gluon-autoupdater/autoupdater.pl b/package/gluon-autoupdater/autoupdater.pl deleted file mode 100644 index 88bac9f6..00000000 --- a/package/gluon-autoupdater/autoupdater.pl +++ /dev/null @@ -1,23 +0,0 @@ -my $cfg = $CONFIG->{autoupdater}; - -print <<'END'; -#/bin/sh - -uci -q batch < $PROBABILITY}" @@ -15,10 +17,9 @@ if test "a$1" != "a-f"; then fi fi -BASE=$(uci get autoupdater.default.url) -PUBKEYS=$(uci get autoupdater.default.pubkey) -GOOD_SIGNATURES=$(uci get autoupdater.default.good_signatures) -BRANCH=$(uci get autoupdater.default.branch) +BASE=$(uci get autoupdater.${BRANCH}.url) +PUBKEYS=$(uci get autoupdater.${BRANCH}.pubkey) +GOOD_SIGNATURES=$(uci get autoupdater.${BRANCH}.good_signatures) VERSION_FILE=/lib/gluon/release diff --git a/package/gluon-autoupdater/invariant.pl b/package/gluon-autoupdater/invariant.pl new file mode 100644 index 00000000..31848133 --- /dev/null +++ b/package/gluon-autoupdater/invariant.pl @@ -0,0 +1,44 @@ +my $cfg = $CONFIG->{autoupdater}; + +print <<'END'; +#/bin/sh + +uci -q get autoupdater.settings || { +uci -q batch <{$_}\n"; +} + +print <<'END'; +EOF +} + +uci -q batch <{branches}) { + my $branch = $cfg->{branches}->{$name}; + + print <{$_}\n"; + } + + for (@{$branch->{pubkeys}}) { + print "add_list autoupdater.$name.pubkey=$_\n"; + } +} + +print < Date: Wed, 2 Oct 2013 14:02:24 +0200 Subject: [PATCH 052/453] Revert "gluon-mesh-vpn-fastd: set mesh_vpn.enabled flag" This reverts commit baf6d14160ab15069f68161d0d1556c369cf0cbd. --- package/gluon-mesh-vpn-fastd/fastd.pl | 1 - 1 file changed, 1 deletion(-) diff --git a/package/gluon-mesh-vpn-fastd/fastd.pl b/package/gluon-mesh-vpn-fastd/fastd.pl index 45c810cd..85bc7e28 100644 --- a/package/gluon-mesh-vpn-fastd/fastd.pl +++ b/package/gluon-mesh-vpn-fastd/fastd.pl @@ -19,7 +19,6 @@ print <{enabled} set fastd.mesh_vpn.syslog_level='verbose' delete fastd.mesh_vpn.config delete fastd.mesh_vpn.config_peer_dir From b6484440e1eeb15d4cdb81893599048a5d31fd31 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 2 Oct 2013 14:18:42 +0200 Subject: [PATCH 053/453] gluon-location: store lat/lon in system config --- package/gluon-location/Makefile | 36 +++++++++++++++++++ .../upgrade/location/initial/010-location | 12 +++++++ 2 files changed, 48 insertions(+) create mode 100644 package/gluon-location/Makefile create mode 100755 package/gluon-location/files/lib/gluon/upgrade/location/initial/010-location diff --git a/package/gluon-location/Makefile b/package/gluon-location/Makefile new file mode 100644 index 00000000..d9cdf3eb --- /dev/null +++ b/package/gluon-location/Makefile @@ -0,0 +1,36 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-location +PKG_VERSION:=1 +PKG_location:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-location + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Add system.location to uci + DEPENDS:=+gluon-core +endef + +define Package/gluon-location/description + This packages creates /lib/gluon/location. +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-location/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-location)) diff --git a/package/gluon-location/files/lib/gluon/upgrade/location/initial/010-location b/package/gluon-location/files/lib/gluon/upgrade/location/initial/010-location new file mode 100755 index 00000000..9a2696d2 --- /dev/null +++ b/package/gluon-location/files/lib/gluon/upgrade/location/initial/010-location @@ -0,0 +1,12 @@ +#!/bin/sh + +CFG="@system[0]" + +uci -q batch < Date: Wed, 2 Oct 2013 14:46:39 +0200 Subject: [PATCH 054/453] gluon-config-mode: various fixes (default values, autoupdater changes) --- .../lua/luci/model/cbi/configmode/wizard.lua | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/configmode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/configmode/wizard.lua index 44fcce2d..d651a7c7 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/configmode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/configmode/wizard.lua @@ -16,7 +16,7 @@ o.rmempty = false o.datatype = "hostname" o = s:option(Flag, "_meshvpn", "Mesh-VPN aktivieren?") -o.default = string.format("%d", uci:get("fastd", meshvpn_name, "enabled", "0")) +o.default = uci:get_bool("fastd", meshvpn_name, "enabled") and o.enabled or o.disabled o.rmempty = false local upstream, downstream @@ -24,23 +24,27 @@ upstream = string.format("%d KBit/s", uci:get_first("freifunk", "bandwidth", "up downstream = string.format("%d KBit/s", uci:get_first("freifunk", "bandwidth", "downstream")) o = s:option(Flag, "_bwlimit", "Bandbreitenbegrenzung aktivieren?") -o.default = string.format("%d", uci:get_first("freifunk", "bandwidth", "enabled", "0")) +o.default = uci:get_first("freifunk", "bandwidth", "enabled", "0") o.rmempty = false o.description = downstream .. " Downstream / " .. upstream .. " Upstream" o = s:option(Flag, "_autoupdate", "Automatische Updates aktivieren?") -o.default = string.format("%d", uci:get_first("autoupdater", "autoupdater", "enabled", "0")) +o.default = uci:get_bool("autoupdater", "settings", "enabled") and o.enabled or o.disabled o.rmempty = false s = f:section(SimpleSection, "GPS Koordinaten", "Hier kannst du die GPS Koordinaten deines Knotens festlegen damit er in der Karte angezeigt werden kann.") +o = s:option(Flag, "_location", "Koordinaten veröffentlichen?") +o.default = uci:get_first("system", "system", "share_location", o.disabled) +o.rmempty = false + o = s:option(Value, "_latitude", "Breitengrad") -o.default = string.format("%f", uci:get_first("system", "location", "latitude", "0")) +o.default = string.format("%f", uci:get_first("system", "system", "latitude", "0")) o.rmempty = false o.datatype = "float" o = s:option(Value, "_longitude", "Längengrad") -o.default = string.format("%f", uci:get_first("system", "location", "longitude", "0")) +o.default = string.format("%f", uci:get_first("system", "system", "longitude", "0")) o.rmempty = false o.datatype = "float" @@ -48,9 +52,7 @@ function f.handle(self, state, data) if state == FORM_VALID then local stat = false - uci:foreach("autoupdater", "autoupdater", function(s) - uci:set("autoupdater", s[".name"], "enabled", data._autoupdate) - end) + uci:set("autoupdater", "settings", "enabled", data._autoupdate) uci:save("autoupdater") uci:commit("autoupdater") @@ -66,9 +68,7 @@ function f.handle(self, state, data) uci:foreach("system", "system", function(s) uci:set("system", s[".name"], "hostname", data._hostname) - end) - - uci:foreach("system", "location", function(s) + uci:set("system", s[".name"], "share_location", data._location) uci:set("system", s[".name"], "latitude", data._latitude) uci:set("system", s[".name"], "longitude", data._longitude) end) From ae5277ff9ffe904b02bab7dcf3bb4a23cc7535fd Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 2 Oct 2013 15:00:07 +0200 Subject: [PATCH 055/453] gluon-location is a dependency of config-mode, not autoupdater --- package/gluon-autoupdater/Makefile | 2 +- package/gluon-config-mode/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/gluon-autoupdater/Makefile b/package/gluon-autoupdater/Makefile index 8d6ae755..fd971492 100644 --- a/package/gluon-autoupdater/Makefile +++ b/package/gluon-autoupdater/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/package.mk define Package/gluon-autoupdater SECTION:=gluon CATEGORY:=Gluon - DEPENDS:=+ecdsautils +gluon-cron +gluon-release +gluon-location + DEPENDS:=+ecdsautils +gluon-cron +gluon-release TITLE:=Automatically update firmware endef diff --git a/package/gluon-config-mode/Makefile b/package/gluon-config-mode/Makefile index 4c95217b..85961871 100644 --- a/package/gluon-config-mode/Makefile +++ b/package/gluon-config-mode/Makefile @@ -15,7 +15,7 @@ define Package/gluon-config-mode SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci based config mode for user friendly setup of new meshnodes - DEPENDS:=+gluon-core +uhttpd +dnsmasq +luci-mod-admin-core +ip +luci-theme-openwrt +haveged + DEPENDS:=+gluon-core +gluon-location +uhttpd +dnsmasq +luci-mod-admin-core +ip +luci-theme-openwrt +haveged endef define Package/gluon-config-mode/description From cf6c51ee5ef5592aa4d40f97ef8cedc395ee4f23 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 2 Oct 2013 15:24:14 +0200 Subject: [PATCH 056/453] gluon-config-mode: rename configmode to config-mode (except in lua variables where it is still called configmode) --- .../etc/config/{configmode => config-mode} | 0 .../files/etc/hotplug.d/button/50-config-mode | 29 ++++++++++ .../files/etc/hotplug.d/button/50-configmode | 29 ---------- .../files/etc/init.d/config-mode | 54 +++++++++++++++++++ .../files/etc/init.d/configmode | 54 ------------------- .../invariant/001-migrate-uci-config | 2 +- .../invariant/001-migrate-uci-config | 6 --- .../config-mode.lua} | 30 +++++------ .../{configmode => config-mode}/wizard.lua | 4 +- .../tools/{configmode.lua => config-mode.lua} | 2 +- .../{configmode => config-mode}/reboot.htm | 0 11 files changed, 102 insertions(+), 108 deletions(-) rename package/gluon-config-mode/files/etc/config/{configmode => config-mode} (100%) create mode 100755 package/gluon-config-mode/files/etc/hotplug.d/button/50-config-mode delete mode 100755 package/gluon-config-mode/files/etc/hotplug.d/button/50-configmode create mode 100755 package/gluon-config-mode/files/etc/init.d/config-mode delete mode 100755 package/gluon-config-mode/files/etc/init.d/configmode delete mode 100755 package/gluon-config-mode/files/lib/gluon/upgrade/configmode/invariant/001-migrate-uci-config rename package/gluon-config-mode/files/usr/lib/lua/luci/controller/{configmode/configmode.lua => config-mode/config-mode.lua} (55%) rename package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/{configmode => config-mode}/wizard.lua (95%) rename package/gluon-config-mode/files/usr/lib/lua/luci/tools/{configmode.lua => config-mode.lua} (95%) rename package/gluon-config-mode/generate/usr/lib/lua/luci/view/{configmode => config-mode}/reboot.htm (100%) diff --git a/package/gluon-config-mode/files/etc/config/configmode b/package/gluon-config-mode/files/etc/config/config-mode similarity index 100% rename from package/gluon-config-mode/files/etc/config/configmode rename to package/gluon-config-mode/files/etc/config/config-mode diff --git a/package/gluon-config-mode/files/etc/hotplug.d/button/50-config-mode b/package/gluon-config-mode/files/etc/hotplug.d/button/50-config-mode new file mode 100755 index 00000000..59dcd7de --- /dev/null +++ b/package/gluon-config-mode/files/etc/hotplug.d/button/50-config-mode @@ -0,0 +1,29 @@ +#!/bin/sh + + +wait=3 + + +wait_config_mode() { + sleep $wait + uci set 'config-mode.@wizard[0].enabled=1' + uci commit config-mode + reboot +} + + +if [ "$BUTTON" = wps -o "$BUTTON" = reset ]; then + case "$ACTION" in + pressed) + wait_config_mode & + PID=$! + echo $PID > /tmp/.wait_config_mode + ;; + released) + if [ -r /tmp/.wait_config_mode ]; then + kill $(cat /tmp/.wait_config_mode) + rm /tmp/.wait_config_mode + fi + ;; + esac +fi diff --git a/package/gluon-config-mode/files/etc/hotplug.d/button/50-configmode b/package/gluon-config-mode/files/etc/hotplug.d/button/50-configmode deleted file mode 100755 index d5032d21..00000000 --- a/package/gluon-config-mode/files/etc/hotplug.d/button/50-configmode +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - - -wait=3 - - -wait_configmode() { - sleep $wait - uci set 'configmode.@wizard[0].enabled=1' - uci commit configmode - reboot -} - - -if [ "$BUTTON" = wps -o "$BUTTON" = reset ]; then - case "$ACTION" in - pressed) - wait_configmode & - PID=$! - echo $PID > /tmp/.wait_configmode - ;; - released) - if [ -r /tmp/.wait_configmode ]; then - kill $(cat /tmp/.wait_configmode) - rm /tmp/.wait_configmode - fi - ;; - esac -fi diff --git a/package/gluon-config-mode/files/etc/init.d/config-mode b/package/gluon-config-mode/files/etc/init.d/config-mode new file mode 100755 index 00000000..3d462c32 --- /dev/null +++ b/package/gluon-config-mode/files/etc/init.d/config-mode @@ -0,0 +1,54 @@ +#!/bin/sh /etc/rc.common + +START=12 + + +config_mode_iface=eth0 +config_mode_addr=192.168.1.1 +config_mode_plen=24 + +config_mode_dnsname=freifunk +config_mode_dhcp_range=192.168.1.2,192.168.1.254 + +check_enable() { + config_get enabled "$1" enabled + config_get configured "$1" configured + + if [ "$enabled" = 1 -o "$configured" != 1 ]; then + export enable=1 + fi +} + +start() { + enable=0 + config_load config-mode + config_foreach check_enable wizard + + if [ "$enable" = '1' ]; then + lua -luci -e 'require "luci.model.uci"; uci_state=luci.model.uci.cursor_state(); uci_state:section("config-mode", "wizard", nil, { running = "1" }); uci_state:save("config-mode")' + uci set 'config-mode.@wizard[0].enabled=0' + uci commit config-mode + + ip addr add $config_mode_addr/$config_mode_plen dev $config_mode_iface + ip link set up dev $config_mode_iface + + /etc/init.d/haveged start + /etc/init.d/telnet start + /etc/init.d/dropbear start + /etc/init.d/uhttpd start + /etc/init.d/led start + + # correctly finish firstboot + /etc/init.d/done boot + + echo "$config_mode_addr $config_mode_dnsname" > /tmp/hosts.config-mode + dnsmasq -h -H /tmp/hosts.config-mode -R -F interface:$config_mode_iface,$config_mode_dhcp_range -l /tmp/dhcp.leases -O option:router + + . /etc/diag.sh + get_status_led + status_led_set_timer 1000 300 + + # block further boot + while true; do sleep 1; done + fi +} diff --git a/package/gluon-config-mode/files/etc/init.d/configmode b/package/gluon-config-mode/files/etc/init.d/configmode deleted file mode 100755 index 7055d130..00000000 --- a/package/gluon-config-mode/files/etc/init.d/configmode +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh /etc/rc.common - -START=12 - - -configmode_iface=eth0 -configmode_addr=192.168.1.1 -configmode_plen=24 - -configmode_dnsname=freifunk -configmode_dhcp_range=192.168.1.2,192.168.1.254 - -check_enable() { - config_get enabled "$1" enabled - config_get configured "$1" configured - - if [ "$enabled" = 1 -o "$configured" != 1 ]; then - export enable=1 - fi -} - -start() { - enable=0 - config_load configmode - config_foreach check_enable wizard - - if [ "$enable" = '1' ]; then - lua -luci -e 'require "luci.model.uci"; uci_state=luci.model.uci.cursor_state(); uci_state:section("configmode", "wizard", nil, { running = "1" }); uci_state:save("configmode")' - uci set 'configmode.@wizard[0].enabled=0' - uci commit configmode - - ip addr add $configmode_addr/$configmode_plen dev $configmode_iface - ip link set up dev $configmode_iface - - /etc/init.d/haveged start - /etc/init.d/telnet start - /etc/init.d/dropbear start - /etc/init.d/uhttpd start - /etc/init.d/led start - - # correctly finish firstboot - /etc/init.d/done boot - - echo "$configmode_addr $configmode_dnsname" > /tmp/hosts.configmode - dnsmasq -h -H /tmp/hosts.configmode -R -F interface:$configmode_iface,$configmode_dhcp_range -l /tmp/dhcp.leases -O option:router - - . /etc/diag.sh - get_status_led - status_led_set_timer 1000 300 - - # block further boot - while true; do sleep 1; done - fi -} diff --git a/package/gluon-config-mode/files/lib/gluon/upgrade/config-mode/invariant/001-migrate-uci-config b/package/gluon-config-mode/files/lib/gluon/upgrade/config-mode/invariant/001-migrate-uci-config index e3ff8f2c..1aa788dc 100755 --- a/package/gluon-config-mode/files/lib/gluon/upgrade/config-mode/invariant/001-migrate-uci-config +++ b/package/gluon-config-mode/files/lib/gluon/upgrade/config-mode/invariant/001-migrate-uci-config @@ -1,6 +1,6 @@ #!/bin/sh OLD_CFG=/etc/config/config_mode -NEW_CFG=/etc/config/configmode +NEW_CFG=/etc/config/config-mode [ -f $OLD_CFG ] && mv $OLD_CFG $NEW_CFG diff --git a/package/gluon-config-mode/files/lib/gluon/upgrade/configmode/invariant/001-migrate-uci-config b/package/gluon-config-mode/files/lib/gluon/upgrade/configmode/invariant/001-migrate-uci-config deleted file mode 100755 index e3ff8f2c..00000000 --- a/package/gluon-config-mode/files/lib/gluon/upgrade/configmode/invariant/001-migrate-uci-config +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -OLD_CFG=/etc/config/config_mode -NEW_CFG=/etc/config/configmode - -[ -f $OLD_CFG ] && mv $OLD_CFG $NEW_CFG diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/config-mode/config-mode.lua similarity index 55% rename from package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua rename to package/gluon-config-mode/files/usr/lib/lua/luci/controller/config-mode/config-mode.lua index 71a1a60f..ac7d7901 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/config-mode/config-mode.lua @@ -10,54 +10,54 @@ You may obtain a copy of the License at $Id$ ]]-- -module("luci.controller.configmode.configmode", package.seeall) +module("luci.controller.config-mode.config-mode", package.seeall) local meshvpn_name = "mesh_vpn" function index() local uci_state = luci.model.uci.cursor_state() - if uci_state:get_first("configmode", "wizard", "running", "0") == "1" then + if uci_state:get_first("config-mode", "wizard", "running", "0") == "1" then local root = node() if not root.target then - root.target = alias("configmode") + root.target = alias("config-mode") root.index = true end page = node() page.lock = true - page.target = alias("configmode") + page.target = alias("config-mode") page.subindex = true page.index = false - page = node("configmode") - page.title = _("Configmode") - page.target = alias("configmode", "wizard") + page = node("config-mode") + page.title = _("Wizard") + page.target = alias("config-mode", "wizard") page.order = 5 page.setuser = "root" page.setgroup = "root" page.index = true - entry({"configmode", "wizard"}, form("configmode/wizard")).index = true - entry({"configmode", "reboot"}, call("action_reboot")) + entry({"config-mode", "wizard"}, form("config-mode/wizard")).index = true + entry({"config-mode", "reboot"}, call("action_reboot")) end end function action_reboot() - local configmode = require "luci.tools.configmode" + local configmode = require "luci.tools.config-mode" local pubkey local uci = luci.model.uci.cursor() local meshvpn_enabled = uci:get("fastd", meshvpn_name, "enabled", "0") if meshvpn_enabled == "1" then pubkey = configmode.get_fastd_pubkey(meshvpn_name) end - luci.template.render("configmode/reboot", {pubkey=pubkey}) + luci.template.render("config-mode/reboot", {pubkey=pubkey}) - uci:foreach("configmode", "wizard", function(s) - uci:set("configmode", s[".name"], "configured", "1") + uci:foreach("config-mode", "wizard", function(s) + uci:set("config-mode", s[".name"], "configured", "1") end) - uci:save("configmode") - uci:commit("configmode") + uci:save("config-mode") + uci:commit("config-mode") luci.sys.reboot() end diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/configmode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/config-mode/wizard.lua similarity index 95% rename from package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/configmode/wizard.lua rename to package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/config-mode/wizard.lua index d651a7c7..1e3b8f73 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/configmode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/config-mode/wizard.lua @@ -1,4 +1,4 @@ -local configmode = require "luci.tools.configmode" +local configmode = require "luci.tools.config-mode" local meshvpn_name = "mesh_vpn" local uci = luci.model.uci.cursor() local f, s, o @@ -75,7 +75,7 @@ function f.handle(self, state, data) uci:save("system") uci:commit("system") - luci.http.redirect(luci.dispatcher.build_url("configmode", "reboot")) + luci.http.redirect(luci.dispatcher.build_url("config-mode", "reboot")) end return true diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/tools/configmode.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/tools/config-mode.lua similarity index 95% rename from package/gluon-config-mode/files/usr/lib/lua/luci/tools/configmode.lua rename to package/gluon-config-mode/files/usr/lib/lua/luci/tools/config-mode.lua index 3b4c8b6b..4250ddd2 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/tools/configmode.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/tools/config-mode.lua @@ -1,7 +1,7 @@ local luci = require "luci" local io = require "io" -module "luci.tools.configmode" +module "luci.tools.config-mode" function setup_fastd_secret(name) local uci = luci.model.uci.cursor() diff --git a/package/gluon-config-mode/generate/usr/lib/lua/luci/view/configmode/reboot.htm b/package/gluon-config-mode/generate/usr/lib/lua/luci/view/config-mode/reboot.htm similarity index 100% rename from package/gluon-config-mode/generate/usr/lib/lua/luci/view/configmode/reboot.htm rename to package/gluon-config-mode/generate/usr/lib/lua/luci/view/config-mode/reboot.htm From 9c0db9e291a1c4750031f627613d6cca1d76122c Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 2 Oct 2013 20:23:00 +0200 Subject: [PATCH 057/453] gluon-ebtables: always enable ebtables when they are installed --- .../lib/gluon/upgrade/ebtables/invariant/010-enable-ebtables | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 package/gluon-ebtables/files/lib/gluon/upgrade/ebtables/invariant/010-enable-ebtables diff --git a/package/gluon-ebtables/files/lib/gluon/upgrade/ebtables/invariant/010-enable-ebtables b/package/gluon-ebtables/files/lib/gluon/upgrade/ebtables/invariant/010-enable-ebtables new file mode 100755 index 00000000..5c2aa269 --- /dev/null +++ b/package/gluon-ebtables/files/lib/gluon/upgrade/ebtables/invariant/010-enable-ebtables @@ -0,0 +1,3 @@ +#!/bin/sh + +/etc/init.d/gluon-ebtables enable From 0a9b81147723c4698e8806fb742fcdc8c731ab58 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 2 Oct 2013 20:25:45 +0200 Subject: [PATCH 058/453] gluon-cron: always enable cron when it is installed --- .../files/lib/gluon/upgrade/cron/invariant/010-enable-cron | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 package/gluon-cron/files/lib/gluon/upgrade/cron/invariant/010-enable-cron diff --git a/package/gluon-cron/files/lib/gluon/upgrade/cron/invariant/010-enable-cron b/package/gluon-cron/files/lib/gluon/upgrade/cron/invariant/010-enable-cron new file mode 100755 index 00000000..46391527 --- /dev/null +++ b/package/gluon-cron/files/lib/gluon/upgrade/cron/invariant/010-enable-cron @@ -0,0 +1,4 @@ +#!/bin/sh + +/etc/init.d/gluon-cron enable + From f22f0e44f6291e503873344b9fc027bf43b9423b Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 2 Oct 2013 20:30:09 +0200 Subject: [PATCH 059/453] gluon-mesh-vpn-fastd: always enable fastd --- package/gluon-mesh-vpn-fastd/Makefile | 1 + .../gluon/upgrade/mesh-vpn-fastd/invariant/010-enable-fastd | 3 +++ .../gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd | 3 --- 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100755 package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-enable-fastd delete mode 100644 package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd diff --git a/package/gluon-mesh-vpn-fastd/Makefile b/package/gluon-mesh-vpn-fastd/Makefile index d2322682..515cbcb3 100644 --- a/package/gluon-mesh-vpn-fastd/Makefile +++ b/package/gluon-mesh-vpn-fastd/Makefile @@ -31,6 +31,7 @@ define Build/Compile endef define Package/gluon-mesh-vpn-fastd/install + $(CP) ./files/* $(1)/ $(INSTALL_DIR) $(1)/lib/gluon/upgrade/mesh-vpn-fastd/invariant $(INSTALL_BIN) $(PKG_BUILD_DIR)/fastd.sh $(1)/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd endef diff --git a/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-enable-fastd b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-enable-fastd new file mode 100755 index 00000000..f4fc6d55 --- /dev/null +++ b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-enable-fastd @@ -0,0 +1,3 @@ +#!/bin/sh + +/etc/init.d/fastd enable diff --git a/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd deleted file mode 100644 index 0f6d3cfa..00000000 --- a/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -# TODO From 71b8be79f40185131fb73c889186c6298b70682f Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 2 Oct 2013 22:56:19 +0200 Subject: [PATCH 060/453] gluon-config-mode: rename config-mode to gluon-config-mode --- .../config/{config-mode => gluon-config-mode} | 0 .../{50-config-mode => 50-gluon-config-mode} | 0 .../init.d/{config-mode => gluon-config-mode} | 12 ++++---- .../invariant/001-migrate-uci-config | 2 +- .../index.lua} | 28 +++++++++---------- .../wizard.lua | 4 +-- ...{config-mode.lua => gluon-config-mode.lua} | 2 +- .../reboot.htm | 0 8 files changed, 24 insertions(+), 24 deletions(-) rename package/gluon-config-mode/files/etc/config/{config-mode => gluon-config-mode} (100%) rename package/gluon-config-mode/files/etc/hotplug.d/button/{50-config-mode => 50-gluon-config-mode} (100%) rename package/gluon-config-mode/files/etc/init.d/{config-mode => gluon-config-mode} (67%) rename package/gluon-config-mode/files/lib/gluon/upgrade/{config-mode => gluon-config-mode}/invariant/001-migrate-uci-config (68%) rename package/gluon-config-mode/files/usr/lib/lua/luci/controller/{config-mode/config-mode.lua => gluon-config-mode/index.lua} (55%) rename package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/{config-mode => gluon-config-mode}/wizard.lua (95%) rename package/gluon-config-mode/files/usr/lib/lua/luci/tools/{config-mode.lua => gluon-config-mode.lua} (95%) rename package/gluon-config-mode/generate/usr/lib/lua/luci/view/{config-mode => gluon-config-mode}/reboot.htm (100%) diff --git a/package/gluon-config-mode/files/etc/config/config-mode b/package/gluon-config-mode/files/etc/config/gluon-config-mode similarity index 100% rename from package/gluon-config-mode/files/etc/config/config-mode rename to package/gluon-config-mode/files/etc/config/gluon-config-mode diff --git a/package/gluon-config-mode/files/etc/hotplug.d/button/50-config-mode b/package/gluon-config-mode/files/etc/hotplug.d/button/50-gluon-config-mode similarity index 100% rename from package/gluon-config-mode/files/etc/hotplug.d/button/50-config-mode rename to package/gluon-config-mode/files/etc/hotplug.d/button/50-gluon-config-mode diff --git a/package/gluon-config-mode/files/etc/init.d/config-mode b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode similarity index 67% rename from package/gluon-config-mode/files/etc/init.d/config-mode rename to package/gluon-config-mode/files/etc/init.d/gluon-config-mode index 3d462c32..ca72a580 100755 --- a/package/gluon-config-mode/files/etc/init.d/config-mode +++ b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode @@ -21,13 +21,13 @@ check_enable() { start() { enable=0 - config_load config-mode + config_load gluon-config-mode config_foreach check_enable wizard if [ "$enable" = '1' ]; then - lua -luci -e 'require "luci.model.uci"; uci_state=luci.model.uci.cursor_state(); uci_state:section("config-mode", "wizard", nil, { running = "1" }); uci_state:save("config-mode")' - uci set 'config-mode.@wizard[0].enabled=0' - uci commit config-mode + lua -luci -e 'require "luci.model.uci"; uci_state=luci.model.uci.cursor_state(); uci_state:section("gluon-config-mode", "wizard", nil, { running = "1" }); uci_state:save("gluon-config-mode")' + uci set 'gluon-config-mode.@wizard[0].enabled=0' + uci commit gluon-config-mode ip addr add $config_mode_addr/$config_mode_plen dev $config_mode_iface ip link set up dev $config_mode_iface @@ -41,8 +41,8 @@ start() { # correctly finish firstboot /etc/init.d/done boot - echo "$config_mode_addr $config_mode_dnsname" > /tmp/hosts.config-mode - dnsmasq -h -H /tmp/hosts.config-mode -R -F interface:$config_mode_iface,$config_mode_dhcp_range -l /tmp/dhcp.leases -O option:router + echo "$config_mode_addr $config_mode_dnsname" > /tmp/hosts.gluon-config-mode + dnsmasq -h -H /tmp/hosts.gluon-config-mode -R -F interface:$config_mode_iface,$config_mode_dhcp_range -l /tmp/dhcp.leases -O option:router . /etc/diag.sh get_status_led diff --git a/package/gluon-config-mode/files/lib/gluon/upgrade/config-mode/invariant/001-migrate-uci-config b/package/gluon-config-mode/files/lib/gluon/upgrade/gluon-config-mode/invariant/001-migrate-uci-config similarity index 68% rename from package/gluon-config-mode/files/lib/gluon/upgrade/config-mode/invariant/001-migrate-uci-config rename to package/gluon-config-mode/files/lib/gluon/upgrade/gluon-config-mode/invariant/001-migrate-uci-config index 1aa788dc..657012da 100755 --- a/package/gluon-config-mode/files/lib/gluon/upgrade/config-mode/invariant/001-migrate-uci-config +++ b/package/gluon-config-mode/files/lib/gluon/upgrade/gluon-config-mode/invariant/001-migrate-uci-config @@ -1,6 +1,6 @@ #!/bin/sh OLD_CFG=/etc/config/config_mode -NEW_CFG=/etc/config/config-mode +NEW_CFG=/etc/config/gluon-config-mode [ -f $OLD_CFG ] && mv $OLD_CFG $NEW_CFG diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/config-mode/config-mode.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua similarity index 55% rename from package/gluon-config-mode/files/usr/lib/lua/luci/controller/config-mode/config-mode.lua rename to package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua index ac7d7901..5dad4a15 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/config-mode/config-mode.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua @@ -10,54 +10,54 @@ You may obtain a copy of the License at $Id$ ]]-- -module("luci.controller.config-mode.config-mode", package.seeall) +module("luci.controller.gluon-config-mode.index", package.seeall) local meshvpn_name = "mesh_vpn" function index() local uci_state = luci.model.uci.cursor_state() - if uci_state:get_first("config-mode", "wizard", "running", "0") == "1" then + if uci_state:get_first("gluon-config-mode", "wizard", "running", "0") == "1" then local root = node() if not root.target then - root.target = alias("config-mode") + root.target = alias("gluon-config-mode") root.index = true end page = node() page.lock = true - page.target = alias("config-mode") + page.target = alias("gluon-config-mode") page.subindex = true page.index = false - page = node("config-mode") + page = node("gluon-config-mode") page.title = _("Wizard") - page.target = alias("config-mode", "wizard") + page.target = alias("gluon-config-mode", "wizard") page.order = 5 page.setuser = "root" page.setgroup = "root" page.index = true - entry({"config-mode", "wizard"}, form("config-mode/wizard")).index = true - entry({"config-mode", "reboot"}, call("action_reboot")) + 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 configmode = require "luci.tools.config-mode" + local configmode = require "luci.tools.gluon-config-mode" local pubkey local uci = luci.model.uci.cursor() local meshvpn_enabled = uci:get("fastd", meshvpn_name, "enabled", "0") if meshvpn_enabled == "1" then pubkey = configmode.get_fastd_pubkey(meshvpn_name) end - luci.template.render("config-mode/reboot", {pubkey=pubkey}) + luci.template.render("gluon-config-mode/reboot", {pubkey=pubkey}) - uci:foreach("config-mode", "wizard", function(s) - uci:set("config-mode", s[".name"], "configured", "1") + uci:foreach("gluon-config-mode", "wizard", function(s) + uci:set("gluon-config-mode", s[".name"], "configured", "1") end) - uci:save("config-mode") - uci:commit("config-mode") + uci:save("gluon-config-mode") + uci:commit("gluon-config-mode") luci.sys.reboot() end diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/config-mode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua similarity index 95% rename from package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/config-mode/wizard.lua rename to package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua index 1e3b8f73..89a635d5 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/config-mode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua @@ -1,4 +1,4 @@ -local configmode = require "luci.tools.config-mode" +local configmode = require "luci.tools.gluon-config-mode" local meshvpn_name = "mesh_vpn" local uci = luci.model.uci.cursor() local f, s, o @@ -75,7 +75,7 @@ function f.handle(self, state, data) uci:save("system") uci:commit("system") - luci.http.redirect(luci.dispatcher.build_url("config-mode", "reboot")) + luci.http.redirect(luci.dispatcher.build_url("gluon-config-mode", "reboot")) end return true diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/tools/config-mode.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/tools/gluon-config-mode.lua similarity index 95% rename from package/gluon-config-mode/files/usr/lib/lua/luci/tools/config-mode.lua rename to package/gluon-config-mode/files/usr/lib/lua/luci/tools/gluon-config-mode.lua index 4250ddd2..ba1748f1 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/tools/config-mode.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/tools/gluon-config-mode.lua @@ -1,7 +1,7 @@ local luci = require "luci" local io = require "io" -module "luci.tools.config-mode" +module "luci.tools.gluon-config-mode" function setup_fastd_secret(name) local uci = luci.model.uci.cursor() diff --git a/package/gluon-config-mode/generate/usr/lib/lua/luci/view/config-mode/reboot.htm b/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm similarity index 100% rename from package/gluon-config-mode/generate/usr/lib/lua/luci/view/config-mode/reboot.htm rename to package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm From c73d52d77f30a135b211316560f9724086c74ff7 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Thu, 3 Oct 2013 13:10:18 +0200 Subject: [PATCH 061/453] gluon-config-mode: fix upgrade script /lib/gluon/ugprade/config-mode/ --- .../invariant/001-migrate-uci-config | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename package/gluon-config-mode/files/lib/gluon/upgrade/{gluon-config-mode => config-mode}/invariant/001-migrate-uci-config (100%) diff --git a/package/gluon-config-mode/files/lib/gluon/upgrade/gluon-config-mode/invariant/001-migrate-uci-config b/package/gluon-config-mode/files/lib/gluon/upgrade/config-mode/invariant/001-migrate-uci-config similarity index 100% rename from package/gluon-config-mode/files/lib/gluon/upgrade/gluon-config-mode/invariant/001-migrate-uci-config rename to package/gluon-config-mode/files/lib/gluon/upgrade/config-mode/invariant/001-migrate-uci-config From a5c042c294954d6f95404161b56f044c9dbd3708 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 3 Oct 2013 13:59:45 +0200 Subject: [PATCH 062/453] Add gluon-simple-tc package --- package/gluon-simple-tc/Makefile | 36 +++++++++++++++++++ .../files/etc/config/gluon-simple-tc | 7 ++++ .../etc/hotplug.d/net/50-gluon-simple-tc | 30 ++++++++++++++++ .../etc/modules-boot.d/30-gluon-simple-tc | 1 + .../files/etc/modules.d/30-gluon-simple-tc | 4 +++ 5 files changed, 78 insertions(+) create mode 100644 package/gluon-simple-tc/Makefile create mode 100644 package/gluon-simple-tc/files/etc/config/gluon-simple-tc create mode 100644 package/gluon-simple-tc/files/etc/hotplug.d/net/50-gluon-simple-tc create mode 120000 package/gluon-simple-tc/files/etc/modules-boot.d/30-gluon-simple-tc create mode 100644 package/gluon-simple-tc/files/etc/modules.d/30-gluon-simple-tc diff --git a/package/gluon-simple-tc/Makefile b/package/gluon-simple-tc/Makefile new file mode 100644 index 00000000..c496682d --- /dev/null +++ b/package/gluon-simple-tc/Makefile @@ -0,0 +1,36 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-simple-tc +PKG_VERSION:=1 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-simple-tc + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Bandwidth limit support + DEPENDS:=+gluon-core +tc +kmod-sched +endef + +define Package/gluon-simple-tc/description + Gluon community wifi mesh firmware framework: tc support +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-simple-tc/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-simple-tc)) diff --git a/package/gluon-simple-tc/files/etc/config/gluon-simple-tc b/package/gluon-simple-tc/files/etc/config/gluon-simple-tc new file mode 100644 index 00000000..b24df115 --- /dev/null +++ b/package/gluon-simple-tc/files/etc/config/gluon-simple-tc @@ -0,0 +1,7 @@ +# Example config + +config interface 'example' + option enabled '0' + option ifname 'eth0' + option limit_egress '1000' # 1000 Kbit/s + option limit_ingress '5000' # 5000 Kbit/s \ No newline at end of file diff --git a/package/gluon-simple-tc/files/etc/hotplug.d/net/50-gluon-simple-tc b/package/gluon-simple-tc/files/etc/hotplug.d/net/50-gluon-simple-tc new file mode 100644 index 00000000..e5ea8f75 --- /dev/null +++ b/package/gluon-simple-tc/files/etc/hotplug.d/net/50-gluon-simple-tc @@ -0,0 +1,30 @@ +[ "$ACTION" = 'add' ] || exit 0 + +config_load gluon-simple-tc + + +tc_interface() { + local iface="$1" + + config_get ifname "$iface" ifname + + [ "$INTERFACE" = "$ifname" ] || return + + config_get_bool enabled "$iface" enabled 0 + + [ "$enabled" -eq 1 ] || return + + config_get limit_egress "$iface" limit_egress + config_get limit_ingress "$iface" limit_ingress + + if [ "$limit_egress" ]; then + tc qdisc add dev "$INTERFACE" root tbf rate "${limit_egress}kbit" latency 50ms burst 2k + fi + + if [ "$limit_ingress" ]; then + tc qdisc add dev "$INTERFACE" handle ffff: ingress + tc filter add dev "$INTERFACE" parent ffff: u32 match u8 00 00 at 0 police rate "${limit_ingress}kbit" burst 10k drop flowid :1 + fi +} + +config_foreach tc_interface 'interface' diff --git a/package/gluon-simple-tc/files/etc/modules-boot.d/30-gluon-simple-tc b/package/gluon-simple-tc/files/etc/modules-boot.d/30-gluon-simple-tc new file mode 120000 index 00000000..44318d6e --- /dev/null +++ b/package/gluon-simple-tc/files/etc/modules-boot.d/30-gluon-simple-tc @@ -0,0 +1 @@ +../modules.d/30-gluon-simple-tc \ No newline at end of file diff --git a/package/gluon-simple-tc/files/etc/modules.d/30-gluon-simple-tc b/package/gluon-simple-tc/files/etc/modules.d/30-gluon-simple-tc new file mode 100644 index 00000000..87cb79f9 --- /dev/null +++ b/package/gluon-simple-tc/files/etc/modules.d/30-gluon-simple-tc @@ -0,0 +1,4 @@ +sch_ingress +sch_tbf +cls_u32 +act_police From e73f79f392fd21cbb9bec9d54518d7cf821f6274 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 3 Oct 2013 18:04:03 +0200 Subject: [PATCH 063/453] Move some more configuration into the corrent packages, correctly configure multiple radios --- .../gluon/upgrade/core/initial/020-wireless | 28 +++----- package/gluon-mesh-batman-adv/Makefile | 1 + .../initial/{011-mesh => 010-mesh} | 12 ---- .../mesh-batman-adv/initial/020-wireless | 64 +++++++++++++++++++ package/gluon-mesh-vpn-fastd/fastd.pl | 6 ++ 5 files changed, 79 insertions(+), 32 deletions(-) rename package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/{011-mesh => 010-mesh} (72%) create mode 100755 package/gluon-mesh-batman-adv/generate/lib/gluon/upgrade/mesh-batman-adv/initial/020-wireless diff --git a/package/gluon-core/generate/lib/gluon/upgrade/core/initial/020-wireless b/package/gluon-core/generate/lib/gluon/upgrade/core/initial/020-wireless index 944d84a4..0196b951 100755 --- a/package/gluon-core/generate/lib/gluon/upgrade/core/initial/020-wireless +++ b/package/gluon-core/generate/lib/gluon/upgrade/core/initial/020-wireless @@ -1,26 +1,14 @@ #!/bin/sh -uci -q batch < Date: Thu, 3 Oct 2013 18:41:45 +0200 Subject: [PATCH 064/453] gluon-mesh-vpn-fastd: clean up configuration script --- package/gluon-mesh-vpn-fastd/fastd.pl | 73 +++++++++++++++------------ 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/package/gluon-mesh-vpn-fastd/fastd.pl b/package/gluon-mesh-vpn-fastd/fastd.pl index dd2f64ed..85b24c8e 100644 --- a/package/gluon-mesh-vpn-fastd/fastd.pl +++ b/package/gluon-mesh-vpn-fastd/fastd.pl @@ -3,63 +3,72 @@ my $backbone = $cfg->{backbone}; my $add_methods = ''; for (@{$cfg->{methods}}) { - $add_methods .= "add_list fastd.mesh_vpn.method='$_'\n"; + $add_methods .= "uci add_list fastd.mesh_vpn.method='$_'\n"; } my $set_peer_limit; if ($backbone->{limit}) { - $set_peer_limit = "set fastd.mesh_vpn_backbone.peer_limit='$backbone->{limit}'\n"; + $set_peer_limit = "uci_set fastd mesh_vpn_backbone peer_limit '$backbone->{limit}'\n"; } else { - $set_peer_limit = "delete fastd.mesh_vpn_backbone.peer_limit\n"; + $set_peer_limit = "uci_remove fastd mesh_vpn_backbone peer_limit\n"; } print <{mtu}' + +uci_remove fastd mesh_vpn method $add_methods -delete fastd.mesh_vpn_backbone -set fastd.mesh_vpn_backbone='peer_group' -set fastd.mesh_vpn_backbone.enabled='1' -set fastd.mesh_vpn_backbone.net='mesh_vpn' + +uci_remove fastd mesh_vpn_backbone +uci_add fastd peer_group mesh_vpn_backbone +uci_set fastd mesh_vpn_backbone enabled '1' +uci_set fastd mesh_vpn_backbone net 'mesh_vpn' $set_peer_limit END foreach my $name (sort keys %{$backbone->{peers}}) { my $peer = $backbone->{peers}->{$name}; print <{key}' EOF for (@{$peer->{remotes}}) { - print "add_list fastd.mesh_vpn_backbone_peer_$name.remote='$_'\n"; + print "uci add_list fastd.mesh_vpn_backbone_peer_$name.remote='$_'\n"; } } -print < Date: Thu, 3 Oct 2013 18:46:54 +0200 Subject: [PATCH 065/453] gluon-core: clean up uci config --- .../gluon/upgrade/core/initial/001-sysconfig | 1 + .../upgrade/core/initial/011-gluon-network | 19 ++++----- .../upgrade/core/initial/010-gluon-system | 42 +++---------------- 3 files changed, 16 insertions(+), 46 deletions(-) diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig b/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig index 1affcb46..1bcedc3a 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig +++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig @@ -17,4 +17,5 @@ get_primary_mac() { sysconfig_set lan_ifname "$(uci get network.lan.ifname)" +sysconfig_set wan_ifname "$(uci get network.wan.ifname)" sysconfig_set primary_mac "$(get_primary_mac)" diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network index 28211d71..a82183a8 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network +++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network @@ -1,20 +1,19 @@ #!/bin/sh +. /lib/functions.sh . /lib/gluon/functions/sysconfig.sh -uci -q batch < Date: Thu, 3 Oct 2013 19:02:06 +0200 Subject: [PATCH 066/453] gluon-mesh-batman-adv: clean up config script --- .../upgrade/mesh-batman-adv/initial/010-mesh | 39 +++++++------------ 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh index b18c975d..c247ea92 100755 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh @@ -1,33 +1,20 @@ #!/bin/sh - +. /lib/functions.sh . /lib/gluon/functions/sysconfig.sh -uci -q batch < Date: Thu, 3 Oct 2013 21:10:29 +0200 Subject: [PATCH 067/453] gluon-simple-tc: create initial config from site.conf --- package/gluon-simple-tc/Makefile | 3 +++ package/gluon-simple-tc/initial.pl | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 package/gluon-simple-tc/initial.pl diff --git a/package/gluon-simple-tc/Makefile b/package/gluon-simple-tc/Makefile index c496682d..9c194f90 100644 --- a/package/gluon-simple-tc/Makefile +++ b/package/gluon-simple-tc/Makefile @@ -27,10 +27,13 @@ define Build/Configure endef define Build/Compile + $(GLUON_CONFIGURE) initial.pl > $(PKG_BUILD_DIR)/initial.sh endef define Package/gluon-simple-tc/install $(CP) ./files/* $(1)/ + $(INSTALL_DIR) $(1)/lib/gluon/upgrade/simple-tc/initial + $(INSTALL_BIN) $(PKG_BUILD_DIR)/initial.sh $(1)/lib/gluon/upgrade/simple-tc/initial/010-site-defaults endef $(eval $(call BuildPackage,gluon-simple-tc)) diff --git a/package/gluon-simple-tc/initial.pl b/package/gluon-simple-tc/initial.pl new file mode 100644 index 00000000..820029f7 --- /dev/null +++ b/package/gluon-simple-tc/initial.pl @@ -0,0 +1,21 @@ +my $cfg = $CONFIG->{simple_tc}; + +print <<'END'; +#/bin/sh + +uci -q batch <{$_}\n"; + } +} + +print < Date: Thu, 3 Oct 2013 22:12:47 +0200 Subject: [PATCH 068/453] gluon-config-mode: forgot to rename uci config in button script --- .../files/etc/hotplug.d/button/50-gluon-config-mode | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-config-mode/files/etc/hotplug.d/button/50-gluon-config-mode b/package/gluon-config-mode/files/etc/hotplug.d/button/50-gluon-config-mode index 59dcd7de..34623cb1 100755 --- a/package/gluon-config-mode/files/etc/hotplug.d/button/50-gluon-config-mode +++ b/package/gluon-config-mode/files/etc/hotplug.d/button/50-gluon-config-mode @@ -6,7 +6,7 @@ wait=3 wait_config_mode() { sleep $wait - uci set 'config-mode.@wizard[0].enabled=1' + uci set 'gluon-config-mode.@wizard[0].enabled=1' uci commit config-mode reboot } From 05633089c4ab6dcfcd7ae6b86093f9db031af0ab Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Thu, 3 Oct 2013 22:48:54 +0200 Subject: [PATCH 069/453] gluon-config-mode: forgot to rename uci config in button script --- .../files/etc/hotplug.d/button/50-gluon-config-mode | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-config-mode/files/etc/hotplug.d/button/50-gluon-config-mode b/package/gluon-config-mode/files/etc/hotplug.d/button/50-gluon-config-mode index 34623cb1..7648cd69 100755 --- a/package/gluon-config-mode/files/etc/hotplug.d/button/50-gluon-config-mode +++ b/package/gluon-config-mode/files/etc/hotplug.d/button/50-gluon-config-mode @@ -7,7 +7,7 @@ wait=3 wait_config_mode() { sleep $wait uci set 'gluon-config-mode.@wizard[0].enabled=1' - uci commit config-mode + uci commit gluon-config-mode reboot } From 2468154ad11ae5d5988cb21c488f6e0b842770a4 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Thu, 3 Oct 2013 23:00:47 +0200 Subject: [PATCH 070/453] gluon-config-mode: add simple-tc settings for mesh_vpn --- package/gluon-config-mode/Makefile | 2 +- .../model/cbi/gluon-config-mode/wizard.lua | 36 +++++++++++-------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/package/gluon-config-mode/Makefile b/package/gluon-config-mode/Makefile index 85961871..75babcdd 100644 --- a/package/gluon-config-mode/Makefile +++ b/package/gluon-config-mode/Makefile @@ -15,7 +15,7 @@ define Package/gluon-config-mode SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci based config mode for user friendly setup of new meshnodes - DEPENDS:=+gluon-core +gluon-location +uhttpd +dnsmasq +luci-mod-admin-core +ip +luci-theme-openwrt +haveged + DEPENDS:=+gluon-core +gluon-location +gluon-simple-tc +uhttpd +dnsmasq +luci-mod-admin-core +ip +luci-theme-openwrt +haveged endef define Package/gluon-config-mode/description diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua index 89a635d5..d14a638e 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua @@ -15,22 +15,29 @@ o.value = uci:get_first("system", "system", "hostname") o.rmempty = false o.datatype = "hostname" +o = s:option(Flag, "_autoupdate", "Automatische Updates aktivieren?") +o.default = uci:get_bool("autoupdater", "settings", "enabled") and o.enabled or o.disabled +o.rmempty = false + +s = f:section(SimpleSection, "Mesh-VPN", nil) + o = s:option(Flag, "_meshvpn", "Mesh-VPN aktivieren?") o.default = uci:get_bool("fastd", meshvpn_name, "enabled") and o.enabled or o.disabled o.rmempty = false -local upstream, downstream -upstream = string.format("%d KBit/s", uci:get_first("freifunk", "bandwidth", "upstream")) -downstream = string.format("%d KBit/s", uci:get_first("freifunk", "bandwidth", "downstream")) - -o = s:option(Flag, "_bwlimit", "Bandbreitenbegrenzung aktivieren?") -o.default = uci:get_first("freifunk", "bandwidth", "enabled", "0") +o = s:option(Flag, "_limit_enabled", "Bandbreitenbegrenzung aktivieren?") +o.default = uci:get_bool("gluon-simple-tc", meshvpn_name, "enabled") and o.enabled or o.disabled o.rmempty = false -o.description = downstream .. " Downstream / " .. upstream .. " Upstream" -o = s:option(Flag, "_autoupdate", "Automatische Updates aktivieren?") -o.default = uci:get_bool("autoupdater", "settings", "enabled") and o.enabled or o.disabled +o = s:option(Value, "_limit_ingress", "Downstream") +o.value = uci:get("gluon-simple-tc", meshvpn_name, "limit_ingress") o.rmempty = false +o.datatype = "integer" + +o = s:option(Value, "_limit_egress", "Upstream") +o.value = uci:get("gluon-simple-tc", meshvpn_name, "limit_egress") +o.rmempty = false +o.datatype = "integer" s = f:section(SimpleSection, "GPS Koordinaten", "Hier kannst du die GPS Koordinaten deines Knotens festlegen damit er in der Karte angezeigt werden kann.") @@ -56,11 +63,12 @@ function f.handle(self, state, data) uci:save("autoupdater") uci:commit("autoupdater") - uci:foreach("freifunk", "bandwidth", function(s) - uci:set("freifunk", s[".name"], "enabled", data._bwlimit) - end) - uci:save("freifunk") - uci:commit("freifunk") + uci:set("gluon-simple-tc", meshvpn_name, "interface") + uci:set("gluon-simple-tc", meshvpn_name, "enabled", data._limit_enabled) + uci:set("gluon-simple-tc", meshvpn_name, "ifname", meshvpn_name) + uci:set("gluon-simple-tc", meshvpn_name, "limit_ingress", data._limit_ingress) + uci:set("gluon-simple-tc", meshvpn_name, "limit_egress", data._limit_egress) + uci:commit("gluon-simple-tc") uci:set("fastd", meshvpn_name, "enabled", data._meshvpn) uci:save("fastd") From 0d1e3e144b49b5dff6a879d16b18f573768922bc Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Thu, 3 Oct 2013 23:04:41 +0200 Subject: [PATCH 071/453] gluon-config-mode: site.conf: configmode -> config_mode --- .../generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm b/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm index c60dc9cf..23a66615 100644 --- a/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm +++ b/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm @@ -25,7 +25,7 @@ $Id$ <% if pubkey then %>

- @configmode.msg_pubkey@ + @config_mode.msg_pubkey@

<%=pubkey%> From 75ac64ca20f643f5a427446951c6e9ce2b85182f Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Thu, 3 Oct 2013 23:26:00 +0200 Subject: [PATCH 072/453] gluon-config-mode: simple-tc ifname must be mesh-vpn, not mesh_vpn --- .../usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua index d14a638e..6bdc7c4f 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua @@ -65,7 +65,7 @@ function f.handle(self, state, data) uci:set("gluon-simple-tc", meshvpn_name, "interface") uci:set("gluon-simple-tc", meshvpn_name, "enabled", data._limit_enabled) - uci:set("gluon-simple-tc", meshvpn_name, "ifname", meshvpn_name) + uci:set("gluon-simple-tc", meshvpn_name, "ifname", "mesh-vpn") uci:set("gluon-simple-tc", meshvpn_name, "limit_ingress", data._limit_ingress) uci:set("gluon-simple-tc", meshvpn_name, "limit_egress", data._limit_egress) uci:commit("gluon-simple-tc") From 9b69ac2845953f4af1c0cde32e57830cfd529578 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Fri, 4 Oct 2013 10:47:31 +0200 Subject: [PATCH 073/453] gluon-simple-tc: initial.pl: sort keys before creating config --- package/gluon-simple-tc/initial.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package/gluon-simple-tc/initial.pl b/package/gluon-simple-tc/initial.pl index 820029f7..fdffdc84 100644 --- a/package/gluon-simple-tc/initial.pl +++ b/package/gluon-simple-tc/initial.pl @@ -6,10 +6,12 @@ print <<'END'; uci -q batch <{$name}; + print "set gluon-simple-tc.$name=interface\n"; - for (qw(ifname enabled limit_egress limit_ingress)) { + for (qw(enabled ifname limit_egress limit_ingress)) { print "set gluon-simple-tc.$name.$_=$interface->{$_}\n"; } } From 3c8d9ed4ebef2fdbd4ac7c61a03dd6ffbf3ccd09 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 9 Oct 2013 20:35:55 +0200 Subject: [PATCH 074/453] gluon-simple-tc: add newline to end of example config --- package/gluon-simple-tc/files/etc/config/gluon-simple-tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-simple-tc/files/etc/config/gluon-simple-tc b/package/gluon-simple-tc/files/etc/config/gluon-simple-tc index b24df115..c9b784c6 100644 --- a/package/gluon-simple-tc/files/etc/config/gluon-simple-tc +++ b/package/gluon-simple-tc/files/etc/config/gluon-simple-tc @@ -4,4 +4,4 @@ config interface 'example' option enabled '0' option ifname 'eth0' option limit_egress '1000' # 1000 Kbit/s - option limit_ingress '5000' # 5000 Kbit/s \ No newline at end of file + option limit_ingress '5000' # 5000 Kbit/s From 15aafe47c8e3fcf9b7c9fa9e06c8fdb4d1d053af Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 9 Oct 2013 21:13:36 +0200 Subject: [PATCH 075/453] gluon-config-mode: texts from mkm --- .../lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua | 9 ++++++--- .../usr/lib/lua/luci/view/gluon-config-mode/reboot.htm | 4 +--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua index 6bdc7c4f..4b69ef01 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua @@ -6,7 +6,7 @@ local f, s, o -- prepare fastd key as early as possible configmode.setup_fastd_secret(meshvpn_name) -f = SimpleForm("wizard", "Wizard", "Lorem ipsum...") +f = SimpleForm("wizard", "Willkommen!", "Willkommen zum Einrichtungsassistenten für deinen neuen Lübecker Freifunk-Knoten. Fülle das folgende Formular deinen Vorstellungen entsprechend aus und klicke anschließend auf den „Senden“-Button.") s = f:section(SimpleSection, "Grundeinstellungen", nil) @@ -14,12 +14,14 @@ o = s:option(Value, "_hostname", "Knotenname") o.value = uci:get_first("system", "system", "hostname") o.rmempty = false o.datatype = "hostname" +o.description = "Öffentlicher Name deines Knotens. Wird z.B. für die Anzeige auf der Knotenkarte benutzt." o = s:option(Flag, "_autoupdate", "Automatische Updates aktivieren?") o.default = uci:get_bool("autoupdater", "settings", "enabled") and o.enabled or o.disabled o.rmempty = false +o.description = "Aktiviert automatische Updates der Firmware (empfohlen)" -s = f:section(SimpleSection, "Mesh-VPN", nil) +s = f:section(SimpleSection, "Mesh-VPN", "Nutzt die Internet-Verbindung, um diesem Knoten auch dann Zugang zum Freifunknetz zu geben, wenn er außerhalb der Funkreichweite anderer Freifunk-Knoten ist.") o = s:option(Flag, "_meshvpn", "Mesh-VPN aktivieren?") o.default = uci:get_bool("fastd", meshvpn_name, "enabled") and o.enabled or o.disabled @@ -28,6 +30,7 @@ o.rmempty = false o = s:option(Flag, "_limit_enabled", "Bandbreitenbegrenzung aktivieren?") o.default = uci:get_bool("gluon-simple-tc", meshvpn_name, "enabled") and o.enabled or o.disabled o.rmempty = false +o.description = "Begrenzt die Geschwindigkeit, mit der dieser Knoten auf das Internet zugreifen darf. Kann aktiviert werden, wenn der eigene Internetanschluss durch den Freifunkknoten merklich ausgebremst wird." o = s:option(Value, "_limit_ingress", "Downstream") o.value = uci:get("gluon-simple-tc", meshvpn_name, "limit_ingress") @@ -39,7 +42,7 @@ o.value = uci:get("gluon-simple-tc", meshvpn_name, "limit_egress") o.rmempty = false o.datatype = "integer" -s = f:section(SimpleSection, "GPS Koordinaten", "Hier kannst du die GPS Koordinaten deines Knotens festlegen damit er in der Karte angezeigt werden kann.") +s = f:section(SimpleSection, "GPS Koordinaten", "Hier kannst du die GPS-Koordinaten deines Knotens eintragen, um ihn in der Knotenkarte anzeigen zu lassen.") o = s:option(Flag, "_location", "Koordinaten veröffentlichen?") o.default = uci:get_first("system", "system", "share_location", o.disabled) diff --git a/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm b/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm index 23a66615..6132de75 100644 --- a/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm +++ b/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm @@ -33,9 +33,7 @@ $Id$
<% end %>
-

- Dein Knoten startet jetzt neu. Anschließend wird er versuchen sich mit anderen Knoten in der Nähe zu verbinden. Wir wünschen dir viel Spaß dabei Freifunk zu erkunden! -

+ @config_mode.msg_reboot@
From 4521362ce3383f02aa4c49b59f362b8a36fa4454 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 9 Oct 2013 21:55:48 +0200 Subject: [PATCH 076/453] gluon-core: clean up upgrade main script --- .../files/etc/uci-defaults/zzz-gluon-upgrade | 35 +++++-------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade b/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade index 751f4d71..baf59e8b 100755 --- a/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade +++ b/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade @@ -13,27 +13,20 @@ version_of() { } oldversion_of() { - oldversion="$(cat "$VERSION_DIR"/"$1" 2>/dev/null)" - - # Legacy support - if [ -z "$oldversion" ]; then oldversion="$(cat /etc/.freifunk_version_keep 2>/dev/null)"; fi - if [ -z "$oldversion" ]; then oldversion="$(cat /etc/.lff_version_keep 2>/dev/null)"; fi - if [ -z "$oldversion" ]; then oldversion="$(cat /etc/.kff_version_keep 2>/dev/null)"; fi - - echo "$oldversion" + cat "$VERSION_DIR"/"$1" 2>/dev/null } do_dir() { - if [ -d "$1" ]; then - local s - for s in "$1"/*; do "$s"; done - fi + [ -d "$1" ] || return + + local s + for s in "$1"/*; do "$s"; done } do_component() { local component="$1" local version="$(version_of "$component")" - if [ -z "$version" ]; then continue; fi + [ "$version" ] || continue ( cd "$component" @@ -45,7 +38,7 @@ do_component() { local v for v in *; do - if [ "$v" = initial -o "$v" = invariant -o "$v" = version ]; then continue; fi + [ "$v" != initial -a "$v" != invariant ] || continue # The return value of opkg compare-versions is negated if ! opkg compare-versions "$v" '>>' "$oldversion"; then @@ -61,21 +54,11 @@ do_component() { } -version="$(version_of core)" - -oldversion="$(cat "$VERSION_FILE" 2>/dev/null)" -if [ -z "$oldversion" ]; then oldversion="$(cat "$VERSION_FILE_FREIFUNK" 2>/dev/null)"; fi -if [ -z "$oldversion" ]; then oldversion="$(cat "$VERSION_FILE_LFF" 2>/dev/null)"; fi -if [ -z "$oldversion" ]; then oldversion="$(cat "$VERSION_FILE_KFF" 2>/dev/null)"; fi - cd "$UPGRADE_DIR" do_component core for component in *; do - if [ "$component" != 'core' ]; then - do_component "$component" - fi + [ "$component" != 'core' ] || continue + do_component "$component" done - -rm -f "$VERSION_FILE_FREIFUNK" "$VERSION_FILE_LFF" "$VERSION_FILE_KFF" From 4fdcc218c559c2bea1b716f5e80cb41dcee47db5 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Fri, 8 Nov 2013 14:49:06 +0100 Subject: [PATCH 077/453] autoupdater: fix initial upgrade script --- .../files/lib/gluon/upgrade/autoupdater/010-initial | 3 --- .../files/lib/gluon/upgrade/autoupdater/initial/010-initial | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) delete mode 100755 package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/010-initial diff --git a/package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/010-initial b/package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/010-initial deleted file mode 100755 index 08501799..00000000 --- a/package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/010-initial +++ /dev/null @@ -1,3 +0,0 @@ -#/bin/sh - -uci -q delete autoupdater.settings diff --git a/package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/initial/010-initial b/package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/initial/010-initial index 08501799..ed126ffb 100755 --- a/package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/initial/010-initial +++ b/package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/initial/010-initial @@ -1,3 +1,3 @@ -#/bin/sh +#!/bin/sh uci -q delete autoupdater.settings From be79b874c5238b14e10f94a93f061d5895c41f0b Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Thu, 28 Nov 2013 19:16:28 +0100 Subject: [PATCH 078/453] gluon-config-mode: show hostname on reboot page. fixes #8 --- .../usr/lib/lua/luci/view/gluon-config-mode/reboot.htm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm b/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm index 6132de75..7d192b6a 100644 --- a/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm +++ b/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm @@ -27,7 +27,9 @@ $Id$

@config_mode.msg_pubkey@

-
+
+ # <%=luci.sys.hostname()%> +
<%=pubkey%>
From 29b480522ec49bbfff6c6782e2d864b588458039 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Mon, 30 Sep 2013 18:42:47 +0200 Subject: [PATCH 079/453] basic admin mode --- package/gluon-luci-admin/Makefile | 39 +++ .../lib/lua/luci/controller/admin/index.lua | 52 ++++ .../lib/lua/luci/controller/admin/system.lua | 244 ++++++++++++++++++ .../lib/lua/luci/model/cbi/admin/index.lua | 14 + .../lib/lua/luci/model/cbi/admin/passwd.lua | 45 ++++ .../lib/lua/luci/view/admin/applyreboot.htm | 21 ++ .../usr/lib/lua/luci/view/admin/backup.htm | 40 +++ .../usr/lib/lua/luci/view/admin/index.htm | 21 ++ .../usr/lib/lua/luci/view/admin/reboot.htm | 33 +++ .../usr/lib/lua/luci/view/admin/upgrade.htm | 105 ++++++++ 10 files changed, 614 insertions(+) create mode 100644 package/gluon-luci-admin/Makefile create mode 100644 package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua create mode 100644 package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua create mode 100644 package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/index.lua create mode 100644 package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/passwd.lua create mode 100644 package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/applyreboot.htm create mode 100644 package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/backup.htm create mode 100644 package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/index.htm create mode 100644 package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm create mode 100644 package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm diff --git a/package/gluon-luci-admin/Makefile b/package/gluon-luci-admin/Makefile new file mode 100644 index 00000000..45a849dc --- /dev/null +++ b/package/gluon-luci-admin/Makefile @@ -0,0 +1,39 @@ +# Copyright (C) 2013 Nils Schneider +# This is free software, licensed under the Apache 2.0 license. + +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-luci-admin +PKG_VERSION:=0.1 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-luci-admin + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Luci based simple administration interface for mesh nodes + DEPENDS:=+gluon-core +luci-mod-admin-core +luci-theme-openwrt +endef + +define Package/gluon-luci-admin/description + Luci based config mode +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-luci-admin/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-luci-admin)) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua new file mode 100644 index 00000000..7fbd1170 --- /dev/null +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua @@ -0,0 +1,52 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +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.admin.index", package.seeall) + +function index() + local uci_state = luci.model.uci.cursor_state() + local configmode = uci_state:get_first("configmode", "wizard", "running", "0") == "1" + + local root = node() + if not root.lock then + root.target = alias("admin") + root.index = true + end + + local page = entry({"admin"}, alias("admin", "index"), _("Expertmode"), 10) + page.sysauth = "root" + if configmode then + -- force root to be logged in when running in configmode + page.sysauth_authenticator = function() return "root" end + else + page.sysauth_authenticator = "htmlauth" + end + page.index = true + + entry({"admin", "index"}, form("admin/index"), _("Overview"), 1).ignoreindex = true + entry({"admin", "logout"}, call("action_logout"), _("Logout")) +end + +function action_logout() + local dsp = require "luci.dispatcher" + local sauth = require "luci.sauth" + if dsp.context.authsession then + sauth.kill(dsp.context.authsession) + dsp.context.urltoken.stok = nil + end + + luci.http.header("Set-Cookie", "sysauth=; path=" .. dsp.build_url()) + luci.http.redirect(luci.dispatcher.build_url()) +end diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua new file mode 100644 index 00000000..cb0152c2 --- /dev/null +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua @@ -0,0 +1,244 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +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.admin.system", package.seeall) + +function index() + entry({"admin", "passwd"}, form("admin/passwd"), _("Admin Password"), 10) + entry({"admin", "backup"}, call("action_backup"), _("Backup / Restore"), 80) + entry({"admin", "upgrade"}, call("action_upgrade"), _("Flash Firmware"), 90) + entry({"admin", "reboot"}, call("action_reboot"), _("Reboot"), 100) +end + +function action_backup() + local reset_avail = os.execute([[grep '"rootfs_data"' /proc/mtd >/dev/null 2>&1]]) == 0 + local restore_cmd = "gunzip | tar -xC/ >/dev/null 2>&1" + local backup_cmd = "tar -c %s | gzip 2>/dev/null" + + local restore_fpi + luci.http.setfilehandler( + function(meta, chunk, eof) + if not restore_fpi then + restore_fpi = io.popen(restore_cmd, "w") + end + if chunk then + restore_fpi:write(chunk) + end + if eof then + restore_fpi:close() + end + end + ) + + local upload = luci.http.formvalue("archive") + local backup = luci.http.formvalue("backup") + local reset = reset_avail and luci.http.formvalue("reset") + + if upload and #upload > 0 then + luci.template.render("admin/applyreboot") + luci.sys.reboot() + elseif backup then + local reader = ltn12_popen(backup_cmd:format(_keep_pattern())) + luci.http.header('Content-Disposition', 'attachment; filename="backup-%s-%s.tar.gz"' % { + luci.sys.hostname(), os.date("%Y-%m-%d")}) + luci.http.prepare_content("application/x-targz") + luci.ltn12.pump.all(reader, luci.http.write) + elseif reset then + luci.template.render("admin/applyreboot") + luci.util.exec("mtd -r erase rootfs_data") + else + luci.template.render("admin/backup", {reset_avail = reset_avail}) + end +end + +function action_reboot() + local reboot = luci.http.formvalue("reboot") + luci.template.render("admin/reboot", {reboot=reboot}) + if reboot then + luci.sys.reboot() + end +end + +function action_upgrade() + require("luci.model.uci") + + local tmpfile = "/tmp/firmware.img" + + local function image_supported() + -- XXX: yay... + return ( 0 == os.execute( + ". /lib/functions.sh; " .. + "include /lib/upgrade; " .. + "platform_check_image %q >/dev/null" + % tmpfile + ) ) + end + + local function image_checksum() + return (luci.sys.exec("md5sum %q" % tmpfile):match("^([^%s]+)")) + end + + local function storage_size() + local size = 0 + if nixio.fs.access("/proc/mtd") then + for l in io.lines("/proc/mtd") do + local d, s, e, n = l:match('^([^%s]+)%s+([^%s]+)%s+([^%s]+)%s+"([^%s]+)"') + if n == "linux" then + size = tonumber(s, 16) + break + end + end + elseif nixio.fs.access("/proc/partitions") then + for l in io.lines("/proc/partitions") do + local x, y, b, n = l:match('^%s*(%d+)%s+(%d+)%s+([^%s]+)%s+([^%s]+)') + if b and n and not n:match('[0-9]') then + size = tonumber(b) * 1024 + break + end + end + end + return size + end + + + -- Install upload handler + local file + luci.http.setfilehandler( + function(meta, chunk, eof) + if not nixio.fs.access(tmpfile) and not file and chunk and #chunk > 0 then + file = io.open(tmpfile, "w") + end + if file and chunk then + file:write(chunk) + end + if file and eof then + file:close() + end + end + ) + + + -- Determine state + local keep_avail = true + local step = tonumber(luci.http.formvalue("step") or 1) + local has_image = nixio.fs.access(tmpfile) + local has_support = image_supported() + local has_platform = nixio.fs.access("/lib/upgrade/platform.sh") + local has_upload = luci.http.formvalue("image") + + -- This does the actual flashing which is invoked inside an iframe + -- so don't produce meaningful errors here because the the + -- previous pages should arrange the stuff as required. + if step == 4 then + if has_platform and has_image and has_support then + -- Mimetype text/plain + luci.http.prepare_content("text/plain") + luci.http.write("Starting luci-flash...\n") + + -- Now invoke sysupgrade + local keepcfg = keep_avail and luci.http.formvalue("keepcfg") == "1" + local flash = ltn12_popen("/sbin/luci-flash %s %q" %{ + keepcfg and "-k %q" % _keep_pattern() or "", tmpfile + }) + + luci.ltn12.pump.all(flash, luci.http.write) + + -- Make sure the device is rebooted + luci.sys.reboot() + end + + + -- + -- This is step 1-3, which does the user interaction and + -- image upload. + -- + + -- Step 1: file upload, error on unsupported image format + elseif not has_image or not has_support or step == 1 then + -- If there is an image but user has requested step 1 + -- or type is not supported, then remove it. + if has_image then + nixio.fs.unlink(tmpfile) + end + + luci.template.render("admin/upgrade", { + step=1, + bad_image=(has_image and not has_support or false), + keepavail=keep_avail, + supported=has_platform + } ) + + -- Step 2: present uploaded file, show checksum, confirmation + elseif step == 2 then + luci.template.render("admin/upgrade", { + step=2, + checksum=image_checksum(), + filesize=nixio.fs.stat(tmpfile).size, + flashsize=storage_size(), + keepconfig=(keep_avail and luci.http.formvalue("keepcfg") == "1") + } ) + + -- Step 3: load iframe which calls the actual flash procedure + elseif step == 3 then + luci.template.render("admin/upgrade", { + step=3, + keepconfig=(keep_avail and luci.http.formvalue("keepcfg") == "1") + } ) + end +end + +function _keep_pattern() + local kpattern = "" + local files = luci.model.uci.cursor():get_all("luci", "flash_keep") + if files then + kpattern = "" + for k, v in pairs(files) do + if k:sub(1,1) ~= "." and nixio.fs.glob(v)() then + kpattern = kpattern .. " " .. v + end + end + end + return kpattern +end + +function ltn12_popen(command) + + local fdi, fdo = nixio.pipe() + local pid = nixio.fork() + + if pid > 0 then + fdo:close() + local close + return function() + local buffer = fdi:read(2048) + local wpid, stat = nixio.waitpid(pid, "nohang") + if not close and wpid and stat == "exited" then + close = true + end + + if buffer and #buffer > 0 then + return buffer + elseif close then + fdi:close() + return nil + end + end + elseif pid == 0 then + nixio.dup(fdo, nixio.stdout) + fdi:close() + fdo:close() + nixio.exec("/bin/sh", "-c", command) + end +end diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/index.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/index.lua new file mode 100644 index 00000000..cd057248 --- /dev/null +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/index.lua @@ -0,0 +1,14 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2008 Steven Barth + +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$ +]]-- +return Template("admin/index") diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/passwd.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/passwd.lua new file mode 100644 index 00000000..5b9efc4d --- /dev/null +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/passwd.lua @@ -0,0 +1,45 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +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$ +]]-- +f = SimpleForm("password", translate("Admin Password"), translate("Change the password of the system administrator (User root)")) + +pw1 = f:field(Value, "pw1", translate("Password")) +pw1.password = true +pw1.rmempty = false + +pw2 = f:field(Value, "pw2", translate("Confirmation")) +pw2.password = true +pw2.rmempty = false + +function pw2.validate(self, value, section) + return pw1:formvalue(section) == value and value +end + +function f.handle(self, state, data) + if state == FORM_VALID then + local stat = luci.sys.user.setpasswd("root", data.pw1) == 0 + + if stat then + f.message = translate("Password successfully changed") + else + f.errmessage = translate("Unknown Error") + end + + data.pw1 = nil + data.pw2 = nil + end + return true +end + +return f diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/applyreboot.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/applyreboot.htm new file mode 100644 index 00000000..8ff7118c --- /dev/null +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/applyreboot.htm @@ -0,0 +1,21 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +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$ + +-%> +<%+header%> +

<%:System%>

+
+

<% if msg then %><%=msg%><% else %><%:Changes applied.%><% end %>

+

<%:Please wait: Device rebooting...%>

+ +<%+footer%> \ No newline at end of file diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/backup.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/backup.htm new file mode 100644 index 00000000..eb9dc46e --- /dev/null +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/backup.htm @@ -0,0 +1,40 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +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$ + +-%> +<%+header%> +

<%:System%>

+

<%:Backup / Restore%>

+

<%:Here you can backup and restore your configuration and - if possible - reset this device to the default settings.%>

+
+
+ +
+ +
+ +
+
<%:Backup Archive%>:
+
+ +
+
+ +
+
+<%+footer%> diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/index.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/index.htm new file mode 100644 index 00000000..c14d3b0b --- /dev/null +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/index.htm @@ -0,0 +1,21 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +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$ + +-%> +

<%:Hello!%>

+

<%_This is the administration area of LuCI.%>

+

<%_LuCI is a free, flexible, and user friendly graphical interface for configuring OpenWrt.%>
+<%:On the following pages you can adjust all important settings of this device.%>

+

<%:As we always want to improve this interface we are looking forward to your feedback and suggestions.%>

+

<%:And now have fun with your OpenWrt device!%>

+

<%_The LuCI Team%>

diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm new file mode 100644 index 00000000..9e57d89f --- /dev/null +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm @@ -0,0 +1,33 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +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$ + +-%> +<%+header%> +

<%:System%>

+

<%:Reboot%>

+

<%:Reboots the operating system of your device%>

+<%- +local c = require("luci.model.uci").cursor():changes() +if c and next(c) then +-%> +

<%:Warning: There are unsaved changes that will be lost while rebooting!%>

+<%- +end +if not reboot then +-%> +

<%:Perform reboot%>

+<%- else -%> +

<%:Please wait: Device rebooting...%>

+ +<%- end -%> +<%+footer%> \ No newline at end of file diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm new file mode 100644 index 00000000..1083a161 --- /dev/null +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm @@ -0,0 +1,105 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008-2009 Jo-Philipp Wich + +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$ + +-%> + +<%+header%> + +

<%:System%>

+

<%:Flash Firmware%>

+ +<% if step == 1 then %> + <% if supported then %> +
+

+ <%:Upload an OpenWrt image file to reflash the device.%> + <% if bad_image then %> +

+

<%:The uploaded image file does not + contain a supported format. Make sure that you choose the generic + image format for your platform. %>
+ <% end %> +

+
+ <%:Firmware image%>:
+ + +
+
+ <% if keepavail then -%> + + <%:Keep configuration files%> + <% end -%> + +
+ +
+
+ <% else %> +
<%_ Sorry. + OpenWrt does not support a system upgrade on this platform.
+ You need to manually flash your device. %>
+ <% end %> +<% elseif step == 2 then %> +

+ <%_ The flash image was uploaded. + Below is the checksum and file size listed, + compare them with the original file to ensure data integrity.
+ Click "Proceed" below to start the flash procedure. %> + + <% if flashsize > 0 and filesize > flashsize then %> +

+

<%:It appears that you try to + flash an image that does not fit into the flash memory, please verify + the image file! %>
+ <% end %> + +
+
    +
  • <%:Checksum%>: <%=checksum%>
  • +
  • <%:Size%>: <% + local w = require "luci.tools.webadmin" + write(w.byte_format(filesize)) + + if flashsize > 0 then + write(luci.i18n.translatef( + " (%s available)", + w.byte_format(flashsize) + )) + end + %>
  • +
+

+
+
+ + " /> + +
+
+ + " /> + +
+
+<% elseif step == 3 then %> +

<%_ The system is flashing now.
+ DO NOT POWER OFF THE DEVICE!
+ Wait a few minutes until you try to reconnect. + It might be necessary to renew the address of your computer to reach the device + again, depending on your settings. %>

+ + +<% end %> +<%+footer%> + From c3fcb81a4b73b12321703e75dd32e60a327c6b33 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Mon, 30 Sep 2013 21:37:40 +0200 Subject: [PATCH 080/453] ssh keys --- .../lib/lua/luci/controller/admin/system.lua | 2 +- .../lib/lua/luci/model/cbi/admin/passwd.lua | 86 ++++++++++++++----- 2 files changed, 64 insertions(+), 24 deletions(-) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua index cb0152c2..457f1dde 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua @@ -16,7 +16,7 @@ $Id$ module("luci.controller.admin.system", package.seeall) function index() - entry({"admin", "passwd"}, form("admin/passwd"), _("Admin Password"), 10) + entry({"admin", "passwd"}, cbi("admin/passwd"), _("Admin Password"), 10) entry({"admin", "backup"}, call("action_backup"), _("Backup / Restore"), 80) entry({"admin", "upgrade"}, call("action_upgrade"), _("Flash Firmware"), 90) entry({"admin", "reboot"}, call("action_reboot"), _("Reboot"), 100) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/passwd.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/passwd.lua index 5b9efc4d..9f1ba873 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/passwd.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/passwd.lua @@ -2,7 +2,8 @@ LuCI - Lua Configuration Interface Copyright 2008 Steven Barth -Copyright 2008 Jo-Philipp Wich +Copyright 2011 Jo-Philipp Wich +Copyright 2013 Nils Schneider Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -12,34 +13,73 @@ You may obtain a copy of the License at $Id$ ]]-- -f = SimpleForm("password", translate("Admin Password"), translate("Change the password of the system administrator (User root)")) -pw1 = f:field(Value, "pw1", translate("Password")) +local fs = require "nixio.fs" + +local m, s, pw1, pw2 + +m = Map("system", "Passwort & SSH Keys") + +s = m:section(TypedSection, translate("Router Password"), + translate("Changes the administrator password for accessing the device")) + +s.addremove = false +s.anonymous = true + +pw1 = s:option(Value, "pw1", translate("Password")) pw1.password = true -pw1.rmempty = false -pw2 = f:field(Value, "pw2", translate("Confirmation")) +pw2 = s:option(Value, "pw2", translate("Confirmation")) pw2.password = true -pw2.rmempty = false -function pw2.validate(self, value, section) - return pw1:formvalue(section) == value and value +function s.cfgsections() + return { "_pass" } end -function f.handle(self, state, data) - if state == FORM_VALID then - local stat = luci.sys.user.setpasswd("root", data.pw1) == 0 - - if stat then - f.message = translate("Password successfully changed") - else - f.errmessage = translate("Unknown Error") - end - - data.pw1 = nil - data.pw2 = nil - end - return true +function m.on_commit(map) + local v1 = pw1:formvalue("_pass") + local v2 = pw2:formvalue("_pass") + + if v1 and v2 and #v1 > 0 and #v2 > 0 then + if v1 == v2 then + if luci.sys.user.setpasswd(luci.dispatcher.context.authuser, v1) == 0 then + m.message = translate("Password successfully changed!") + else + m.message = translate("Unknown Error, password not changed!") + end + else + m.message = translate("Given password confirmation did not match, password not changed!") + end + end end -return f +if fs.access("/etc/config/dropbear") then + s = m:section(TypedSection, "_keys", "SSH Keys", + translate("Here you can paste public SSH-Keys (one per line) for SSH public-key authentication.")) + + s.addremove = false + s.anonymous = true + + function s.cfgsections() + return { "_keys" } + end + + local keys + + keys = s:option(TextValue, "_data", "") + keys.wrap = "off" + keys.rows = 3 + keys.rmempty = false + + function keys.cfgvalue() + return fs.readfile("/etc/dropbear/authorized_keys") or "" + end + + function keys.write(self, section, value) + if value then + fs.writefile("/etc/dropbear/authorized_keys", value:gsub("\r\n", "\n")) + end + end +end + +return m From 0b57802354cc8ae607d21bb5cf3a26a068a8bd9c Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Thu, 3 Oct 2013 23:09:38 +0200 Subject: [PATCH 081/453] configmode -> gluon-config-mode --- .../files/usr/lib/lua/luci/controller/admin/index.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua index 7fbd1170..8e91fd6d 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua @@ -17,7 +17,7 @@ module("luci.controller.admin.index", package.seeall) function index() local uci_state = luci.model.uci.cursor_state() - local configmode = uci_state:get_first("configmode", "wizard", "running", "0") == "1" + local configmode = uci_state:get_first("gluon-config-mode", "wizard", "running", "0") == "1" local root = node() if not root.lock then From c03843eac17deae1d16ed385685b171aff80b423 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Thu, 28 Nov 2013 21:49:34 +0100 Subject: [PATCH 082/453] gluon-luci-autoupdater: simple luci module for autoupdater --- package/gluon-luci-autoupdater/Makefile | 39 +++++++++++++++++++ .../lua/luci/controller/admin/autoupdater.lua | 20 ++++++++++ .../lua/luci/model/cbi/admin/autoupdater.lua | 35 +++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 package/gluon-luci-autoupdater/Makefile create mode 100644 package/gluon-luci-autoupdater/files/usr/lib/lua/luci/controller/admin/autoupdater.lua create mode 100644 package/gluon-luci-autoupdater/files/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua diff --git a/package/gluon-luci-autoupdater/Makefile b/package/gluon-luci-autoupdater/Makefile new file mode 100644 index 00000000..518bd6df --- /dev/null +++ b/package/gluon-luci-autoupdater/Makefile @@ -0,0 +1,39 @@ +# Copyright (C) 2013 Nils Schneider +# This is free software, licensed under the Apache 2.0 license. + +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-luci-autoupdater +PKG_VERSION:=0.1 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-luci-autoupdater + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Luci module for gluon-autoupdater + DEPENDS:=+gluon-luci-admin +gluon-autoupdater +endef + +define Package/gluon-luci-autoupdater/description + Luci module for gluon-autoupdater +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-luci-autoupdater/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-luci-autoupdater)) diff --git a/package/gluon-luci-autoupdater/files/usr/lib/lua/luci/controller/admin/autoupdater.lua b/package/gluon-luci-autoupdater/files/usr/lib/lua/luci/controller/admin/autoupdater.lua new file mode 100644 index 00000000..9e6fd79f --- /dev/null +++ b/package/gluon-luci-autoupdater/files/usr/lib/lua/luci/controller/admin/autoupdater.lua @@ -0,0 +1,20 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2013 Nils Schneider + +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.admin.autoupdater", package.seeall) + +function index() + entry({"admin", "autoupdater"}, cbi("admin/autoupdater"), _("Autoupdater"), 20) +end + diff --git a/package/gluon-luci-autoupdater/files/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua b/package/gluon-luci-autoupdater/files/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua new file mode 100644 index 00000000..0fbc85d7 --- /dev/null +++ b/package/gluon-luci-autoupdater/files/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua @@ -0,0 +1,35 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2013 Nils Schneider + +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$ +]]-- + +m = Map("autoupdater", "Autoupdater") + +s = m:section(TypedSection, "autoupdater", "Einstelleungen") +s.addremove = false + +s:option(Flag, "enabled", "Aktivieren") +f = s:option(ListValue, "branch", "Branch") + +uci.cursor():foreach("autoupdater", "branch", function (section) f:value(section[".name"]) end) + +s = m:section(TypedSection, "branch", "Branches") +s.addremove = true + +s:option(Value, "url", "URL") +s:option(Value, "probability", "Update Wahrscheinlichkeit") +s:option(Value, "good_signatures", "Benötigte Signaturen") + +o = s:option(DynamicList, "pubkey", "Public Keys") + +return m + From 1be0a7667f561472a686c831009bf9d79d653558 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 4 Jan 2014 09:19:13 +0100 Subject: [PATCH 083/453] Make package version depend on the site config version where necessary --- package/gluon-autoupdater/Makefile | 2 +- package/gluon-config-mode/Makefile | 4 ++-- package/gluon-core/Makefile | 4 ++-- package/gluon-cron/Makefile | 2 +- package/gluon-ebtables/Makefile | 2 +- package/gluon-location/Makefile | 2 +- package/gluon-mesh-batman-adv/Makefile | 4 ++-- package/gluon-mesh-vpn-fastd/Makefile | 4 ++-- package/gluon-next-node/Makefile | 4 ++-- package/gluon-release/Makefile | 2 +- package/gluon-simple-tc/Makefile | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package/gluon-autoupdater/Makefile b/package/gluon-autoupdater/Makefile index fd971492..d856851f 100644 --- a/package/gluon-autoupdater/Makefile +++ b/package/gluon-autoupdater/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-autoupdater PKG_VERSION:=0.1 -PKG_RELEASE:=1 +PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/package/gluon-config-mode/Makefile b/package/gluon-config-mode/Makefile index 75babcdd..1ce36ae0 100644 --- a/package/gluon-config-mode/Makefile +++ b/package/gluon-config-mode/Makefile @@ -4,8 +4,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-config-mode -PKG_VERSION:=0.3.2.99 -PKG_RELEASE:=2 +PKG_VERSION:=1 +PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/package/gluon-core/Makefile b/package/gluon-core/Makefile index 2e0ce851..a9483a0d 100644 --- a/package/gluon-core/Makefile +++ b/package/gluon-core/Makefile @@ -1,8 +1,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-core -PKG_VERSION:=0.3.2.99 -PKG_RELEASE:=1 +PKG_VERSION:=1 +PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/package/gluon-cron/Makefile b/package/gluon-cron/Makefile index 70321181..ac92a92d 100644 --- a/package/gluon-cron/Makefile +++ b/package/gluon-cron/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-cron -PKG_VERSION:=0.3.2.99 +PKG_VERSION:=1 PKG_RELEASE:=1 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/package/gluon-ebtables/Makefile b/package/gluon-ebtables/Makefile index 051b374b..39c654c1 100644 --- a/package/gluon-ebtables/Makefile +++ b/package/gluon-ebtables/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-ebtables -PKG_VERSION:=0.3.2.99 +PKG_VERSION:=1 PKG_RELEASE:=1 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/package/gluon-location/Makefile b/package/gluon-location/Makefile index d9cdf3eb..7f1feb62 100644 --- a/package/gluon-location/Makefile +++ b/package/gluon-location/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-location PKG_VERSION:=1 -PKG_location:=1 +PKG_RELEASE:=1 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/package/gluon-mesh-batman-adv/Makefile b/package/gluon-mesh-batman-adv/Makefile index 708c7c4a..2e99dfa0 100644 --- a/package/gluon-mesh-batman-adv/Makefile +++ b/package/gluon-mesh-batman-adv/Makefile @@ -1,8 +1,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-mesh-batman-adv -PKG_VERSION:=0.3.2.99 -PKG_RELEASE:=1 +PKG_VERSION:=1 +PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/package/gluon-mesh-vpn-fastd/Makefile b/package/gluon-mesh-vpn-fastd/Makefile index 515cbcb3..52618816 100644 --- a/package/gluon-mesh-vpn-fastd/Makefile +++ b/package/gluon-mesh-vpn-fastd/Makefile @@ -1,8 +1,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-mesh-vpn-fastd -PKG_VERSION:=0.3.2.99 -PKG_RELEASE:=1 +PKG_VERSION:=1 +PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/package/gluon-next-node/Makefile b/package/gluon-next-node/Makefile index ec145839..4a064988 100644 --- a/package/gluon-next-node/Makefile +++ b/package/gluon-next-node/Makefile @@ -1,8 +1,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-next-node -PKG_VERSION:=0.3.2.99 -PKG_RELEASE:=1 +PKG_VERSION:=1 +PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/package/gluon-release/Makefile b/package/gluon-release/Makefile index 1d72f737..0eaa181c 100644 --- a/package/gluon-release/Makefile +++ b/package/gluon-release/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-release PKG_VERSION:=1 -PKG_RELEASE:=1 +PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/package/gluon-simple-tc/Makefile b/package/gluon-simple-tc/Makefile index 9c194f90..0a5847a1 100644 --- a/package/gluon-simple-tc/Makefile +++ b/package/gluon-simple-tc/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-simple-tc PKG_VERSION:=1 -PKG_RELEASE:=1 +PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) From 6c952a513a769d5403d1daa59d249d07ac804f7d Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 9 Jan 2014 09:58:59 +0100 Subject: [PATCH 084/453] Add gluon-lock-password package and make config mode depend on it --- package/gluon-config-mode/Makefile | 2 +- package/gluon-lock-password/Makefile | 36 +++++++++++++++++++ .../lock-password/initial/010-lock-password | 3 ++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 package/gluon-lock-password/Makefile create mode 100755 package/gluon-lock-password/files/lib/gluon/upgrade/lock-password/initial/010-lock-password diff --git a/package/gluon-config-mode/Makefile b/package/gluon-config-mode/Makefile index 1ce36ae0..8a1ad5b8 100644 --- a/package/gluon-config-mode/Makefile +++ b/package/gluon-config-mode/Makefile @@ -15,7 +15,7 @@ define Package/gluon-config-mode SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci based config mode for user friendly setup of new meshnodes - DEPENDS:=+gluon-core +gluon-location +gluon-simple-tc +uhttpd +dnsmasq +luci-mod-admin-core +ip +luci-theme-openwrt +haveged + DEPENDS:=+gluon-core +gluon-lock-password +gluon-location +gluon-simple-tc +uhttpd +dnsmasq +luci-mod-admin-core +ip +luci-theme-openwrt +haveged endef define Package/gluon-config-mode/description diff --git a/package/gluon-lock-password/Makefile b/package/gluon-lock-password/Makefile new file mode 100644 index 00000000..d0e99373 --- /dev/null +++ b/package/gluon-lock-password/Makefile @@ -0,0 +1,36 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-lock-password +PKG_VERSION:=1 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-lock-password + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Locks the root account by default + DEPENDS:=+gluon-core +endef + +define Package/gluon-lock-password/description + This packages locks the root account by default. +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-lock-password/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-lock-password)) diff --git a/package/gluon-lock-password/files/lib/gluon/upgrade/lock-password/initial/010-lock-password b/package/gluon-lock-password/files/lib/gluon/upgrade/lock-password/initial/010-lock-password new file mode 100755 index 00000000..6e67fc4c --- /dev/null +++ b/package/gluon-lock-password/files/lib/gluon/upgrade/lock-password/initial/010-lock-password @@ -0,0 +1,3 @@ +#!/bin/sh + +passwd -l root From 9015c01c34c0f7d99718206957181b22de124e60 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 9 Jan 2014 10:06:36 +0100 Subject: [PATCH 085/453] Allow telnet login in config mode again --- package/gluon-config-mode/files/etc/init.d/gluon-config-mode | 3 ++- .../gluon-config-mode/files/lib/gluon/config-mode/ash-login | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100755 package/gluon-config-mode/files/lib/gluon/config-mode/ash-login diff --git a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode index ca72a580..b4f6c27e 100755 --- a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode +++ b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode @@ -32,8 +32,9 @@ start() { ip addr add $config_mode_addr/$config_mode_plen dev $config_mode_iface ip link set up dev $config_mode_iface + /usr/sbin/telnetd -l /lib/gluon/config-mode/ash-login + /etc/init.d/haveged start - /etc/init.d/telnet start /etc/init.d/dropbear start /etc/init.d/uhttpd start /etc/init.d/led start diff --git a/package/gluon-config-mode/files/lib/gluon/config-mode/ash-login b/package/gluon-config-mode/files/lib/gluon/config-mode/ash-login new file mode 100755 index 00000000..3349c444 --- /dev/null +++ b/package/gluon-config-mode/files/lib/gluon/config-mode/ash-login @@ -0,0 +1,3 @@ +#!/bin/sh + +exec /bin/ash --login From f8cdeaefd9f2277ac8e4f66adf252d6b4034edd0 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 10 Jan 2014 21:48:43 +0100 Subject: [PATCH 086/453] Add ebtables filters from the legacy firmware --- .../gluon-ebtables-filter-multicast/Makefile | 40 +++++++++++++++++++ .../files/lib/gluon/ebtables/100-mcast-chain | 1 + .../lib/gluon/ebtables/110-mcast-allow-arp | 1 + .../lib/gluon/ebtables/110-mcast-allow-babel | 1 + .../lib/gluon/ebtables/110-mcast-allow-btlpd | 1 + .../lib/gluon/ebtables/110-mcast-allow-dhcpv4 | 1 + .../lib/gluon/ebtables/110-mcast-allow-dhcpv6 | 1 + .../lib/gluon/ebtables/110-mcast-allow-icmp | 1 + .../lib/gluon/ebtables/110-mcast-allow-icmpv6 | 1 + .../lib/gluon/ebtables/110-mcast-allow-igmp | 1 + .../lib/gluon/ebtables/110-mcast-allow-ospf | 2 + .../files/lib/gluon/ebtables/300-mcast | 2 + .../gluon-ebtables-filter-ra-dhcp/Makefile | 39 ++++++++++++++++++ .../files/lib/gluon/ebtables/200-dir-dhcpv4 | 5 +++ .../files/lib/gluon/ebtables/200-dir-dhcpv6 | 5 +++ .../files/lib/gluon/ebtables/200-dir-radv | 5 +++ .../files/lib/gluon/ebtables/.keep | 0 .../files/lib/gluon/ebtables/100-dir-chain | 2 + .../files/lib/gluon/ebtables/101-dir-rules | 2 + 19 files changed, 111 insertions(+) create mode 100644 package/gluon-ebtables-filter-multicast/Makefile create mode 100644 package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/100-mcast-chain create mode 100644 package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-arp create mode 100644 package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-babel create mode 100644 package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-btlpd create mode 100644 package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-dhcpv4 create mode 100644 package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-dhcpv6 create mode 100644 package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmp create mode 100644 package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 create mode 100644 package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-igmp create mode 100644 package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-ospf create mode 100644 package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/300-mcast create mode 100644 package/gluon-ebtables-filter-ra-dhcp/Makefile create mode 100644 package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-dhcpv4 create mode 100644 package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-dhcpv6 create mode 100644 package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-radv delete mode 100644 package/gluon-ebtables/files/lib/gluon/ebtables/.keep create mode 100644 package/gluon-ebtables/files/lib/gluon/ebtables/100-dir-chain create mode 100644 package/gluon-ebtables/files/lib/gluon/ebtables/101-dir-rules diff --git a/package/gluon-ebtables-filter-multicast/Makefile b/package/gluon-ebtables-filter-multicast/Makefile new file mode 100644 index 00000000..93b7f9a5 --- /dev/null +++ b/package/gluon-ebtables-filter-multicast/Makefile @@ -0,0 +1,40 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-ebtables-filter-multicast +PKG_VERSION:=1 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-ebtables-filter-multicast + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Ebtables filters for multicast packets + DEPENDS:=+gluon-core +gluon-ebtables +endef + +define Package/gluon-ebtables-filter-multicast/description + Gluon community wifi mesh firmware framework: Ebtables filters for multicast packets + + These filters drop non-essential multicast traffic before it enters the mesh. + + Allowed protocols are: DHCP, DHCPv6, ARP, ICMP, ICMPv6, BitTorrent local peer discovery, BABEL and OSPF +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-ebtables-filter-multicast/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-ebtables-filter-multicast)) diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/100-mcast-chain b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/100-mcast-chain new file mode 100644 index 00000000..93382f30 --- /dev/null +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/100-mcast-chain @@ -0,0 +1 @@ +chain MULTICAST_OUT DROP diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-arp b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-arp new file mode 100644 index 00000000..fdb20b1f --- /dev/null +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-arp @@ -0,0 +1 @@ +rule MULTICAST_OUT -p ARP -j RETURN diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-babel b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-babel new file mode 100644 index 00000000..096ae50e --- /dev/null +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-babel @@ -0,0 +1 @@ +rule MULTICAST_OUT -p IPv6 --ip6-protocol udp --ip6-destination-port 6696 -j RETURN diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-btlpd b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-btlpd new file mode 100644 index 00000000..9776157a --- /dev/null +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-btlpd @@ -0,0 +1 @@ +rule MULTICAST_OUT -p IPv4 --ip-destination 239.192.152.143 --ip-protocol udp --ip-destination-port 6771 -j RETURN diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-dhcpv4 b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-dhcpv4 new file mode 100644 index 00000000..440107a9 --- /dev/null +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-dhcpv4 @@ -0,0 +1 @@ +rule MULTICAST_OUT -p IPv4 --ip-protocol udp --ip-destination-port 67 -j RETURN diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-dhcpv6 b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-dhcpv6 new file mode 100644 index 00000000..1b523ec4 --- /dev/null +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-dhcpv6 @@ -0,0 +1 @@ +rule MULTICAST_OUT -p IPv6 --ip6-protocol udp --ip6-destination-port 546 -j RETURN diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmp b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmp new file mode 100644 index 00000000..e52e5c78 --- /dev/null +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmp @@ -0,0 +1 @@ +rule MULTICAST_OUT -p IPv4 --ip-protocol icmp -j RETURN diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 new file mode 100644 index 00000000..7c50ff5e --- /dev/null +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 @@ -0,0 +1 @@ +rule MULTICAST_OUT -p IPv6 --ip6-protocol ipv6-icmp -j RETURN diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-igmp b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-igmp new file mode 100644 index 00000000..521af563 --- /dev/null +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-igmp @@ -0,0 +1 @@ +rule MULTICAST_OUT -p IPv4 --ip-protocol igmp -j RETURN diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-ospf b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-ospf new file mode 100644 index 00000000..6e540751 --- /dev/null +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-ospf @@ -0,0 +1,2 @@ +rule MULTICAST_OUT -p IPv4 --ip-protocol ospf -j RETURN +rule MULTICAST_OUT -p IPv6 --ip6-protocol ospf -j RETURN diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/300-mcast b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/300-mcast new file mode 100644 index 00000000..00ff642c --- /dev/null +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/300-mcast @@ -0,0 +1,2 @@ +rule FORWARD --logical-out br-freifunk -o bat0 -d Multicast -j MULTICAST_OUT +rule OUTPUT --logical-out br-freifunk -o bat0 -d Multicast -j MULTICAST_OUT diff --git a/package/gluon-ebtables-filter-ra-dhcp/Makefile b/package/gluon-ebtables-filter-ra-dhcp/Makefile new file mode 100644 index 00000000..ea6a737d --- /dev/null +++ b/package/gluon-ebtables-filter-ra-dhcp/Makefile @@ -0,0 +1,39 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-ebtables-filter-ra-dhcp +PKG_VERSION:=1 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-ebtables-filter-ra-dhcp + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Ebtables filters for Router Advertisement and DHCP packets + DEPENDS:=+gluon-core +gluon-ebtables +endef + +define Package/gluon-ebtables-filter-ra-dhcp/description + Gluon community wifi mesh firmware framework: Ebtables filters for Router Advertisement and DHCP packets + + These filters ensure that RA and DHCP packets are only forwarded from the mesh into the + client network, and not vice-versa. +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-ebtables-filter-ra-dhcp/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-ebtables-filter-ra-dhcp)) diff --git a/package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-dhcpv4 b/package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-dhcpv4 new file mode 100644 index 00000000..8771ee15 --- /dev/null +++ b/package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-dhcpv4 @@ -0,0 +1,5 @@ +rule FORWARD -p IPv4 --ip-protocol udp --ip-destination-port 67 -j OUT_ONLY +rule OUTPUT -p IPv4 --ip-protocol udp --ip-destination-port 67 -j OUT_ONLY + +rule FORWARD -p IPv4 --ip-protocol udp --ip-destination-port 68 -j IN_ONLY +rule INPUT -p IPv4 --ip-protocol udp --ip-destination-port 68 -j IN_ONLY diff --git a/package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-dhcpv6 b/package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-dhcpv6 new file mode 100644 index 00000000..234e54e5 --- /dev/null +++ b/package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-dhcpv6 @@ -0,0 +1,5 @@ +rule FORWARD -p IPv6 --ip6-protocol udp --ip6-destination-port 546 -j OUT_ONLY +rule OUTPUT -p IPv6 --ip6-protocol udp --ip6-destination-port 546 -j OUT_ONLY + +rule FORWARD -p IPv6 --ip6-protocol udp --ip6-destination-port 547 -j IN_ONLY +rule INPUT -p IPv6 --ip6-protocol udp --ip6-destination-port 547 -j IN_ONLY diff --git a/package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-radv b/package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-radv new file mode 100644 index 00000000..c7257032 --- /dev/null +++ b/package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-radv @@ -0,0 +1,5 @@ +rule FORWARD -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type router-solicitation -j OUT_ONLY +rule OUTPUT -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type router-solicitation -j OUT_ONLY + +rule FORWARD -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type router-advertisement -j IN_ONLY +rule INPUT -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type router-advertisement -j IN_ONLY diff --git a/package/gluon-ebtables/files/lib/gluon/ebtables/.keep b/package/gluon-ebtables/files/lib/gluon/ebtables/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/package/gluon-ebtables/files/lib/gluon/ebtables/100-dir-chain b/package/gluon-ebtables/files/lib/gluon/ebtables/100-dir-chain new file mode 100644 index 00000000..99908dc4 --- /dev/null +++ b/package/gluon-ebtables/files/lib/gluon/ebtables/100-dir-chain @@ -0,0 +1,2 @@ +chain IN_ONLY RETURN +chain OUT_ONLY RETURN diff --git a/package/gluon-ebtables/files/lib/gluon/ebtables/101-dir-rules b/package/gluon-ebtables/files/lib/gluon/ebtables/101-dir-rules new file mode 100644 index 00000000..6c8f44cc --- /dev/null +++ b/package/gluon-ebtables/files/lib/gluon/ebtables/101-dir-rules @@ -0,0 +1,2 @@ +rule IN_ONLY --logical-in br-client -i ! bat0 -j DROP +rule OUT_ONLY --logical-out br-client -o ! bat0 -j DROP From 0f5190bc6eab9465f51a18c07e8f7ae9d58e37f1 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 10 Jan 2014 22:33:42 +0100 Subject: [PATCH 087/453] Reimplement next-node configuration based on the new netifd version --- .../generate/etc/init.d/gluon-next-node | 26 ------------- .../upgrade/next-node/invariant/010-next-node | 37 +++++++++++++++++++ 2 files changed, 37 insertions(+), 26 deletions(-) delete mode 100755 package/gluon-next-node/generate/etc/init.d/gluon-next-node create mode 100755 package/gluon-next-node/generate/lib/gluon/upgrade/next-node/invariant/010-next-node diff --git a/package/gluon-next-node/generate/etc/init.d/gluon-next-node b/package/gluon-next-node/generate/etc/init.d/gluon-next-node deleted file mode 100755 index cee7d7b0..00000000 --- a/package/gluon-next-node/generate/etc/init.d/gluon-next-node +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2013 Project Gluon - -START=95 - - -start() { - ip link add link br-client name local-node type macvlan - echo 0 > /proc/sys/net/ipv6/conf/local-node/accept_ra - ip link set local-node address @next_node.mac@ - - ip address add @next_node.ip4@/32 dev local-node - ip route add @prefix4@ dev br-client - - ip address add @next_node.ip6@/128 dev local-node - ip route add @prefix6@ dev br-client - - ip link set local-node up -} - -stop() { - ip route del @prefix4@ dev br-client - ip route del @prefix6@ dev br-client - ip link set local-node down - ip link del local-node -} diff --git a/package/gluon-next-node/generate/lib/gluon/upgrade/next-node/invariant/010-next-node b/package/gluon-next-node/generate/lib/gluon/upgrade/next-node/invariant/010-next-node new file mode 100755 index 00000000..5cfd9ee1 --- /dev/null +++ b/package/gluon-next-node/generate/lib/gluon/upgrade/next-node/invariant/010-next-node @@ -0,0 +1,37 @@ +#!/bin/sh + +. /lib/functions.sh +. /lib/gluon/functions/sysconfig.sh + + +uci_remove network local_node +uci_add network device local_node +uci_set network local_node name 'local-node' +uci_set network local_node ifname '@client' +uci_set network local_node type 'macvlan' +uci_set network local_node macaddr '@next_node.mac@' + +uci_remove network local_node_if +uci_add network interface local_node_if +uci_set network local_node_if ifname 'local-node' +uci_set network local_node_if proto 'static' +uci_set network local_node_if ipaddr '@next_node.ip4@' +uci_set network local_node_if netmask '255.255.255.255' +uci_set network local_node_if ip6addr '@next_node.ip6@/128' + +eval $(ipcalc.sh '@prefix4@') + +uci_remove network local_node_route4 +uci_add network route local_node_route4 +uci_set network local_node_route4 interface 'client' +uci_set network local_node_route4 target "$IP" +uci_set network local_node_route4 netmask "$NETMASK" +uci_set network local_node_route4 gateway '0.0.0.0' + +uci_remove network local_node_route6 +uci_add network route6 local_node_route6 +uci_set network local_node_route6 interface 'client' +uci_set network local_node_route6 target '@prefix6@' +uci_set network local_node_route6 gateway '::' + +uci_commit network From bcb66033337a6a52c6406fcde6b2bb057be54663 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 11 Jan 2014 14:01:23 +0100 Subject: [PATCH 088/453] Disable IPv6 forwarding on br-client Disabling forwarding prevents the node from reacting to the Subnet-Router anycast address. --- .../files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh index c247ea92..b64a23ba 100755 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh @@ -18,3 +18,5 @@ uci_set network client peerdns '0' uci_set network client macaddr "$(sysconfig primary_mac)" uci_commit network + +echo 'net.ipv6.conf.br-client.forwarding=0' >> /etc/sysctl.conf From c14f32305894d35d75150b791d8b44a4d9730369 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 11 Jan 2014 14:11:42 +0100 Subject: [PATCH 089/453] next-node: remove unused include --- .../generate/lib/gluon/upgrade/next-node/invariant/010-next-node | 1 - 1 file changed, 1 deletion(-) diff --git a/package/gluon-next-node/generate/lib/gluon/upgrade/next-node/invariant/010-next-node b/package/gluon-next-node/generate/lib/gluon/upgrade/next-node/invariant/010-next-node index 5cfd9ee1..70c76b28 100755 --- a/package/gluon-next-node/generate/lib/gluon/upgrade/next-node/invariant/010-next-node +++ b/package/gluon-next-node/generate/lib/gluon/upgrade/next-node/invariant/010-next-node @@ -1,7 +1,6 @@ #!/bin/sh . /lib/functions.sh -. /lib/gluon/functions/sysconfig.sh uci_remove network local_node From ccc1330ebb9f13ab99d89ef29ca6933c8d749a05 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 11 Jan 2014 14:23:27 +0100 Subject: [PATCH 090/453] next-node: rename config sections --- .../upgrade/next-node/invariant/010-next-node | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/package/gluon-next-node/generate/lib/gluon/upgrade/next-node/invariant/010-next-node b/package/gluon-next-node/generate/lib/gluon/upgrade/next-node/invariant/010-next-node index 70c76b28..445b6d46 100755 --- a/package/gluon-next-node/generate/lib/gluon/upgrade/next-node/invariant/010-next-node +++ b/package/gluon-next-node/generate/lib/gluon/upgrade/next-node/invariant/010-next-node @@ -3,20 +3,20 @@ . /lib/functions.sh -uci_remove network local_node -uci_add network device local_node -uci_set network local_node name 'local-node' -uci_set network local_node ifname '@client' -uci_set network local_node type 'macvlan' -uci_set network local_node macaddr '@next_node.mac@' +uci_remove network local_node_dev +uci_add network device local_node_dev +uci_set network local_node_dev name 'local-node' +uci_set network local_node_dev ifname '@client' +uci_set network local_node_dev type 'macvlan' +uci_set network local_node_dev macaddr '@next_node.mac@' -uci_remove network local_node_if -uci_add network interface local_node_if -uci_set network local_node_if ifname 'local-node' -uci_set network local_node_if proto 'static' -uci_set network local_node_if ipaddr '@next_node.ip4@' -uci_set network local_node_if netmask '255.255.255.255' -uci_set network local_node_if ip6addr '@next_node.ip6@/128' +uci_remove network local_node +uci_add network interface local_node +uci_set network local_node ifname 'local-node' +uci_set network local_node proto 'static' +uci_set network local_node ipaddr '@next_node.ip4@' +uci_set network local_node netmask '255.255.255.255' +uci_set network local_node ip6addr '@next_node.ip6@/128' eval $(ipcalc.sh '@prefix4@') From df00835f4cdab29bf7df43abff1d9b66cf9b6356 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 11 Jan 2014 16:05:17 +0100 Subject: [PATCH 091/453] Add gluon-radvd package --- package/gluon-radvd/Makefile | 37 +++++++++++++++++++ .../gluon-radvd/files/etc/init.d/gluon-radvd | 14 +++++++ .../generate/lib/gluon/radvd/radvd.conf | 10 +++++ 3 files changed, 61 insertions(+) create mode 100644 package/gluon-radvd/Makefile create mode 100755 package/gluon-radvd/files/etc/init.d/gluon-radvd create mode 100644 package/gluon-radvd/generate/lib/gluon/radvd/radvd.conf diff --git a/package/gluon-radvd/Makefile b/package/gluon-radvd/Makefile new file mode 100644 index 00000000..bb694942 --- /dev/null +++ b/package/gluon-radvd/Makefile @@ -0,0 +1,37 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-radvd +PKG_VERSION:=1 +PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-radvd + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Advertise an IPv6 prefix from the node + DEPENDS:=+gluon-core +gluon-ebtables +gluon-next-node +radvd +endef + +define Package/gluon-radvd/description + Gluon community wifi mesh firmware framework: Advertise an IPv6 prefix from the node +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-radvd/install + $(CP) ./files/* $(1)/ + $(GLUON_GENERATE) ./generate/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-radvd)) diff --git a/package/gluon-radvd/files/etc/init.d/gluon-radvd b/package/gluon-radvd/files/etc/init.d/gluon-radvd new file mode 100755 index 00000000..4064439b --- /dev/null +++ b/package/gluon-radvd/files/etc/init.d/gluon-radvd @@ -0,0 +1,14 @@ +#!/bin/sh /etc/rc.common + +START=50 + +SERVICE_USE_PID=1 +SERVICE_NAME=gluon-radvd + +start() { + service_start /usr/sbin/radvd -C /lib/gluon/radvd/radvd.conf -m stderr_syslog -p /var/run/gluon-radvd.pid +} + +stop() { + service_stop /usr/sbin/radvd +} diff --git a/package/gluon-radvd/generate/lib/gluon/radvd/radvd.conf b/package/gluon-radvd/generate/lib/gluon/radvd/radvd.conf new file mode 100644 index 00000000..1ce7eab3 --- /dev/null +++ b/package/gluon-radvd/generate/lib/gluon/radvd/radvd.conf @@ -0,0 +1,10 @@ +interface local-node +{ + IgnoreIfMissing on; + AdvSendAdvert on; + AdvDefaultLifetime 0; + + prefix @prefix6@ + { + }; +}; From 1b9c8dcc0b2c1aba34c61de617c49ed0e21d7e0d Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 11 Jan 2014 17:43:35 +0100 Subject: [PATCH 092/453] Don't accept router advertisements by default --- .../files/lib/gluon/upgrade/core/initial/011-gluon-network | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network index a82183a8..8220b00e 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network +++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network @@ -26,3 +26,6 @@ tl-wdr4300) # fix up duplicate mac addresses esac uci_commit network + +echo 'net.ipv6.conf.all.accept_ra=0' >> /etc/sysctl.conf +echo 'net.ipv6.conf.default.accept_ra=0' >> /etc/sysctl.conf From f969e3a2b1eeed4bc0ab9ff0a05f63aefb4ed78a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 11 Jan 2014 19:27:06 +0100 Subject: [PATCH 093/453] gluon-ebtables-filter-multicast: correct interface name --- .../files/lib/gluon/ebtables/300-mcast | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/300-mcast b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/300-mcast index 00ff642c..afbc8057 100644 --- a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/300-mcast +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/300-mcast @@ -1,2 +1,2 @@ -rule FORWARD --logical-out br-freifunk -o bat0 -d Multicast -j MULTICAST_OUT -rule OUTPUT --logical-out br-freifunk -o bat0 -d Multicast -j MULTICAST_OUT +rule FORWARD --logical-out br-client -o bat0 -d Multicast -j MULTICAST_OUT +rule OUTPUT --logical-out br-client -o bat0 -d Multicast -j MULTICAST_OUT From a626c9a16500ad47c5993c397eb0729b25ab6130 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 11 Jan 2014 20:34:58 +0100 Subject: [PATCH 094/453] gluon-core: remove left over 'EOF' from config script --- .../files/lib/gluon/upgrade/core/initial/011-gluon-network | 1 - 1 file changed, 1 deletion(-) diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network index 8220b00e..776ae459 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network +++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network @@ -8,7 +8,6 @@ uci_remove network lan uci_set network wan type 'bridge' uci_set network wan proto 'dhcp' -EOF mainaddr=$(sysconfig primary_mac) From a259e771e9e9f15e134665a638f6d330cf6b15cb Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 11 Jan 2014 21:31:28 +0100 Subject: [PATCH 095/453] gluon-core: fixup WAN interface MAC address setting --- .../lib/gluon/upgrade/core/initial/011-gluon-network | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network index 776ae459..400cb40d 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network +++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network @@ -3,6 +3,8 @@ . /lib/functions.sh . /lib/gluon/functions/sysconfig.sh +. /lib/ar71xx.sh + uci_remove network lan @@ -10,14 +12,14 @@ uci_set network wan type 'bridge' uci_set network wan proto 'dhcp' -mainaddr=$(sysconfig primary_mac) -oIFS="$IFS"; IFS=":"; set -- $mainaddr; IFS="$oIFS" -b2mask=0x02 - -case "$board" in +case "$(ar71xx_board_name)" in tl-wr1043nd|\ tl-wdr3600|\ tl-wdr4300) # fix up duplicate mac addresses + local mainaddr=$(sysconfig primary_mac) + local oIFS="$IFS"; IFS=":"; set -- $mainaddr; IFS="$oIFS" + local b2mask=0x02 + local wanaddr=$(printf "%02x:%s:%s:%02x:%s:%02x" $(( 0x$1 | $b2mask )) $2 $3 $(( (0x$4 + 1) % 0x100 )) $5 $(( (0x$6 + 1) % 0x100 )) ) uci_set network wan macaddr "$wanaddr" From f2c8be9c4861fec59272f24a6c9f3a28c11a8037 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 12 Jan 2014 00:50:43 +0100 Subject: [PATCH 096/453] gluon-config-mode: don't depend on haveged Now that haveged starts before the config mode, there is no need to explicity depend on it; instead it is just used when specified in the site configuration. --- package/gluon-config-mode/Makefile | 2 +- package/gluon-config-mode/files/etc/init.d/gluon-config-mode | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/package/gluon-config-mode/Makefile b/package/gluon-config-mode/Makefile index 8a1ad5b8..75a87826 100644 --- a/package/gluon-config-mode/Makefile +++ b/package/gluon-config-mode/Makefile @@ -15,7 +15,7 @@ define Package/gluon-config-mode SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci based config mode for user friendly setup of new meshnodes - DEPENDS:=+gluon-core +gluon-lock-password +gluon-location +gluon-simple-tc +uhttpd +dnsmasq +luci-mod-admin-core +ip +luci-theme-openwrt +haveged + DEPENDS:=+gluon-core +gluon-lock-password +gluon-location +gluon-simple-tc +uhttpd +dnsmasq +luci-mod-admin-core +ip +luci-theme-openwrt endef define Package/gluon-config-mode/description diff --git a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode index b4f6c27e..2ee6af93 100755 --- a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode +++ b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode @@ -34,7 +34,6 @@ start() { /usr/sbin/telnetd -l /lib/gluon/config-mode/ash-login - /etc/init.d/haveged start /etc/init.d/dropbear start /etc/init.d/uhttpd start /etc/init.d/led start From 61171c8c25816dd3b3777a4f50c826c21548a044 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Sun, 12 Jan 2014 21:10:04 +0100 Subject: [PATCH 097/453] gluon-autoupdater: remove dead code Recently the autoupdater contained a case statement to distinguish between TP-Link WDR3600 and TP-Link WDR4300. This was left over from previous development versions of autoupdater that relied on the board name instead of the model. It is thus no longer needed and be removed safely. --- package/gluon-autoupdater/files/usr/sbin/autoupdater | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/package/gluon-autoupdater/files/usr/sbin/autoupdater b/package/gluon-autoupdater/files/usr/sbin/autoupdater index b2f0ce74..c473f271 100755 --- a/package/gluon-autoupdater/files/usr/sbin/autoupdater +++ b/package/gluon-autoupdater/files/usr/sbin/autoupdater @@ -39,16 +39,6 @@ trap cleanup INT TERM EXIT PIPE my_model="$(cat /tmp/sysinfo/model | sed 's/ /-/g' | tr '[A-Z]' '[a-z]')" -case "$my_model" in - "tl-wdr4300") - case "$(tplink_get_hwid)" in - "360000"*) - my_model="tl-wdr3600" - ;; - esac - ;; -esac - if [ ! -f "$VERSION_FILE" ]; then echo "Couldn't determine firmware version!" >&2 exit 1 From a2329773ebf7444436bb75cd951932cdcd5f82bd Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Sun, 12 Jan 2014 21:15:16 +0100 Subject: [PATCH 098/453] gluon-autoupdater: improve manifest.sample Makes manifest.sample use the model instead of the board name as that is what the script actually expects. Also, a sample signature is added. --- package/gluon-autoupdater/manifest.sample | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package/gluon-autoupdater/manifest.sample b/package/gluon-autoupdater/manifest.sample index 0d302ab2..cf47f047 100644 --- a/package/gluon-autoupdater/manifest.sample +++ b/package/gluon-autoupdater/manifest.sample @@ -1,4 +1,6 @@ BRANCH=stable -# board ver md5sum filename -tl-wdr4300 0.4 73e0788596850798d8e02a9ac577d201 sysupgrade-wdr4300.bin +# model ver md5sum filename +tp-link-tl-wdr4300-v1 0.4 73e0788596850798d8e02a9ac577d201 sysupgrade-wdr4300.bin +--- +49030b7b394e0bd204e0faf17f2d2b2756b503c9d682b135deea42b34a09010bff139cbf7513be3f9f8aae126b7f6ff3a7bfe862a798eae9b005d75abbba770a From 13e3d7ff794d53c630040a9fec00beff70522524 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 12 Jan 2014 21:26:48 +0100 Subject: [PATCH 099/453] gluon-core: add sh file to get model name etc. --- .../files/lib/gluon/functions/model.sh | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 package/gluon-core/files/lib/gluon/functions/model.sh diff --git a/package/gluon-core/files/lib/gluon/functions/model.sh b/package/gluon-core/files/lib/gluon/functions/model.sh new file mode 100644 index 00000000..2d2f99ce --- /dev/null +++ b/package/gluon-core/files/lib/gluon/functions/model.sh @@ -0,0 +1,22 @@ +. /lib/functions.sh + +# This must be generalized as soon as we support other OpenWRT archs +. /lib/ar71xx.sh + + +ar71xx_board_detect + +local board_name="$AR71XX_BOARD_NAME" +local model="$AR71XX_MODEL" + +get_arch() { + echo 'ar71xx' +} + +get_board_name() { + echo "$board_name" +} + +get_model() { + echo "$model" +} From 293c64e723818e9f4afd6c57e498a31b565ce221 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 12 Jan 2014 21:40:19 +0100 Subject: [PATCH 100/453] gluon-autoupdater: use the new get_model function --- package/gluon-autoupdater/files/usr/sbin/autoupdater | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/gluon-autoupdater/files/usr/sbin/autoupdater b/package/gluon-autoupdater/files/usr/sbin/autoupdater index c473f271..a012bbce 100755 --- a/package/gluon-autoupdater/files/usr/sbin/autoupdater +++ b/package/gluon-autoupdater/files/usr/sbin/autoupdater @@ -37,7 +37,8 @@ cleanup() { trap cleanup INT TERM EXIT PIPE -my_model="$(cat /tmp/sysinfo/model | sed 's/ /-/g' | tr '[A-Z]' '[a-z]')" +. /lib/gluon/functions/model.sh +my_model="$(get_model | tr '[A-Z]' '[a-z]' | sed -r 's/[^a-z0-9]+/-/g')" if [ ! -f "$VERSION_FILE" ]; then echo "Couldn't determine firmware version!" >&2 From dece1f4122b37fe739cde9c129a177054238201b Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Sun, 12 Jan 2014 19:23:59 +0100 Subject: [PATCH 101/453] added gluon-alfred and gluon-alfred-ffmap --- package/gluon-alfred-ffmap/Makefile | 32 +++++++++++++++++++ .../files/etc/alfred/ffmap.sh | 21 ++++++++++++ package/gluon-alfred/Makefile | 32 +++++++++++++++++++ .../alfred/invariant/010-enable-alfred | 5 +++ 4 files changed, 90 insertions(+) create mode 100644 package/gluon-alfred-ffmap/Makefile create mode 100755 package/gluon-alfred-ffmap/files/etc/alfred/ffmap.sh create mode 100644 package/gluon-alfred/Makefile create mode 100755 package/gluon-alfred/files/lib/gluon/upgrade/alfred/invariant/010-enable-alfred diff --git a/package/gluon-alfred-ffmap/Makefile b/package/gluon-alfred-ffmap/Makefile new file mode 100644 index 00000000..cc3bbc3c --- /dev/null +++ b/package/gluon-alfred-ffmap/Makefile @@ -0,0 +1,32 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-alfred-ffmap +PKG_VERSION:=0.1 +PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-alfred-ffmap + SECTION:=gluon + CATEGORY:=Gluon + DEPENDS:=+gluon-alfred +gluon-location + TITLE:=Distribute data for ffmap via alfred +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-alfred-ffmap/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-alfred-ffmap)) diff --git a/package/gluon-alfred-ffmap/files/etc/alfred/ffmap.sh b/package/gluon-alfred-ffmap/files/etc/alfred/ffmap.sh new file mode 100755 index 00000000..a79addd1 --- /dev/null +++ b/package/gluon-alfred-ffmap/files/etc/alfred/ffmap.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +if [ -f /lib/functions/jshn.sh ]; then + . /lib/functions/jshn.sh +elif [ -f /usr/share/libubox/jshn.sh ]; then + . /usr/share/libubox/jshn.sh +else + echo "Error: jshn.sh not found!" + exit 1 +fi + +[ -z "$ALFRED_DATA_TYPE" ] && ALFRED_DATA_TYPE=158 + +set -e + +json_init +json_add_string "name" "$(uci get 'system.@system[0].hostname')" +if [ "$(uci get 'system.@system[0].share_location')" = 1 ]; then + json_add_string "gps" "$(uci get 'system.@system[0].latitude') $(uci get 'system.@system[0].longitude')" +fi +json_dump | tr -d '\n' | alfred -s "$ALFRED_DATA_TYPE" diff --git a/package/gluon-alfred/Makefile b/package/gluon-alfred/Makefile new file mode 100644 index 00000000..c67d9208 --- /dev/null +++ b/package/gluon-alfred/Makefile @@ -0,0 +1,32 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-alfred +PKG_VERSION:=0.1 +PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-alfred + SECTION:=gluon + CATEGORY:=Gluon + DEPENDS:=+alfred +gluon-cron + TITLE:=Configure alfred +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-alfred/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-alfred)) diff --git a/package/gluon-alfred/files/lib/gluon/upgrade/alfred/invariant/010-enable-alfred b/package/gluon-alfred/files/lib/gluon/upgrade/alfred/invariant/010-enable-alfred new file mode 100755 index 00000000..20ff5df4 --- /dev/null +++ b/package/gluon-alfred/files/lib/gluon/upgrade/alfred/invariant/010-enable-alfred @@ -0,0 +1,5 @@ +#!/bin/sh + +uci set alfred.alfred.interface=br-client +uci set alfred.alfred.mode=slave +uci delete alfred.alfred.disabled From d1f01a588fb6089b29b4243140e2d0c94e995fae Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 12 Jan 2014 22:35:00 +0100 Subject: [PATCH 102/453] Clean up gluon-alfred * Merge gluon-alfred-ffmap into gluon-alfred * Use gluon-crond instead of alfred's "facter" mechanism based on the broken busybox crond --- package/gluon-alfred-ffmap/Makefile | 32 ------------------- package/gluon-alfred/Makefile | 6 ++-- .../files/lib/gluon/alfred/announce.sh} | 5 +-- .../gluon-alfred/files/lib/gluon/cron/alfred | 1 + .../alfred/invariant/010-enable-alfred | 17 ++++++++-- 5 files changed, 21 insertions(+), 40 deletions(-) delete mode 100644 package/gluon-alfred-ffmap/Makefile rename package/{gluon-alfred-ffmap/files/etc/alfred/ffmap.sh => gluon-alfred/files/lib/gluon/alfred/announce.sh} (79%) create mode 100644 package/gluon-alfred/files/lib/gluon/cron/alfred diff --git a/package/gluon-alfred-ffmap/Makefile b/package/gluon-alfred-ffmap/Makefile deleted file mode 100644 index cc3bbc3c..00000000 --- a/package/gluon-alfred-ffmap/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -include $(TOPDIR)/rules.mk - -PKG_NAME:=gluon-alfred-ffmap -PKG_VERSION:=0.1 -PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) - -PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) - -include $(INCLUDE_DIR)/package.mk - -define Package/gluon-alfred-ffmap - SECTION:=gluon - CATEGORY:=Gluon - DEPENDS:=+gluon-alfred +gluon-location - TITLE:=Distribute data for ffmap via alfred -endef - -define Build/Prepare - mkdir -p $(PKG_BUILD_DIR) -endef - -define Build/Configure -endef - -define Build/Compile -endef - -define Package/gluon-alfred-ffmap/install - $(CP) ./files/* $(1)/ -endef - -$(eval $(call BuildPackage,gluon-alfred-ffmap)) diff --git a/package/gluon-alfred/Makefile b/package/gluon-alfred/Makefile index c67d9208..8290ad82 100644 --- a/package/gluon-alfred/Makefile +++ b/package/gluon-alfred/Makefile @@ -1,8 +1,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-alfred -PKG_VERSION:=0.1 -PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) +PKG_VERSION:=1 +PKG_RELEASE:=1 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/package.mk define Package/gluon-alfred SECTION:=gluon CATEGORY:=Gluon - DEPENDS:=+alfred +gluon-cron + DEPENDS:=+gluon-core +gluon-location +gluon-cron +alfred TITLE:=Configure alfred endef diff --git a/package/gluon-alfred-ffmap/files/etc/alfred/ffmap.sh b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh similarity index 79% rename from package/gluon-alfred-ffmap/files/etc/alfred/ffmap.sh rename to package/gluon-alfred/files/lib/gluon/alfred/announce.sh index a79addd1..6b890a78 100755 --- a/package/gluon-alfred-ffmap/files/etc/alfred/ffmap.sh +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh @@ -16,6 +16,7 @@ set -e json_init json_add_string "name" "$(uci get 'system.@system[0].hostname')" if [ "$(uci get 'system.@system[0].share_location')" = 1 ]; then - json_add_string "gps" "$(uci get 'system.@system[0].latitude') $(uci get 'system.@system[0].longitude')" -fi + json_add_string "location" "$(uci get 'system.@system[0].latitude') $(uci get 'system.@system[0].longitude')" +fi + json_dump | tr -d '\n' | alfred -s "$ALFRED_DATA_TYPE" diff --git a/package/gluon-alfred/files/lib/gluon/cron/alfred b/package/gluon-alfred/files/lib/gluon/cron/alfred new file mode 100644 index 00000000..98cc382e --- /dev/null +++ b/package/gluon-alfred/files/lib/gluon/cron/alfred @@ -0,0 +1 @@ +*/5 * * * * /lib/gluon/alfred/announce.sh diff --git a/package/gluon-alfred/files/lib/gluon/upgrade/alfred/invariant/010-enable-alfred b/package/gluon-alfred/files/lib/gluon/upgrade/alfred/invariant/010-enable-alfred index 20ff5df4..755fff3b 100755 --- a/package/gluon-alfred/files/lib/gluon/upgrade/alfred/invariant/010-enable-alfred +++ b/package/gluon-alfred/files/lib/gluon/upgrade/alfred/invariant/010-enable-alfred @@ -1,5 +1,16 @@ #!/bin/sh -uci set alfred.alfred.interface=br-client -uci set alfred.alfred.mode=slave -uci delete alfred.alfred.disabled +. /lib/functions.sh + +uci_remove alfred alfred + +uci_add alfred alfred alfred +uci_set alfred alfred interface 'br-client' +uci_set alfred alfred mode 'slave' +uci_set alfred alfred batmanif 'bat0' +uci_set alfred alfred start_vis '1' +uci_set alfred alfred run_facters '0' + +uci_commit alfred + +/etc/init.d/alfred enable From 2e155f9d09c447a6a60634ecd949461479e6b056 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 13 Jan 2014 01:03:08 +0100 Subject: [PATCH 103/453] gluon-mesh-vpn-fastd: enable no_rebroadcast on the VPN interface --- package/gluon-mesh-vpn-fastd/fastd.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/package/gluon-mesh-vpn-fastd/fastd.pl b/package/gluon-mesh-vpn-fastd/fastd.pl index 85b24c8e..2d072fcd 100644 --- a/package/gluon-mesh-vpn-fastd/fastd.pl +++ b/package/gluon-mesh-vpn-fastd/fastd.pl @@ -62,6 +62,7 @@ uci_add network interface mesh_vpn uci_set network mesh_vpn ifname 'mesh-vpn' uci_set network mesh_vpn proto 'batadv' uci_set network mesh_vpn mesh 'bat0' +uci_set network mesh_vpn mesh_no_rebroadcast '1' mainaddr=$(sysconfig primary_mac) oIFS="$IFS"; IFS=":"; set -- $mainaddr; IFS="$oIFS" From 5f976809a133af0ff38deb93afd7080cfbe41a0e Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Mon, 13 Jan 2014 12:45:55 +0100 Subject: [PATCH 104/453] gluon-autoupdater: strip trailing - from model --- package/gluon-autoupdater/files/usr/sbin/autoupdater | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-autoupdater/files/usr/sbin/autoupdater b/package/gluon-autoupdater/files/usr/sbin/autoupdater index a012bbce..6a543fad 100755 --- a/package/gluon-autoupdater/files/usr/sbin/autoupdater +++ b/package/gluon-autoupdater/files/usr/sbin/autoupdater @@ -38,7 +38,7 @@ cleanup() { trap cleanup INT TERM EXIT PIPE . /lib/gluon/functions/model.sh -my_model="$(get_model | tr '[A-Z]' '[a-z]' | sed -r 's/[^a-z0-9]+/-/g')" +my_model="$(get_model | tr '[A-Z]' '[a-z]' | sed -r 's/[^a-z0-9]+/-/g;s/-$//')" if [ ! -f "$VERSION_FILE" ]; then echo "Couldn't determine firmware version!" >&2 From d0e3cbc8bc364b25ee1ac8c293c006d99aac2413 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Mon, 13 Jan 2014 16:07:52 +0100 Subject: [PATCH 105/453] alfred: added more information to send, reformatted location location is object with latitude and longitude added: * firmware * autoupdater status * hardware model * primary mac address * mesh IPv6 addresses --- .../files/lib/gluon/alfred/announce.sh | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh index 6b890a78..cd9bd596 100755 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh @@ -9,14 +9,41 @@ else exit 1 fi +. /lib/gluon/functions/model.sh +. /lib/gluon/functions/sysconfig.sh + [ -z "$ALFRED_DATA_TYPE" ] && ALFRED_DATA_TYPE=158 +[ -z "$NET_IF" ] && NET_IF=br-client set -e json_init json_add_string "name" "$(uci get 'system.@system[0].hostname')" -if [ "$(uci get 'system.@system[0].share_location')" = 1 ]; then - json_add_string "location" "$(uci get 'system.@system[0].latitude') $(uci get 'system.@system[0].longitude')" +if [ "$(uci -q get 'system.@system[0].share_location')" = 1 ]; then + json_add_object "location" + json_add_double "latitude" "$(uci get 'system.@system[0].latitude')" + json_add_double "longitude" "$(uci get 'system.@system[0].longitude')" + json_close_object # location fi +json_add_object "software" + json_add_string "firmware" "gluon $(cat /lib/gluon/release)" + if [ -x /usr/sbin/autoupdater ]; then + json_add_object "autoupdater" + json_add_string "branch" "$(uci -q get autoupdater.settings.branch)" + json_add_boolean "enabled" "$(uci -q get autoupdater.settings.enabled)" + json_close_object # autoupdater + fi +json_close_object # software +json_add_object "hardware" + json_add_string "model" "$(get_model)" +json_close_object # hardware +json_add_object "network" + json_add_string "mac" "$(sysconfig primary_mac)" + json_add_array "addresses" + for addr in $(ip -o -6 addr show dev "$NET_IF" | grep -oE 'inet6 [0-9a-fA-F:]+' | cut -d' ' -f2); do + json_add_string "" "$addr" + done + json_close_array # adresses +json_close_object # network json_dump | tr -d '\n' | alfred -s "$ALFRED_DATA_TYPE" From e901ceda7102ac229b438b38f3721ade35d9b67c Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Mon, 13 Jan 2014 17:06:47 +0100 Subject: [PATCH 106/453] alfred: split up firmware info, include fastd version+status --- .../gluon-alfred/files/lib/gluon/alfred/announce.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh index cd9bd596..172c7c60 100755 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh @@ -26,13 +26,22 @@ if [ "$(uci -q get 'system.@system[0].share_location')" = 1 ]; then json_close_object # location fi json_add_object "software" - json_add_string "firmware" "gluon $(cat /lib/gluon/release)" + json_add_object "firmware" + json_add_string "base" "gluon" + json_add_string "release" "$(cat /lib/gluon/release)" + json_close_object # firmware if [ -x /usr/sbin/autoupdater ]; then json_add_object "autoupdater" json_add_string "branch" "$(uci -q get autoupdater.settings.branch)" json_add_boolean "enabled" "$(uci -q get autoupdater.settings.enabled)" json_close_object # autoupdater fi + if [ -x /usr/bin/fastd ]; then + json_add_object "fastd" + json_add_string "version" "$(fastd -v | cut -d' ' -f2)" + json_add_boolean "enabled" "$(uci -q get fastd.mesh_vpn.enabled)" + json_close_object # fastd + fi json_close_object # software json_add_object "hardware" json_add_string "model" "$(get_model)" From 59616e8d77f06c3e32b9a067dcb426333e37a9f7 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Mon, 13 Jan 2014 17:09:15 +0100 Subject: [PATCH 107/453] alfred: improved readability --- .../files/lib/gluon/alfred/announce.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh index 172c7c60..41c9c8c3 100755 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh @@ -19,23 +19,27 @@ set -e json_init json_add_string "name" "$(uci get 'system.@system[0].hostname')" + if [ "$(uci -q get 'system.@system[0].share_location')" = 1 ]; then - json_add_object "location" - json_add_double "latitude" "$(uci get 'system.@system[0].latitude')" - json_add_double "longitude" "$(uci get 'system.@system[0].longitude')" - json_close_object # location +json_add_object "location" + json_add_double "latitude" "$(uci get 'system.@system[0].latitude')" + json_add_double "longitude" "$(uci get 'system.@system[0].longitude')" +json_close_object # location fi + json_add_object "software" json_add_object "firmware" json_add_string "base" "gluon" json_add_string "release" "$(cat /lib/gluon/release)" json_close_object # firmware + if [ -x /usr/sbin/autoupdater ]; then json_add_object "autoupdater" json_add_string "branch" "$(uci -q get autoupdater.settings.branch)" json_add_boolean "enabled" "$(uci -q get autoupdater.settings.enabled)" json_close_object # autoupdater fi + if [ -x /usr/bin/fastd ]; then json_add_object "fastd" json_add_string "version" "$(fastd -v | cut -d' ' -f2)" @@ -43,9 +47,11 @@ json_add_object "software" json_close_object # fastd fi json_close_object # software + json_add_object "hardware" json_add_string "model" "$(get_model)" json_close_object # hardware + json_add_object "network" json_add_string "mac" "$(sysconfig primary_mac)" json_add_array "addresses" From a3f2eb6bc7a9f11b7329462e784ad34e64ff0371 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Mon, 13 Jan 2014 17:11:41 +0100 Subject: [PATCH 108/453] alfred: name -> hostname --- package/gluon-alfred/files/lib/gluon/alfred/announce.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh index 41c9c8c3..54d30b5a 100755 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh @@ -18,7 +18,7 @@ fi set -e json_init -json_add_string "name" "$(uci get 'system.@system[0].hostname')" +json_add_string "hostname" "$(uci get 'system.@system[0].hostname')" if [ "$(uci -q get 'system.@system[0].share_location')" = 1 ]; then json_add_object "location" From 604e3caceb5dd35ff911e7a7f6a09f4cac377288 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 13 Jan 2014 18:01:44 +0100 Subject: [PATCH 109/453] gluon-mesh-batman-adv: disable client interface in dnsmasq --- .../lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh index b64a23ba..d721264f 100755 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh @@ -16,7 +16,11 @@ uci_set network client proto 'dhcpv6' uci_set network client reqprefix 'no' uci_set network client peerdns '0' uci_set network client macaddr "$(sysconfig primary_mac)" - uci_commit network +uci_add dhcp dhcp client +uci_set dhcp client interface 'client' +uci_set dhcp client ignore '1' +uci_commit dhcp + echo 'net.ipv6.conf.br-client.forwarding=0' >> /etc/sysctl.conf From d204b0e24fd4b30027602388e732b70e2747654f Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 13 Jan 2014 18:24:15 +0100 Subject: [PATCH 110/453] Remove initscript enable/disable hacks Better configure these properly. --- .../lib/gluon/upgrade/alfred/invariant/010-enable-alfred | 2 -- .../lib/gluon/upgrade/core/invariant/010-disable-services | 5 ----- .../files/lib/gluon/upgrade/cron/invariant/010-enable-cron | 4 ---- .../lib/gluon/upgrade/ebtables/invariant/010-enable-ebtables | 3 --- package/gluon-mesh-vpn-fastd/Makefile | 1 - .../gluon/upgrade/mesh-vpn-fastd/invariant/010-enable-fastd | 3 --- 6 files changed, 18 deletions(-) delete mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/invariant/010-disable-services delete mode 100755 package/gluon-cron/files/lib/gluon/upgrade/cron/invariant/010-enable-cron delete mode 100755 package/gluon-ebtables/files/lib/gluon/upgrade/ebtables/invariant/010-enable-ebtables delete mode 100755 package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-enable-fastd diff --git a/package/gluon-alfred/files/lib/gluon/upgrade/alfred/invariant/010-enable-alfred b/package/gluon-alfred/files/lib/gluon/upgrade/alfred/invariant/010-enable-alfred index 755fff3b..fb75e8e1 100755 --- a/package/gluon-alfred/files/lib/gluon/upgrade/alfred/invariant/010-enable-alfred +++ b/package/gluon-alfred/files/lib/gluon/upgrade/alfred/invariant/010-enable-alfred @@ -12,5 +12,3 @@ uci_set alfred alfred start_vis '1' uci_set alfred alfred run_facters '0' uci_commit alfred - -/etc/init.d/alfred enable diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/invariant/010-disable-services b/package/gluon-core/files/lib/gluon/upgrade/core/invariant/010-disable-services deleted file mode 100755 index c4152059..00000000 --- a/package/gluon-core/files/lib/gluon/upgrade/core/invariant/010-disable-services +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -/etc/init.d/dnsmasq disable -/etc/init.d/telnet disable -/etc/init.d/uhttpd disable diff --git a/package/gluon-cron/files/lib/gluon/upgrade/cron/invariant/010-enable-cron b/package/gluon-cron/files/lib/gluon/upgrade/cron/invariant/010-enable-cron deleted file mode 100755 index 46391527..00000000 --- a/package/gluon-cron/files/lib/gluon/upgrade/cron/invariant/010-enable-cron +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -/etc/init.d/gluon-cron enable - diff --git a/package/gluon-ebtables/files/lib/gluon/upgrade/ebtables/invariant/010-enable-ebtables b/package/gluon-ebtables/files/lib/gluon/upgrade/ebtables/invariant/010-enable-ebtables deleted file mode 100755 index 5c2aa269..00000000 --- a/package/gluon-ebtables/files/lib/gluon/upgrade/ebtables/invariant/010-enable-ebtables +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -/etc/init.d/gluon-ebtables enable diff --git a/package/gluon-mesh-vpn-fastd/Makefile b/package/gluon-mesh-vpn-fastd/Makefile index 52618816..1553af90 100644 --- a/package/gluon-mesh-vpn-fastd/Makefile +++ b/package/gluon-mesh-vpn-fastd/Makefile @@ -31,7 +31,6 @@ define Build/Compile endef define Package/gluon-mesh-vpn-fastd/install - $(CP) ./files/* $(1)/ $(INSTALL_DIR) $(1)/lib/gluon/upgrade/mesh-vpn-fastd/invariant $(INSTALL_BIN) $(PKG_BUILD_DIR)/fastd.sh $(1)/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd endef diff --git a/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-enable-fastd b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-enable-fastd deleted file mode 100755 index f4fc6d55..00000000 --- a/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-enable-fastd +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -/etc/init.d/fastd enable From 1cf4d41cbaaaedc5ca35fc9620e44fbf43cf2013 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 13 Jan 2014 20:16:43 +0100 Subject: [PATCH 111/453] gluon-config-mode: use different document root --- .../files/etc/init.d/gluon-config-mode | 5 +++-- .../files/lib/gluon/config-mode/www/cgi-bin/luci | 5 +++++ .../files/lib/gluon/config-mode/www/index.html | 10 ++++++++++ .../files/lib/gluon/config-mode/www/luci-static | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100755 package/gluon-config-mode/files/lib/gluon/config-mode/www/cgi-bin/luci create mode 100644 package/gluon-config-mode/files/lib/gluon/config-mode/www/index.html create mode 120000 package/gluon-config-mode/files/lib/gluon/config-mode/www/luci-static diff --git a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode index 2ee6af93..2af5e953 100755 --- a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode +++ b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode @@ -33,9 +33,10 @@ start() { ip link set up dev $config_mode_iface /usr/sbin/telnetd -l /lib/gluon/config-mode/ash-login - /etc/init.d/dropbear start - /etc/init.d/uhttpd start + + /usr/sbin/uhttpd -h /lib/gluon/config-mode/www -x /cgi-bin -A 1 -R -p 0.0.0.0:80 + /etc/init.d/led start # correctly finish firstboot diff --git a/package/gluon-config-mode/files/lib/gluon/config-mode/www/cgi-bin/luci b/package/gluon-config-mode/files/lib/gluon/config-mode/www/cgi-bin/luci new file mode 100755 index 00000000..c5c98473 --- /dev/null +++ b/package/gluon-config-mode/files/lib/gluon/config-mode/www/cgi-bin/luci @@ -0,0 +1,5 @@ +#!/usr/bin/lua +require "luci.cacheloader" +require "luci.sgi.cgi" +luci.dispatcher.indexcache = "/tmp/luci-indexcache" +luci.sgi.cgi.run() diff --git a/package/gluon-config-mode/files/lib/gluon/config-mode/www/index.html b/package/gluon-config-mode/files/lib/gluon/config-mode/www/index.html new file mode 100644 index 00000000..0a7238b5 --- /dev/null +++ b/package/gluon-config-mode/files/lib/gluon/config-mode/www/index.html @@ -0,0 +1,10 @@ + + + + + + + +LuCI - Lua Configuration Interface + + diff --git a/package/gluon-config-mode/files/lib/gluon/config-mode/www/luci-static b/package/gluon-config-mode/files/lib/gluon/config-mode/www/luci-static new file mode 120000 index 00000000..aea80e05 --- /dev/null +++ b/package/gluon-config-mode/files/lib/gluon/config-mode/www/luci-static @@ -0,0 +1 @@ +/www/luci-static \ No newline at end of file From f99767fb9fda234c78ad238214eaa0ef86df0e7f Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 14 Jan 2014 01:50:59 +0100 Subject: [PATCH 112/453] Add firewall rules gluon-mesh-batman-adv should not be used without firewall to prevent forwarding of packets from the mesh to the wan interface. For some reason, the firewall package won't work at all without kmod-ipt-nathelper. --- package/gluon-mesh-batman-adv/Makefile | 2 +- .../lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh | 8 ++++++++ .../lib/gluon/upgrade/next-node/invariant/010-next-node | 9 +++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/package/gluon-mesh-batman-adv/Makefile b/package/gluon-mesh-batman-adv/Makefile index 2e99dfa0..a800f975 100644 --- a/package/gluon-mesh-batman-adv/Makefile +++ b/package/gluon-mesh-batman-adv/Makefile @@ -12,7 +12,7 @@ define Package/gluon-mesh-batman-adv SECTION:=gluon CATEGORY:=Gluon TITLE:=Support for batman-adv meshing - DEPENDS:=+gluon-core +kmod-batman-adv + DEPENDS:=+gluon-core +kmod-batman-adv +firewall +kmod-ipt-nathelper endef define Package/gluon-mesh-batman-adv/description diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh index d721264f..3e3da515 100755 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh @@ -18,6 +18,14 @@ uci_set network client peerdns '0' uci_set network client macaddr "$(sysconfig primary_mac)" uci_commit network +uci_add firewall zone client +uci_set firewall client name 'client' +uci add_list firewall.client.network='client' +uci_set firewall client input 'ACCEPT' +uci_set firewall client output 'ACCEPT' +uci_set firewall client forward 'REJECT' +uci_commit firewall + uci_add dhcp dhcp client uci_set dhcp client interface 'client' uci_set dhcp client ignore '1' diff --git a/package/gluon-next-node/generate/lib/gluon/upgrade/next-node/invariant/010-next-node b/package/gluon-next-node/generate/lib/gluon/upgrade/next-node/invariant/010-next-node index 445b6d46..bec0e1c1 100755 --- a/package/gluon-next-node/generate/lib/gluon/upgrade/next-node/invariant/010-next-node +++ b/package/gluon-next-node/generate/lib/gluon/upgrade/next-node/invariant/010-next-node @@ -34,3 +34,12 @@ uci_set network local_node_route6 target '@prefix6@' uci_set network local_node_route6 gateway '::' uci_commit network + +uci_remove firewall local_node +uci_add firewall zone local_node +uci_set firewall local_node name 'local_node' +uci add_list firewall.local_node.network='local_node' +uci_set firewall local_node input 'ACCEPT' +uci_set firewall local_node output 'ACCEPT' +uci_set firewall local_node forward 'REJECT' +uci_commit firewall From 3275c92f72ef1610a1af83a75423eb22f38c4948 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 14 Jan 2014 18:19:51 +0100 Subject: [PATCH 113/453] gluon-core: add function to add users --- .../gluon-core/files/lib/gluon/functions/users.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 package/gluon-core/files/lib/gluon/functions/users.sh diff --git a/package/gluon-core/files/lib/gluon/functions/users.sh b/package/gluon-core/files/lib/gluon/functions/users.sh new file mode 100644 index 00000000..d0579858 --- /dev/null +++ b/package/gluon-core/files/lib/gluon/functions/users.sh @@ -0,0 +1,12 @@ +add_user() { + local username="$1" + local id="$2" + + [ "$username" -a "$id" ] || return 1 + + sed -i "/^$username:/d" /etc/passwd + sed -i "/^$username:/d" /etc/shadow + + echo "$username:*:$id:100:$username:/var:/bin/false" >> /etc/passwd + echo "$username:*:0:0:99999:7:::" >> /etc/shadow +} From 5241565a79285275c0784db4b71c28be43920b05 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 14 Jan 2014 18:46:17 +0100 Subject: [PATCH 114/453] gluon-mesh-vpn-fastd: don't run as root --- package/gluon-mesh-vpn-fastd/fastd.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/gluon-mesh-vpn-fastd/fastd.pl b/package/gluon-mesh-vpn-fastd/fastd.pl index 2d072fcd..962bc1f2 100644 --- a/package/gluon-mesh-vpn-fastd/fastd.pl +++ b/package/gluon-mesh-vpn-fastd/fastd.pl @@ -19,12 +19,16 @@ print < Date: Tue, 14 Jan 2014 19:06:28 +0100 Subject: [PATCH 115/453] gluon-radvd: don't run as root --- package/gluon-radvd/files/etc/init.d/gluon-radvd | 6 +++++- .../files/lib/gluon/upgrade/radvd/invariant/10-radvd-user | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100755 package/gluon-radvd/files/lib/gluon/upgrade/radvd/invariant/10-radvd-user diff --git a/package/gluon-radvd/files/etc/init.d/gluon-radvd b/package/gluon-radvd/files/etc/init.d/gluon-radvd index 4064439b..2cfe0980 100755 --- a/package/gluon-radvd/files/etc/init.d/gluon-radvd +++ b/package/gluon-radvd/files/etc/init.d/gluon-radvd @@ -4,9 +4,13 @@ START=50 SERVICE_USE_PID=1 SERVICE_NAME=gluon-radvd +SERVICE_PID_DIR=/var/run/gluon-radvd +SERVICE_PID_FILE="$SERVICE_PID_DIR"/gluon-radvd.pid start() { - service_start /usr/sbin/radvd -C /lib/gluon/radvd/radvd.conf -m stderr_syslog -p /var/run/gluon-radvd.pid + mkdir -p "$SERVICE_PID_DIR" + chown gluon-radvd "$SERVICE_PID_DIR" + service_start /usr/sbin/radvd -C /lib/gluon/radvd/radvd.conf -m stderr_syslog -u gluon-radvd -p "$SERVICE_PID_FILE" } stop() { diff --git a/package/gluon-radvd/files/lib/gluon/upgrade/radvd/invariant/10-radvd-user b/package/gluon-radvd/files/lib/gluon/upgrade/radvd/invariant/10-radvd-user new file mode 100755 index 00000000..baa0c9d2 --- /dev/null +++ b/package/gluon-radvd/files/lib/gluon/upgrade/radvd/invariant/10-radvd-user @@ -0,0 +1,5 @@ +#!/bin/sh + +. /lib/gluon/functions/users.sh + +add_user gluon-radvd 801 From 72b27ea2e0610c2b4a5da5c8e41983d55fcfc37a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 14 Jan 2014 19:37:15 +0100 Subject: [PATCH 116/453] gluon-mesh-vpn-fastd: enable secure handshakes --- package/gluon-mesh-vpn-fastd/fastd.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/package/gluon-mesh-vpn-fastd/fastd.pl b/package/gluon-mesh-vpn-fastd/fastd.pl index 962bc1f2..fbd1a030 100644 --- a/package/gluon-mesh-vpn-fastd/fastd.pl +++ b/package/gluon-mesh-vpn-fastd/fastd.pl @@ -33,6 +33,7 @@ uci_set fastd mesh_vpn syslog_level 'verbose' uci_set fastd mesh_vpn interface 'mesh-vpn' uci_set fastd mesh_vpn mode 'tap' uci_set fastd mesh_vpn mtu '$cfg->{mtu}' +uci_set fastd mesh_vpn secure_handshakes '1' uci_remove fastd mesh_vpn method $add_methods From 6bf44622dcdc30fc5d33152380c236423754ac98 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Thu, 16 Jan 2014 10:58:03 +0100 Subject: [PATCH 117/453] alfred: add statistics (uptime+traffic) --- .../files/lib/gluon/alfred/announce.sh | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh index 54d30b5a..0d716c59 100755 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh @@ -12,11 +12,31 @@ fi . /lib/gluon/functions/model.sh . /lib/gluon/functions/sysconfig.sh +# set defaults [ -z "$ALFRED_DATA_TYPE" ] && ALFRED_DATA_TYPE=158 [ -z "$NET_IF" ] && NET_IF=br-client +[ -z "$TRAFFIC_FILE" ] && TRAFFIC_FILE=/var/run/traffic set -e +get_traffic() { + if [ -f "$TRAFFIC_FILE" ]; then + OLD_TIME="$(cut -d' ' -f1 "$TRAFFIC_FILE")" + OLD_RX="$(cut -d' ' -f2 "$TRAFFIC_FILE")" + OLD_TX="$(cut -d' ' -f3 "$TRAFFIC_FILE")" + else + OLD_TIME=0 + OLD_RX=0 + OLD_TX=0 + fi + NEW_TIME="$(cut -d' ' -f1 /proc/uptime)" + NEW_RX="$(cat /sys/class/net/bat0/statistics/rx_bytes)" + NEW_TX="$(cat /sys/class/net/bat0/statistics/tx_bytes)" + echo "$NEW_TIME $NEW_RX $NEW_TX" > "$TRAFFIC_FILE" + echo "$OLD_TIME $OLD_RX $OLD_TX $NEW_TIME $NEW_RX $NEW_TX" |\ + awk '{tdiff=$4-$1; print ($5-$2)/tdiff " " ($6-$3)/tdiff;}' +} + json_init json_add_string "hostname" "$(uci get 'system.@system[0].hostname')" @@ -61,4 +81,13 @@ json_add_object "network" json_close_array # adresses json_close_object # network +json_add_object "statistics" + json_add_int "uptime" "$(cut -d' ' -f1 /proc/uptime)" + TRAFFIC="$(get_traffic)" + json_add_object "traffic" + json_add_double "rx" "$(echo $TRAFFIC | cut -d' ' -f1)" + json_add_double "tx" "$(echo $TRAFFIC | cut -d' ' -f2)" + json_close_object +json_close_object # statistics + json_dump | tr -d '\n' | alfred -s "$ALFRED_DATA_TYPE" From 50782f759e370a52030f93db65ae6960745afe7b Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Thu, 16 Jan 2014 22:24:57 +0100 Subject: [PATCH 118/453] alfred: make traffic counters absolute After a lenghty discussion, we settled on absolute vs. relative values. Main reasons: * stateless implementation on node possible * convertable to relative values by differentiaion on receiver * missed transmissions only decrease granularity, whereas relative values would introduce wrong numbers on integration if values are missed --- .../files/lib/gluon/alfred/announce.sh | 26 +++---------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh index 0d716c59..c4f88c61 100755 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh @@ -15,28 +15,9 @@ fi # set defaults [ -z "$ALFRED_DATA_TYPE" ] && ALFRED_DATA_TYPE=158 [ -z "$NET_IF" ] && NET_IF=br-client -[ -z "$TRAFFIC_FILE" ] && TRAFFIC_FILE=/var/run/traffic set -e -get_traffic() { - if [ -f "$TRAFFIC_FILE" ]; then - OLD_TIME="$(cut -d' ' -f1 "$TRAFFIC_FILE")" - OLD_RX="$(cut -d' ' -f2 "$TRAFFIC_FILE")" - OLD_TX="$(cut -d' ' -f3 "$TRAFFIC_FILE")" - else - OLD_TIME=0 - OLD_RX=0 - OLD_TX=0 - fi - NEW_TIME="$(cut -d' ' -f1 /proc/uptime)" - NEW_RX="$(cat /sys/class/net/bat0/statistics/rx_bytes)" - NEW_TX="$(cat /sys/class/net/bat0/statistics/tx_bytes)" - echo "$NEW_TIME $NEW_RX $NEW_TX" > "$TRAFFIC_FILE" - echo "$OLD_TIME $OLD_RX $OLD_TX $NEW_TIME $NEW_RX $NEW_TX" |\ - awk '{tdiff=$4-$1; print ($5-$2)/tdiff " " ($6-$3)/tdiff;}' -} - json_init json_add_string "hostname" "$(uci get 'system.@system[0].hostname')" @@ -83,11 +64,10 @@ json_close_object # network json_add_object "statistics" json_add_int "uptime" "$(cut -d' ' -f1 /proc/uptime)" - TRAFFIC="$(get_traffic)" json_add_object "traffic" - json_add_double "rx" "$(echo $TRAFFIC | cut -d' ' -f1)" - json_add_double "tx" "$(echo $TRAFFIC | cut -d' ' -f2)" - json_close_object + json_add_double "rx" "$(cat /sys/class/net/bat0/statistics/rx_bytes)" + json_add_double "tx" "$(cat /sys/class/net/bat0/statistics/tx_bytes)" + json_close_object # traffic json_close_object # statistics json_dump | tr -d '\n' | alfred -s "$ALFRED_DATA_TYPE" From cc2ef851c7dd0d3ce9e16f7a2104d8e9ffa2ab5e Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Thu, 16 Jan 2014 22:36:09 +0100 Subject: [PATCH 119/453] alfred: add random node-specific delay before sending --- package/gluon-alfred/files/lib/gluon/alfred/announce.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh index c4f88c61..928cee8f 100755 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh @@ -15,9 +15,17 @@ fi # set defaults [ -z "$ALFRED_DATA_TYPE" ] && ALFRED_DATA_TYPE=158 [ -z "$NET_IF" ] && NET_IF=br-client +[ -z "$MAX_WAIT" ] && MAX_WAIT=300 set -e +# To avoid mass flooding the network every five minutes with all clients +# simultaneously, wait for a random time between 0 and 300 seconds, but fixed +# for each device to maintain 5 minutes between updates. +# Calculated using first 3 hex digits of the primary MAC address' MD5 hash +DELAY=$((0x$(sysconfig primary_mac | tr -d ':' | md5sum | head -c3) * $MAX_WAIT / (16**3))) +sleep $DELAY + json_init json_add_string "hostname" "$(uci get 'system.@system[0].hostname')" From 692f093d219110a8cf8b5b9813b948442a6a719f Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Thu, 16 Jan 2014 22:42:02 +0100 Subject: [PATCH 120/453] alfred: clean up delay code --- package/gluon-alfred/files/lib/gluon/alfred/announce.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh index 928cee8f..c24c1b23 100755 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh @@ -15,7 +15,7 @@ fi # set defaults [ -z "$ALFRED_DATA_TYPE" ] && ALFRED_DATA_TYPE=158 [ -z "$NET_IF" ] && NET_IF=br-client -[ -z "$MAX_WAIT" ] && MAX_WAIT=300 +[ -z "$MAX_WAIT" ] && MAX_WAIT=299 set -e @@ -23,7 +23,7 @@ set -e # simultaneously, wait for a random time between 0 and 300 seconds, but fixed # for each device to maintain 5 minutes between updates. # Calculated using first 3 hex digits of the primary MAC address' MD5 hash -DELAY=$((0x$(sysconfig primary_mac | tr -d ':' | md5sum | head -c3) * $MAX_WAIT / (16**3))) +DELAY=$((0x$(sysconfig primary_mac | md5sum | head -c3) * $MAX_WAIT / (16**3))) sleep $DELAY json_init From 7fdd0300b294588dac2f46b5ccdfce90a36caac7 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Thu, 16 Jan 2014 23:46:54 +0100 Subject: [PATCH 121/453] alfred: Add --no-sleep option to send immediately --- package/gluon-alfred/files/lib/gluon/alfred/announce.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh index c24c1b23..de0c9181 100755 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh @@ -23,8 +23,10 @@ set -e # simultaneously, wait for a random time between 0 and 300 seconds, but fixed # for each device to maintain 5 minutes between updates. # Calculated using first 3 hex digits of the primary MAC address' MD5 hash -DELAY=$((0x$(sysconfig primary_mac | md5sum | head -c3) * $MAX_WAIT / (16**3))) -sleep $DELAY +if [ "$1" != "--no-sleep" ]; then + DELAY=$((0x$(sysconfig primary_mac | md5sum | head -c3) * $MAX_WAIT / (16**3))) + sleep $DELAY +fi json_init json_add_string "hostname" "$(uci get 'system.@system[0].hostname')" From 4b610626364d0128d7d34a719fe0c0eb7b5e32d7 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Thu, 16 Jan 2014 23:47:41 +0100 Subject: [PATCH 122/453] alfred: add more traffic statistics + mgmt and forward counters + packet in addition to byte counters for everything --- package/gluon-alfred/Makefile | 2 +- .../gluon-alfred/files/lib/gluon/alfred/announce.sh | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/package/gluon-alfred/Makefile b/package/gluon-alfred/Makefile index 8290ad82..176ba9b4 100644 --- a/package/gluon-alfred/Makefile +++ b/package/gluon-alfred/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/package.mk define Package/gluon-alfred SECTION:=gluon CATEGORY:=Gluon - DEPENDS:=+gluon-core +gluon-location +gluon-cron +alfred + DEPENDS:=+gluon-core +gluon-location +gluon-cron +alfred +ethtool TITLE:=Configure alfred endef diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh index de0c9181..d4533d30 100755 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh @@ -75,8 +75,16 @@ json_close_object # network json_add_object "statistics" json_add_int "uptime" "$(cut -d' ' -f1 /proc/uptime)" json_add_object "traffic" - json_add_double "rx" "$(cat /sys/class/net/bat0/statistics/rx_bytes)" - json_add_double "tx" "$(cat /sys/class/net/bat0/statistics/tx_bytes)" + TRAFFIC="$(ethtool -S bat0 | sed -e 's/^ *//')" + for class in rx tx forward mgmt_rx mgmt_tx; do + json_add_object "$class" + json_add_int "bytes" "$(echo "$TRAFFIC" | awk -F': ' "/^${class}_bytes:/ { print \$2 }")" + json_add_int "packets" "$(echo "$TRAFFIC" | awk -F': ' "/^${class}:/ { print \$2 }")" + if [ "$class" = "tx" ]; then + json_add_int "dropped" "$(echo "$TRAFFIC" | awk -F': ' "/^${class}_dropped:/ { print \$2 }")" + fi + json_close_object # $class + done json_close_object # traffic json_close_object # statistics From 4ca8a35fc98888601694ed3c7165271524f0bdec Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 16 Jan 2014 23:35:13 +0100 Subject: [PATCH 123/453] gluon-mesh-batman-adv: set bat0 MAC address to primary address --- .../files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh index 3e3da515..4c5c5158 100755 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh @@ -16,6 +16,11 @@ uci_set network client proto 'dhcpv6' uci_set network client reqprefix 'no' uci_set network client peerdns '0' uci_set network client macaddr "$(sysconfig primary_mac)" + +uci_add network interface bat0 +uci_set network bat0 ifname 'bat0' +uci_set network bat0 proto 'none' +uci_set network bat0 macaddr "$(sysconfig primary_mac)" uci_commit network uci_add firewall zone client From 54620d62318d9bf6ed88dca96ce388f57e9490b0 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Fri, 17 Jan 2014 16:09:34 +0100 Subject: [PATCH 124/453] autoupdater: Use awk instead of grep+head+tail to split manifest --- .../gluon-autoupdater/files/usr/sbin/autoupdater | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/package/gluon-autoupdater/files/usr/sbin/autoupdater b/package/gluon-autoupdater/files/usr/sbin/autoupdater index 6a543fad..bdd23245 100755 --- a/package/gluon-autoupdater/files/usr/sbin/autoupdater +++ b/package/gluon-autoupdater/files/usr/sbin/autoupdater @@ -59,15 +59,11 @@ if test $? -ne 0; then exit 1 fi -seperator_line=$(cat $manifest|grep -n "^---$"|cut -d: -f1|head -n1) - -if test -z "$seperator_line"; then - echo "Couldn't find --- marker!" >&2 - exit 1 -fi - -head -n$(($seperator_line-1)) $manifest > $manifest_upper -tail -n+$(($seperator_line+1)) $manifest > $manifest_lower +awk "BEGIN { sep=0 } + /^---\$/ { sep=1; next } + { if(sep==0) print > \"$manifest_upper\"; + else print > \"$manifest_lower\"}" \ + $manifest signatures="" while read sig; do From 8b4474e18f3a39833c71fdb293b23cf24336c924 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 18 Jan 2014 19:43:31 +0100 Subject: [PATCH 125/453] gluon-mesh-batman-adv: set gateway mode to client --- .../files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh | 1 + 1 file changed, 1 insertion(+) diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh index 4c5c5158..5632f6da 100755 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh @@ -7,6 +7,7 @@ uci_remove batman-adv bat0 uci_add batman-adv mesh bat0 uci_set batman-adv bat0 orig_interval '5000' +uci_set batman-adv bat0 gw_mode 'client' uci_commit batman-adv uci_add network interface client From 74493b2ba5a0a370f7d5863c0a52c21d0e240b7c Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 18 Jan 2014 21:56:05 +0100 Subject: [PATCH 126/453] gluon-alfred: run every minute The run frequency and exact time affect the alfred announce interval, so we can just run it every minute to supply alfred with the most up-to-date data. --- .../gluon-alfred/files/lib/gluon/alfred/announce.sh | 10 ---------- package/gluon-alfred/files/lib/gluon/cron/alfred | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh index d4533d30..ba17f323 100755 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh @@ -15,19 +15,9 @@ fi # set defaults [ -z "$ALFRED_DATA_TYPE" ] && ALFRED_DATA_TYPE=158 [ -z "$NET_IF" ] && NET_IF=br-client -[ -z "$MAX_WAIT" ] && MAX_WAIT=299 set -e -# To avoid mass flooding the network every five minutes with all clients -# simultaneously, wait for a random time between 0 and 300 seconds, but fixed -# for each device to maintain 5 minutes between updates. -# Calculated using first 3 hex digits of the primary MAC address' MD5 hash -if [ "$1" != "--no-sleep" ]; then - DELAY=$((0x$(sysconfig primary_mac | md5sum | head -c3) * $MAX_WAIT / (16**3))) - sleep $DELAY -fi - json_init json_add_string "hostname" "$(uci get 'system.@system[0].hostname')" diff --git a/package/gluon-alfred/files/lib/gluon/cron/alfred b/package/gluon-alfred/files/lib/gluon/cron/alfred index 98cc382e..f9bde2f1 100644 --- a/package/gluon-alfred/files/lib/gluon/cron/alfred +++ b/package/gluon-alfred/files/lib/gluon/cron/alfred @@ -1 +1 @@ -*/5 * * * * /lib/gluon/alfred/announce.sh +* * * * * /lib/gluon/alfred/announce.sh From 086efed4285859364c2e68a99505e4139bdc836f Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 19 Jan 2014 21:29:21 +0100 Subject: [PATCH 127/453] gluon-alfred: add chosen gateway and load average --- package/gluon-alfred/files/lib/gluon/alfred/announce.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh index ba17f323..65e4b187 100755 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh @@ -60,10 +60,14 @@ json_add_object "network" json_add_string "" "$addr" done json_close_array # adresses + + GATEWAY="$(batctl -m bat0 gateways | awk '/^=>/ { print $2 }')" + [ -z "$GATEWAY" ] || json_add_string "gateway" "$GATEWAY" json_close_object # network json_add_object "statistics" json_add_int "uptime" "$(cut -d' ' -f1 /proc/uptime)" + json_add_double "loadavg" "$(cut -d' ' -f1 /proc/loadavg)" json_add_object "traffic" TRAFFIC="$(ethtool -S bat0 | sed -e 's/^ *//')" for class in rx tx forward mgmt_rx mgmt_tx; do From 7cdf3708f075af5d21e397c6f1b59adab48ac730 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Sun, 19 Jan 2014 16:43:25 +0100 Subject: [PATCH 128/453] gluon-autoupdater: get random number from urandom The approach with awk's rand() wasn't really random between across devices: When srand() was called without arguments, time() was used as seed, which of course is the same on all devices when the script is called via cron at HH:00:00. This patch instead uses /dev/urandom as source of random (we don't need cryptographically strong random numbers, so urandom is just fine) but still uses awk for the comparison as busybox's ash cannot deal with floats in $(()) --- package/gluon-autoupdater/files/usr/sbin/autoupdater | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package/gluon-autoupdater/files/usr/sbin/autoupdater b/package/gluon-autoupdater/files/usr/sbin/autoupdater index bdd23245..c18e27fc 100755 --- a/package/gluon-autoupdater/files/usr/sbin/autoupdater +++ b/package/gluon-autoupdater/files/usr/sbin/autoupdater @@ -10,7 +10,9 @@ BRANCH=$(uci get autoupdater.settings.branch) PROBABILITY=$(uci get autoupdater.${BRANCH}.probability) if test "a$1" != "a-f"; then - echo | awk "END{srand();exit rand() > $PROBABILITY}" + # get one random byte from /dev/urandom, convert it to decimal and check + # against update_probability*255 + hexdump -n1 -e '/1 "%d"' /dev/urandom | awk "{exit \$1 > $PROBABILITY * 255}" if test $? -ne 0; then echo "No autoupdate this time. Use -f to override" exit 0 From 8e73ff90a05cf32914688ee8a0d6ba82fda2d810 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Sun, 19 Jan 2014 23:19:55 +0100 Subject: [PATCH 129/453] gluon-autoupdater: typo corrected --- package/gluon-autoupdater/files/usr/sbin/autoupdater | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-autoupdater/files/usr/sbin/autoupdater b/package/gluon-autoupdater/files/usr/sbin/autoupdater index c18e27fc..3c03a8b5 100755 --- a/package/gluon-autoupdater/files/usr/sbin/autoupdater +++ b/package/gluon-autoupdater/files/usr/sbin/autoupdater @@ -91,7 +91,7 @@ fi grep -q "^BRANCH=${BRANCH}$" $manifest_upper if test $? -ne 0; then - echo "Wrong branch. We'are on ${BRANCH}" >&2 + echo "Wrong branch. We are on ${BRANCH}" >&2 exit 1 fi From 1dd9a9a8a118b62f27ec37f30516caba33781bc4 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 19 Jan 2014 22:40:29 +0100 Subject: [PATCH 130/453] gluon-autoupdater: no need to provide a default config just to delete it in the initial script --- .../files/etc/config/autoupdater | 20 +++++++++---------- .../upgrade/autoupdater/initial/010-initial | 3 --- 2 files changed, 10 insertions(+), 13 deletions(-) delete mode 100755 package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/initial/010-initial diff --git a/package/gluon-autoupdater/files/etc/config/autoupdater b/package/gluon-autoupdater/files/etc/config/autoupdater index cb476930..07e34d80 100644 --- a/package/gluon-autoupdater/files/etc/config/autoupdater +++ b/package/gluon-autoupdater/files/etc/config/autoupdater @@ -1,21 +1,21 @@ -config autoupdater settings - option enabled 1 - option branch "stable" +#config autoupdater settings +# option enabled 1 +# option branch "stable" -config branch stable - option url 'http://[fdef:ffc0:3dd7::8]/~freifunk/firmware/autoupdate' +#config branch stable +# option url 'http://[fdef:ffc0:3dd7::8]/~freifunk/firmware/autoupdate' # The updater will run once per hour and perform an update with a certain # probability. # 1.0 - perform an update every hour # 0.5 - on average, perform an update every two hours # 0.0 - inhibit any automatic updates - option probability 0.5 +# option probability 0.5 # Minimum valid signatures required to perform the update - option good_signatures 2 +# option good_signatures 2 # List of public keys - list pubkey 'beea7da92ed0c19563b6c259162b4cb471aa2fdf9d3939d05fea2cf498ea7642' - list pubkey 'c75c9390cf5d7cc49a388d35f831ca379060cf7bca8c6e3d2d1ea31604597c42' - list pubkey '03e9514f137f0467c0f0ac108892c0da2b71f1039b30f863331cbd5701abd042' +# list pubkey 'beea7da92ed0c19563b6c259162b4cb471aa2fdf9d3939d05fea2cf498ea7642' +# list pubkey 'c75c9390cf5d7cc49a388d35f831ca379060cf7bca8c6e3d2d1ea31604597c42' +# list pubkey '03e9514f137f0467c0f0ac108892c0da2b71f1039b30f863331cbd5701abd042' diff --git a/package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/initial/010-initial b/package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/initial/010-initial deleted file mode 100755 index ed126ffb..00000000 --- a/package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/initial/010-initial +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -uci -q delete autoupdater.settings From 59c1900e9a268dca3dec1b6073dc355479b0f33b Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 19 Jan 2014 23:14:52 +0100 Subject: [PATCH 131/453] gluon-location: move information to /etc/config/gluon-location --- .../files/lib/gluon/alfred/announce.sh | 6 +++--- .../luci/model/cbi/gluon-config-mode/wizard.lua | 17 +++++++++++------ package/gluon-location/Makefile | 4 ++-- .../files/etc/config/gluon-location | 4 ++++ .../gluon/upgrade/location/initial/010-location | 12 ------------ 5 files changed, 20 insertions(+), 23 deletions(-) create mode 100644 package/gluon-location/files/etc/config/gluon-location delete mode 100755 package/gluon-location/files/lib/gluon/upgrade/location/initial/010-location diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh index 65e4b187..1788af48 100755 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh @@ -21,10 +21,10 @@ set -e json_init json_add_string "hostname" "$(uci get 'system.@system[0].hostname')" -if [ "$(uci -q get 'system.@system[0].share_location')" = 1 ]; then +if [ "$(uci -q get 'gluon-location.@location[0].share_location')" = 1 ]; then json_add_object "location" - json_add_double "latitude" "$(uci get 'system.@system[0].latitude')" - json_add_double "longitude" "$(uci get 'system.@system[0].longitude')" + json_add_double "latitude" "$(uci get 'gluon-location.@location[0].latitude')" + json_add_double "longitude" "$(uci get 'gluon-location.@location[0].longitude')" json_close_object # location fi diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua index 4b69ef01..4d8898bd 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua @@ -45,16 +45,16 @@ o.datatype = "integer" s = f:section(SimpleSection, "GPS Koordinaten", "Hier kannst du die GPS-Koordinaten deines Knotens eintragen, um ihn in der Knotenkarte anzeigen zu lassen.") o = s:option(Flag, "_location", "Koordinaten veröffentlichen?") -o.default = uci:get_first("system", "system", "share_location", o.disabled) +o.default = uci:get_first("gluon-locaton", "location", "share_location", o.disabled) o.rmempty = false o = s:option(Value, "_latitude", "Breitengrad") -o.default = string.format("%f", uci:get_first("system", "system", "latitude", "0")) +o.default = string.format("%f", uci:get_first("gluon-location", "location", "latitude", "0")) o.rmempty = false o.datatype = "float" o = s:option(Value, "_longitude", "Längengrad") -o.default = string.format("%f", uci:get_first("system", "system", "longitude", "0")) +o.default = string.format("%f", uci:get_first("gluon-location", "location", "longitude", "0")) o.rmempty = false o.datatype = "float" @@ -79,13 +79,18 @@ function f.handle(self, state, data) uci:foreach("system", "system", function(s) uci:set("system", s[".name"], "hostname", data._hostname) - uci:set("system", s[".name"], "share_location", data._location) - uci:set("system", s[".name"], "latitude", data._latitude) - uci:set("system", s[".name"], "longitude", data._longitude) end) uci:save("system") uci:commit("system") + uci:foreach("gluon-location", "location", function(s) + uci:set("gluon-location", s[".name"], "share_location", data._location) + uci:set("gluon-location", s[".name"], "latitude", data._latitude) + uci:set("gluon-location", s[".name"], "longitude", data._longitude) + end) + uci:save("gluon-location") + uci:commit("gluon-location") + luci.http.redirect(luci.dispatcher.build_url("gluon-config-mode", "reboot")) end diff --git a/package/gluon-location/Makefile b/package/gluon-location/Makefile index 7f1feb62..f1dd7352 100644 --- a/package/gluon-location/Makefile +++ b/package/gluon-location/Makefile @@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/package.mk define Package/gluon-location SECTION:=gluon CATEGORY:=Gluon - TITLE:=Add system.location to uci + TITLE:=Add /etc/config/gluon-location to uci DEPENDS:=+gluon-core endef define Package/gluon-location/description - This packages creates /lib/gluon/location. + This packages creates /etc/config/gluon-location. endef define Build/Prepare diff --git a/package/gluon-location/files/etc/config/gluon-location b/package/gluon-location/files/etc/config/gluon-location new file mode 100644 index 00000000..3b102cae --- /dev/null +++ b/package/gluon-location/files/etc/config/gluon-location @@ -0,0 +1,4 @@ +config location + option share_location '0' + option latitude '0.000000' + option longitude '0.000000' diff --git a/package/gluon-location/files/lib/gluon/upgrade/location/initial/010-location b/package/gluon-location/files/lib/gluon/upgrade/location/initial/010-location deleted file mode 100755 index 9a2696d2..00000000 --- a/package/gluon-location/files/lib/gluon/upgrade/location/initial/010-location +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -CFG="@system[0]" - -uci -q batch < Date: Sun, 19 Jan 2014 23:20:48 +0100 Subject: [PATCH 132/453] gluon-mesh-batman-adv: move wifi config to invariant --- .../mesh-batman-adv/{initial => invariant}/020-wireless | 3 +++ 1 file changed, 3 insertions(+) rename package/gluon-mesh-batman-adv/generate/lib/gluon/upgrade/mesh-batman-adv/{initial => invariant}/020-wireless (94%) diff --git a/package/gluon-mesh-batman-adv/generate/lib/gluon/upgrade/mesh-batman-adv/initial/020-wireless b/package/gluon-mesh-batman-adv/generate/lib/gluon/upgrade/mesh-batman-adv/invariant/020-wireless similarity index 94% rename from package/gluon-mesh-batman-adv/generate/lib/gluon/upgrade/mesh-batman-adv/initial/020-wireless rename to package/gluon-mesh-batman-adv/generate/lib/gluon/upgrade/mesh-batman-adv/invariant/020-wireless index dbca73d7..fb9b5321 100755 --- a/package/gluon-mesh-batman-adv/generate/lib/gluon/upgrade/mesh-batman-adv/initial/020-wireless +++ b/package/gluon-mesh-batman-adv/generate/lib/gluon/upgrade/mesh-batman-adv/invariant/020-wireless @@ -39,17 +39,20 @@ configure_radio() { uci_set wireless "$radio" htmode "$htmode" uci_set wireless "$radio" country '@regdom@' + uci_remove wireless "client_${radio}" uci_add wireless 'wifi-iface' "client_${radio}" uci_set wireless "client_${radio}" device "$radio" uci_set wireless "client_${radio}" network 'client' uci_set wireless "client_${radio}" mode 'ap' uci_set wireless "client_${radio}" ssid "$ssid" + uci_remove network "mesh_${radio}" uci_add network 'interface' "mesh_${radio}" uci_set network "mesh_${radio}" proto 'batadv' uci_set network "mesh_${radio}" mtu '1528' uci_set network "mesh_${radio}" mesh 'bat0' + uci_remove wireless "mesh_${radio}" uci_add wireless 'wifi-iface' "mesh_${radio}" uci_set wireless "mesh_${radio}" device "$radio" uci_set wireless "mesh_${radio}" network "mesh_${radio}" From 8f7b59d787635ebeb23f34ade54c3ea80a9efd41 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 19 Jan 2014 23:33:52 +0100 Subject: [PATCH 133/453] gluon-simple-tc: add missing defaults on every upgrade --- package/gluon-simple-tc/Makefile | 6 +++--- .../gluon-simple-tc/{initial.pl => invariant.pl} | 15 +++++---------- 2 files changed, 8 insertions(+), 13 deletions(-) rename package/gluon-simple-tc/{initial.pl => invariant.pl} (64%) diff --git a/package/gluon-simple-tc/Makefile b/package/gluon-simple-tc/Makefile index 0a5847a1..98609551 100644 --- a/package/gluon-simple-tc/Makefile +++ b/package/gluon-simple-tc/Makefile @@ -27,13 +27,13 @@ define Build/Configure endef define Build/Compile - $(GLUON_CONFIGURE) initial.pl > $(PKG_BUILD_DIR)/initial.sh + $(GLUON_CONFIGURE) invariant.pl > $(PKG_BUILD_DIR)/invariant.sh endef define Package/gluon-simple-tc/install $(CP) ./files/* $(1)/ - $(INSTALL_DIR) $(1)/lib/gluon/upgrade/simple-tc/initial - $(INSTALL_BIN) $(PKG_BUILD_DIR)/initial.sh $(1)/lib/gluon/upgrade/simple-tc/initial/010-site-defaults + $(INSTALL_DIR) $(1)/lib/gluon/upgrade/simple-tc/invariant + $(INSTALL_BIN) $(PKG_BUILD_DIR)/invariant.sh $(1)/lib/gluon/upgrade/simple-tc/invariant/010-site-defaults endef $(eval $(call BuildPackage,gluon-simple-tc)) diff --git a/package/gluon-simple-tc/initial.pl b/package/gluon-simple-tc/invariant.pl similarity index 64% rename from package/gluon-simple-tc/initial.pl rename to package/gluon-simple-tc/invariant.pl index fdffdc84..6b91a951 100644 --- a/package/gluon-simple-tc/initial.pl +++ b/package/gluon-simple-tc/invariant.pl @@ -1,23 +1,18 @@ my $cfg = $CONFIG->{simple_tc}; -print <<'END'; -#/bin/sh - -uci -q batch <{$name}; + print "uci -q get gluon-simple-tc.$name >/dev/null || uci -q batch <{$_}\n"; } + + print "EOF\n\n"; } -print < Date: Mon, 20 Jan 2014 01:59:10 +0100 Subject: [PATCH 134/453] Merge gluon-release into gluon-core --- package/gluon-autoupdater/Makefile | 2 +- .../generate/lib/gluon/release | 0 package/gluon-release/Makefile | 36 ------------------- 3 files changed, 1 insertion(+), 37 deletions(-) rename package/{gluon-release => gluon-core}/generate/lib/gluon/release (100%) delete mode 100644 package/gluon-release/Makefile diff --git a/package/gluon-autoupdater/Makefile b/package/gluon-autoupdater/Makefile index d856851f..7d025176 100644 --- a/package/gluon-autoupdater/Makefile +++ b/package/gluon-autoupdater/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/package.mk define Package/gluon-autoupdater SECTION:=gluon CATEGORY:=Gluon - DEPENDS:=+ecdsautils +gluon-cron +gluon-release + DEPENDS:=+gluon-core +gluon-cron +ecdsautils TITLE:=Automatically update firmware endef diff --git a/package/gluon-release/generate/lib/gluon/release b/package/gluon-core/generate/lib/gluon/release similarity index 100% rename from package/gluon-release/generate/lib/gluon/release rename to package/gluon-core/generate/lib/gluon/release diff --git a/package/gluon-release/Makefile b/package/gluon-release/Makefile deleted file mode 100644 index 0eaa181c..00000000 --- a/package/gluon-release/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -include $(TOPDIR)/rules.mk - -PKG_NAME:=gluon-release -PKG_VERSION:=1 -PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) - -PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) - -include $(INCLUDE_DIR)/package.mk - -define Package/gluon-release - SECTION:=gluon - CATEGORY:=Gluon - TITLE:=A file containing the current release - DEPENDS:=+gluon-core -endef - -define Package/gluon-release/description - This packages creates /lib/gluon/release. -endef - -define Build/Prepare - mkdir -p $(PKG_BUILD_DIR) -endef - -define Build/Configure -endef - -define Build/Compile -endef - -define Package/gluon-release/install - $(GLUON_GENERATE) ./generate/* $(1)/ -endef - -$(eval $(call BuildPackage,gluon-release)) From ee4e896feacf0921d94c362559d50f7ff6e4c96e Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 20 Jan 2014 02:31:24 +0100 Subject: [PATCH 135/453] gluon-core: use GLUON_RELEASE from environment --- package/gluon-core/Makefile | 4 ++++ package/gluon-core/generate/lib/gluon/release | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) delete mode 100644 package/gluon-core/generate/lib/gluon/release diff --git a/package/gluon-core/Makefile b/package/gluon-core/Makefile index a9483a0d..7fa07617 100644 --- a/package/gluon-core/Makefile +++ b/package/gluon-core/Makefile @@ -27,11 +27,15 @@ define Build/Configure endef define Build/Compile + echo "$(GLUON_RELEASE)" > $(PKG_BUILD_DIR)/release endef define Package/gluon-core/install $(CP) ./files/* $(1)/ $(GLUON_GENERATE) ./generate/* $(1)/ + + $(INSTALL_DIR) $(1)/lib/gluon + $(INSTALL_DATA) $(PKG_BUILD_DIR)/release $(1)/lib/gluon/release endef $(eval $(call BuildPackage,gluon-core)) diff --git a/package/gluon-core/generate/lib/gluon/release b/package/gluon-core/generate/lib/gluon/release deleted file mode 100644 index b42b71b1..00000000 --- a/package/gluon-core/generate/lib/gluon/release +++ /dev/null @@ -1 +0,0 @@ -@release@ From 1b924d626517f5f175e1f5208a16cab46c7b926f Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 20 Jan 2014 05:07:55 +0100 Subject: [PATCH 136/453] gluon-core: use gluon release in package version string --- package/gluon-core/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-core/Makefile b/package/gluon-core/Makefile index 7fa07617..c064694f 100644 --- a/package/gluon-core/Makefile +++ b/package/gluon-core/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-core PKG_VERSION:=1 -PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) +PKG_RELEASE:=1.$(GLUON_SITE_CODE)-$(GLUON_RELEASE).$(GLUON_CONFIG_VERSION) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) From f0b63da86813e0d080ad142cc910f174a6e19da7 Mon Sep 17 00:00:00 2001 From: Daniel Ehlers Date: Mon, 20 Jan 2014 00:08:12 +0100 Subject: [PATCH 137/453] gluon-autoupdater: Refactor code. Move building blocks of the update into seperate functions. --- .../files/usr/sbin/autoupdater | 147 +++++++++++------- 1 file changed, 87 insertions(+), 60 deletions(-) diff --git a/package/gluon-autoupdater/files/usr/sbin/autoupdater b/package/gluon-autoupdater/files/usr/sbin/autoupdater index 3c03a8b5..ded49763 100755 --- a/package/gluon-autoupdater/files/usr/sbin/autoupdater +++ b/package/gluon-autoupdater/files/usr/sbin/autoupdater @@ -49,82 +49,109 @@ fi my_version="$(cat "$VERSION_FILE")" -fw_image=$(mktemp) -manifest=$(mktemp) -manifest_upper=$(mktemp) -manifest_lower=$(mktemp) -wget -O$manifest "$BASE"/manifest +fetch_manifest() { + local MIRROR=$1 + wget -O$manifest "$MIRROR"/manifest -if test $? -ne 0; then - echo "Couldn't fetch manifest" >&2 - exit 1 -fi + if test $? -ne 0; then + echo "Couldn't fetch manifest from $MIRROR" >&2 + return 1 + fi +} -awk "BEGIN { sep=0 } +verify_and_analyse_manifest() { + awk "BEGIN { sep=0 } /^---\$/ { sep=1; next } { if(sep==0) print > \"$manifest_upper\"; else print > \"$manifest_lower\"}" \ $manifest -signatures="" -while read sig; do - echo "$sig" | grep -q "^[0-9a-f]\{128\}$" + local signatures="" + while read sig; do + echo "$sig" | grep -q "^[0-9a-f]\{128\}$" + if test $? -ne 0; then + continue + fi + signatures="$signatures -s $sig" + done < $manifest_lower + + local pubkeys="" + for key in $PUBKEYS; do + pubkeys="$pubkeys -p $key" + done + + ecdsaverify -n $GOOD_SIGNATURES $pubkeys $signatures $manifest_upper + if test $? -ne 0; then - continue + echo "Not enough valid signatures!" >&2 + return 1 fi - signatures="$signatures -s $sig" -done < $manifest_lower -pubkeys="" -for key in $PUBKEYS; do - pubkeys="$pubkeys -p $key" -done + grep -q "^BRANCH=${BRANCH}$" $manifest_upper -ecdsaverify -n $GOOD_SIGNATURES $pubkeys $signatures $manifest_upper - -if test $? -ne 0; then - echo "Not enough valid signatures!" >&2 - exit 1 -fi - -grep -q "^BRANCH=${BRANCH}$" $manifest_upper - -if test $? -ne 0; then - echo "Wrong branch. We are on ${BRANCH}" >&2 - exit 1 -fi - -my_firmware=$(grep "^${my_model} " $manifest_upper) - -if test $? -ne 0; then - echo "No matching firmware found (model ${my_model})" >&2 - exit 1 -fi - -fw_version=$(echo "${my_firmware}"|cut -d' ' -f2) -fw_md5=$(echo "${my_firmware}"|cut -d' ' -f3) -fw_file=$(echo "${my_firmware}"|cut -d' ' -f4) - -if newer_than "$fw_version" "$my_version"; then - echo "New version available" - wget -O$fw_image "${BASE}/${fw_file}" if test $? -ne 0; then - echo "Error downloading image" >&2 - exit 1 + echo "Wrong branch. We are on ${BRANCH}" >&2 + return 1 fi - image_md5=$(md5sum "$fw_image"|cut -b-32) - if test "$image_md5" != "$fw_md5"; then - echo "Invalid image checksum" >&2 - exit 1 + local my_firmware=$(grep "^${my_model} " $manifest_upper) + + if test $? -ne 0; then + echo "No matching firmware found (model ${my_model})" >&2 + return 1 fi - echo "Upgrading firmware." + fw_version=$(echo "${my_firmware}"|cut -d' ' -f2) + fw_md5=$(echo "${my_firmware}"|cut -d' ' -f3) + fw_file=$(echo "${my_firmware}"|cut -d' ' -f4) - sysupgrade "${fw_image}" -else - echo "No new firmware available" -fi + return 0 +} -exit 0 +fetch_firmware() { + local MIRROR=$1 + + wget -O$fw_image "${MIRROR}/${fw_file}" + + if test $? -ne 0; then + echo "Error downloading image from $MIRROR" >&2 + return 1 + else + return 0 + fi +} + +autoupdate() { + local MIRROR=$1 + + fw_image=$(mktemp) + manifest=$(mktemp) + manifest_upper=$(mktemp) + manifest_lower=$(mktemp) + + fetch_manifest $MIRROR || return 1 + verify_and_analyse_manifest || return 1 + + if newer_than "$fw_version" "$my_version"; then + echo "New version available" + + fetch_firmware $MIRROR || return 1 + + image_md5=$(md5sum "$fw_image"|cut -b-32) + if test "$image_md5" != "$fw_md5"; then + echo "Invalid image checksum" >&2 + return 1 + fi + echo "Upgrading firmware." + + sysupgrade "${fw_image}" + else + echo "No new firmware available" + fi + + return 0 +} + + +autoupdate $BASE && exit 0 From cb6c025a7f455142060918a3c583c60f13afe46a Mon Sep 17 00:00:00 2001 From: Daniel Ehlers Date: Mon, 20 Jan 2014 00:50:37 +0100 Subject: [PATCH 138/453] gluon-autoupdater: Less global variables. This also removes the need for the cleanup function. Instead the cleanup code is moved in place. --- .../files/usr/sbin/autoupdater | 74 +++++++++++-------- 1 file changed, 43 insertions(+), 31 deletions(-) diff --git a/package/gluon-autoupdater/files/usr/sbin/autoupdater b/package/gluon-autoupdater/files/usr/sbin/autoupdater index ded49763..99ff78f4 100755 --- a/package/gluon-autoupdater/files/usr/sbin/autoupdater +++ b/package/gluon-autoupdater/files/usr/sbin/autoupdater @@ -30,37 +30,24 @@ newer_than() { test "$1" != "$old" } -cleanup() { - rm -f $manifest - rm -f $fw_image - rm -f $manifest_upper - rm -f $manifest_lower -} - -trap cleanup INT TERM EXIT PIPE - -. /lib/gluon/functions/model.sh -my_model="$(get_model | tr '[A-Z]' '[a-z]' | sed -r 's/[^a-z0-9]+/-/g;s/-$//')" - -if [ ! -f "$VERSION_FILE" ]; then - echo "Couldn't determine firmware version!" >&2 - exit 1 -fi - -my_version="$(cat "$VERSION_FILE")" - - fetch_manifest() { local MIRROR=$1 + local manifest=$2 + wget -O$manifest "$MIRROR"/manifest if test $? -ne 0; then echo "Couldn't fetch manifest from $MIRROR" >&2 return 1 fi + + return 0 } -verify_and_analyse_manifest() { +verify_manifest() { + local manifest=$1 + local manifest_upper=$2 + local manifest_lower=$(mktemp) awk "BEGIN { sep=0 } /^---\$/ { sep=1; next } { if(sep==0) print > \"$manifest_upper\"; @@ -81,6 +68,8 @@ verify_and_analyse_manifest() { pubkeys="$pubkeys -p $key" done + rm -f $manifest_lower + ecdsaverify -n $GOOD_SIGNATURES $pubkeys $signatures $manifest_upper if test $? -ne 0; then @@ -88,6 +77,12 @@ verify_and_analyse_manifest() { return 1 fi + return 0 +} + +analyse_manifest() { + local manifest_upper=$1 + grep -q "^BRANCH=${BRANCH}$" $manifest_upper if test $? -ne 0; then @@ -95,7 +90,8 @@ verify_and_analyse_manifest() { return 1 fi - local my_firmware=$(grep "^${my_model} " $manifest_upper) + local my_firmware + my_firmware=$(grep "^${my_model} " $manifest_upper) if test $? -ne 0; then echo "No matching firmware found (model ${my_model})" >&2 @@ -111,36 +107,41 @@ verify_and_analyse_manifest() { fetch_firmware() { local MIRROR=$1 + local fw_image=$2 wget -O$fw_image "${MIRROR}/${fw_file}" if test $? -ne 0; then echo "Error downloading image from $MIRROR" >&2 return 1 - else - return 0 fi + + return 0 } autoupdate() { local MIRROR=$1 - fw_image=$(mktemp) - manifest=$(mktemp) - manifest_upper=$(mktemp) - manifest_lower=$(mktemp) + local manifest=$(mktemp) + fetch_manifest $MIRROR $manifest || { rm -f $manifest; return 1; } - fetch_manifest $MIRROR || return 1 - verify_and_analyse_manifest || return 1 + local manifest_upper=$(mktemp) + verify_manifest $manifest $manifest_upper || { rm -f $manifest $manifest_upper; return 1; } + rm -f $manifest + + analyse_manifest $manifest_upper || { rm -f $manifest_upper; return 1; } + rm -f $manifest_upper if newer_than "$fw_version" "$my_version"; then echo "New version available" - fetch_firmware $MIRROR || return 1 + local fw_image=$(mktemp) + fetch_firmware $MIRROR $fw_image || { rm -f $fw_image; return 1; } image_md5=$(md5sum "$fw_image"|cut -b-32) if test "$image_md5" != "$fw_md5"; then echo "Invalid image checksum" >&2 + rm -f $fw_image return 1 fi echo "Upgrading firmware." @@ -153,5 +154,16 @@ autoupdate() { return 0 } +trap 'echo Signal ignored.' INT TERM PIPE + +. /lib/gluon/functions/model.sh +my_model="$(get_model | tr '[A-Z]' '[a-z]' | sed -r 's/[^a-z0-9]+/-/g;s/-$//')" + +if [ ! -f "$VERSION_FILE" ]; then + echo "Couldn't determine firmware version!" >&2 + exit 1 +fi + +my_version="$(cat "$VERSION_FILE")" autoupdate $BASE && exit 0 From 27871c0dc3697fd16ef845b3808b8c032ca6ba43 Mon Sep 17 00:00:00 2001 From: Daniel Ehlers Date: Mon, 20 Jan 2014 00:10:05 +0100 Subject: [PATCH 139/453] gluon-autoupdater: Enable list of mirrors for manifest and firmware. Instead of a single url this patch allows to have a list of urls. So in case of network instability a router can still reach local mesh-cloud server to pull a update from. In this stage the autoupdater simply tries every mirror until one passes all tests. --- .../gluon-autoupdater/files/usr/sbin/autoupdater | 13 +++++++++++-- package/gluon-autoupdater/invariant.pl | 6 +++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/package/gluon-autoupdater/files/usr/sbin/autoupdater b/package/gluon-autoupdater/files/usr/sbin/autoupdater index 99ff78f4..773d67c7 100755 --- a/package/gluon-autoupdater/files/usr/sbin/autoupdater +++ b/package/gluon-autoupdater/files/usr/sbin/autoupdater @@ -19,7 +19,7 @@ if test "a$1" != "a-f"; then fi fi -BASE=$(uci get autoupdater.${BRANCH}.url) +MIRRORS=$(uci get autoupdater.${BRANCH}.mirror) PUBKEYS=$(uci get autoupdater.${BRANCH}.pubkey) GOOD_SIGNATURES=$(uci get autoupdater.${BRANCH}.good_signatures) @@ -166,4 +166,13 @@ fi my_version="$(cat "$VERSION_FILE")" -autoupdate $BASE && exit 0 +for mirror in $MIRRORS; do + + autoupdate $mirror && exit 0 + + unset fw_version + unset fw_md5 + unset fw_file + +done + diff --git a/package/gluon-autoupdater/invariant.pl b/package/gluon-autoupdater/invariant.pl index 31848133..493eb299 100644 --- a/package/gluon-autoupdater/invariant.pl +++ b/package/gluon-autoupdater/invariant.pl @@ -28,10 +28,14 @@ delete autoupdater.$name set autoupdater.$name=branch END - for (qw(url probability good_signatures)) { + for (qw(probability good_signatures)) { print "set autoupdater.$name.$_=$branch->{$_}\n"; } + for (@{$branch->{mirrors}}) { + print "add_list autoupdater.$name.mirror=$_\n"; + } + for (@{$branch->{pubkeys}}) { print "add_list autoupdater.$name.pubkey=$_\n"; } From 72e7ae68faaf86ba07a2e2f05e3e7e88a209de78 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 21 Jan 2014 00:10:00 +0100 Subject: [PATCH 140/453] gluon-autoupdater: adjust example config for mirror support --- package/gluon-autoupdater/files/etc/config/autoupdater | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-autoupdater/files/etc/config/autoupdater b/package/gluon-autoupdater/files/etc/config/autoupdater index 07e34d80..573f5666 100644 --- a/package/gluon-autoupdater/files/etc/config/autoupdater +++ b/package/gluon-autoupdater/files/etc/config/autoupdater @@ -3,7 +3,7 @@ # option branch "stable" #config branch stable -# option url 'http://[fdef:ffc0:3dd7::8]/~freifunk/firmware/autoupdate' +# list mirror 'http://[fdef:ffc0:3dd7::8]/~freifunk/firmware/autoupdate' # The updater will run once per hour and perform an update with a certain # probability. From 10d6c1930d71b04b7e96bf03c93d7dee23c021a0 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 21 Jan 2014 00:29:55 +0100 Subject: [PATCH 141/453] gluon-autoupdater: allow configuring the branch name independently of the UCI config section name --- package/gluon-autoupdater/files/etc/config/autoupdater | 3 +++ package/gluon-autoupdater/files/usr/sbin/autoupdater | 5 +++-- package/gluon-autoupdater/invariant.pl | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/package/gluon-autoupdater/files/etc/config/autoupdater b/package/gluon-autoupdater/files/etc/config/autoupdater index 573f5666..b07cf7fc 100644 --- a/package/gluon-autoupdater/files/etc/config/autoupdater +++ b/package/gluon-autoupdater/files/etc/config/autoupdater @@ -3,6 +3,9 @@ # option branch "stable" #config branch stable + # The branch name given in the manifest +# option name 'stable' + # list mirror 'http://[fdef:ffc0:3dd7::8]/~freifunk/firmware/autoupdate' # The updater will run once per hour and perform an update with a certain diff --git a/package/gluon-autoupdater/files/usr/sbin/autoupdater b/package/gluon-autoupdater/files/usr/sbin/autoupdater index 773d67c7..5e351b40 100755 --- a/package/gluon-autoupdater/files/usr/sbin/autoupdater +++ b/package/gluon-autoupdater/files/usr/sbin/autoupdater @@ -19,6 +19,7 @@ if test "a$1" != "a-f"; then fi fi +BRANCH_NAME=$(uci get autoupdater.${BRANCH}.name) MIRRORS=$(uci get autoupdater.${BRANCH}.mirror) PUBKEYS=$(uci get autoupdater.${BRANCH}.pubkey) GOOD_SIGNATURES=$(uci get autoupdater.${BRANCH}.good_signatures) @@ -83,10 +84,10 @@ verify_manifest() { analyse_manifest() { local manifest_upper=$1 - grep -q "^BRANCH=${BRANCH}$" $manifest_upper + grep -q "^BRANCH=${BRANCH_NAME}$" $manifest_upper if test $? -ne 0; then - echo "Wrong branch. We are on ${BRANCH}" >&2 + echo "Wrong branch. We are on ${BRANCH_NAME}" >&2 return 1 fi diff --git a/package/gluon-autoupdater/invariant.pl b/package/gluon-autoupdater/invariant.pl index 493eb299..c6bb3b72 100644 --- a/package/gluon-autoupdater/invariant.pl +++ b/package/gluon-autoupdater/invariant.pl @@ -28,7 +28,7 @@ delete autoupdater.$name set autoupdater.$name=branch END - for (qw(probability good_signatures)) { + for (qw(name probability good_signatures)) { print "set autoupdater.$name.$_=$branch->{$_}\n"; } From 1ba10ac018c92f33cf6d468b717742e041008995 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 21 Jan 2014 03:01:12 +0100 Subject: [PATCH 142/453] Add support for custom dnsmasq config and odhcp6c handler scripts --- package/gluon-core/files/etc/odhcp6c.user | 3 +++ package/gluon-core/files/lib/gluon/dnsmasq.d/.keep | 0 package/gluon-core/files/lib/gluon/odhcp6c.d/.keep | 0 .../files/lib/gluon/upgrade/core/invariant/010-dnsmasq.d | 3 +++ 4 files changed, 6 insertions(+) create mode 100644 package/gluon-core/files/etc/odhcp6c.user create mode 100644 package/gluon-core/files/lib/gluon/dnsmasq.d/.keep create mode 100644 package/gluon-core/files/lib/gluon/odhcp6c.d/.keep create mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/invariant/010-dnsmasq.d diff --git a/package/gluon-core/files/etc/odhcp6c.user b/package/gluon-core/files/etc/odhcp6c.user new file mode 100644 index 00000000..14a96ebf --- /dev/null +++ b/package/gluon-core/files/etc/odhcp6c.user @@ -0,0 +1,3 @@ +for file in /lib/gluon/odhcp6c.d/*; do + [ ! -x $file ] || $file +done diff --git a/package/gluon-core/files/lib/gluon/dnsmasq.d/.keep b/package/gluon-core/files/lib/gluon/dnsmasq.d/.keep new file mode 100644 index 00000000..e69de29b diff --git a/package/gluon-core/files/lib/gluon/odhcp6c.d/.keep b/package/gluon-core/files/lib/gluon/odhcp6c.d/.keep new file mode 100644 index 00000000..e69de29b diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/invariant/010-dnsmasq.d b/package/gluon-core/files/lib/gluon/upgrade/core/invariant/010-dnsmasq.d new file mode 100755 index 00000000..8e84c1f5 --- /dev/null +++ b/package/gluon-core/files/lib/gluon/upgrade/core/invariant/010-dnsmasq.d @@ -0,0 +1,3 @@ +#!/bin/sh + +echo 'conf-dir=/lib/gluon/dnsmasq.d' > /etc/dnsmasq.conf From 1ceb38ac26e9203bfb4770f864ede702529ca9d4 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 21 Jan 2014 03:05:42 +0100 Subject: [PATCH 143/453] gluon-mesh-batman-adv: more initial -> invariant conversions --- .../upgrade/mesh-batman-adv/initial/010-mesh | 25 -------------- .../mesh-batman-adv/invariant/011-mesh | 33 +++++++++++++++++++ 2 files changed, 33 insertions(+), 25 deletions(-) create mode 100755 package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh index 5632f6da..6fca7533 100755 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh @@ -4,12 +4,6 @@ . /lib/gluon/functions/sysconfig.sh -uci_remove batman-adv bat0 -uci_add batman-adv mesh bat0 -uci_set batman-adv bat0 orig_interval '5000' -uci_set batman-adv bat0 gw_mode 'client' -uci_commit batman-adv - uci_add network interface client uci_set network client ifname "$(sysconfig lan_ifname) bat0" uci_set network client type 'bridge' @@ -18,23 +12,4 @@ uci_set network client reqprefix 'no' uci_set network client peerdns '0' uci_set network client macaddr "$(sysconfig primary_mac)" -uci_add network interface bat0 -uci_set network bat0 ifname 'bat0' -uci_set network bat0 proto 'none' -uci_set network bat0 macaddr "$(sysconfig primary_mac)" -uci_commit network - -uci_add firewall zone client -uci_set firewall client name 'client' -uci add_list firewall.client.network='client' -uci_set firewall client input 'ACCEPT' -uci_set firewall client output 'ACCEPT' -uci_set firewall client forward 'REJECT' -uci_commit firewall - -uci_add dhcp dhcp client -uci_set dhcp client interface 'client' -uci_set dhcp client ignore '1' -uci_commit dhcp - echo 'net.ipv6.conf.br-client.forwarding=0' >> /etc/sysctl.conf diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh new file mode 100755 index 00000000..6398d2c3 --- /dev/null +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh @@ -0,0 +1,33 @@ +#!/bin/sh + +. /lib/functions.sh +. /lib/gluon/functions/sysconfig.sh + + +uci_remove batman-adv bat0 +uci_add batman-adv mesh bat0 +uci_set batman-adv bat0 orig_interval '5000' +uci_set batman-adv bat0 gw_mode 'client' +uci_commit batman-adv + +uci_remove network bat0 +uci_add network interface bat0 +uci_set network bat0 ifname 'bat0' +uci_set network bat0 proto 'none' +uci_set network bat0 macaddr "$(sysconfig primary_mac)" +uci_commit network + +uci_remove firewall client +uci_add firewall zone client +uci_set firewall client name 'client' +uci add_list firewall.client.network='client' +uci_set firewall client input 'ACCEPT' +uci_set firewall client output 'ACCEPT' +uci_set firewall client forward 'REJECT' +uci_commit firewall + +uci_remove dhcp client +uci_add dhcp dhcp client +uci_set dhcp client interface 'client' +uci_set dhcp client ignore '1' +uci_commit dhcp From e57e88ee6c3359c2dbdced9b7a12f35249ed1bcc Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 21 Jan 2014 03:59:15 +0100 Subject: [PATCH 144/453] gluon-mesh-batman-adv: add DNS support --- .../gluon/dnsmasq.d/010-mesh-batman-adv.conf | 1 + .../mesh-batman-adv/invariant/011-mesh | 4 ++++ .../lib/gluon/odhcp6c.d/010-mesh-batman-adv | 21 +++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 120000 package/gluon-mesh-batman-adv/files/lib/gluon/dnsmasq.d/010-mesh-batman-adv.conf create mode 100755 package/gluon-mesh-batman-adv/generate/lib/gluon/odhcp6c.d/010-mesh-batman-adv diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/dnsmasq.d/010-mesh-batman-adv.conf b/package/gluon-mesh-batman-adv/files/lib/gluon/dnsmasq.d/010-mesh-batman-adv.conf new file mode 120000 index 00000000..f4b89cbe --- /dev/null +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/dnsmasq.d/010-mesh-batman-adv.conf @@ -0,0 +1 @@ +/var/gluon/mesh-batman-adv/dnsmasq.conf \ No newline at end of file diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh index 6398d2c3..5ce85c61 100755 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh @@ -26,6 +26,10 @@ uci_set firewall client output 'ACCEPT' uci_set firewall client forward 'REJECT' uci_commit firewall +uci_set dhcp '@dnsmasq[0]' boguspriv '0' +uci_set dhcp '@dnsmasq[0]' localise_queries '0' +uci_set dhcp '@dnsmasq[0]' rebind_protection '0' + uci_remove dhcp client uci_add dhcp dhcp client uci_set dhcp client interface 'client' diff --git a/package/gluon-mesh-batman-adv/generate/lib/gluon/odhcp6c.d/010-mesh-batman-adv b/package/gluon-mesh-batman-adv/generate/lib/gluon/odhcp6c.d/010-mesh-batman-adv new file mode 100755 index 00000000..5f702522 --- /dev/null +++ b/package/gluon-mesh-batman-adv/generate/lib/gluon/odhcp6c.d/010-mesh-batman-adv @@ -0,0 +1,21 @@ +#!/bin/sh + +[ "$INTERFACE" = 'client' ] || exit 0 + +mkdir -p /var/gluon/mesh-batman-adv + +for ns in $RDNSS $RA_DNS; do + for domain in @mesh_domains@; do + echo "server=/$domain/$ns" + done +done > /var/gluon/mesh-batman-adv/dnsmasq.conf.$$ + +if cmp -s /var/gluon/mesh-batman-adv/dnsmasq.conf.$$ /var/gluon/mesh-batman-adv/dnsmasq.conf; then + rm /var/gluon/mesh-batman-adv/dnsmasq.conf.$$ + exit 0 +fi + +lock /var/gluon/mesh-batman-adv/dnsmasq.conf.lock +mv -f /var/gluon/mesh-batman-adv/dnsmasq.conf.$$ /var/gluon/mesh-batman-adv/dnsmasq.conf +/etc/init.d/dnsmasq restart +lock -u /var/gluon/mesh-batman-adv/dnsmasq.conf.lock From e03fb9f8eb0dffb46f66831a8b16eeba050ecdc9 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 21 Jan 2014 04:16:21 +0100 Subject: [PATCH 145/453] gluon-core: add support for NTP server configuration --- .../lib/gluon/upgrade/core/invariant/011-ntp-servers | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 package/gluon-core/generate/lib/gluon/upgrade/core/invariant/011-ntp-servers diff --git a/package/gluon-core/generate/lib/gluon/upgrade/core/invariant/011-ntp-servers b/package/gluon-core/generate/lib/gluon/upgrade/core/invariant/011-ntp-servers new file mode 100755 index 00000000..fa69b053 --- /dev/null +++ b/package/gluon-core/generate/lib/gluon/upgrade/core/invariant/011-ntp-servers @@ -0,0 +1,12 @@ +#!/bin/sh + +[ -n '@ntp_servers@' ] || exit 0 + + +uci delete system.ntp.server + +for server in @ntp_servers@; do + uci add_list system.ntp.server="$server" +done + +uci commit system From c7991c6df49b54bded5fa99041a1e215d7f00ca4 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 21 Jan 2014 04:45:56 +0100 Subject: [PATCH 146/453] gluon-autoupdater: add more models to README This adds a list of known models to the readme. --- package/gluon-autoupdater/README.md | 34 +++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/package/gluon-autoupdater/README.md b/package/gluon-autoupdater/README.md index 1caf1813..9cba91b5 100644 --- a/package/gluon-autoupdater/README.md +++ b/package/gluon-autoupdater/README.md @@ -1,5 +1,35 @@ Models ====== -tp-link-tl-wr741n/nd-v4 -tp-link-tl-wr1043n/nd-v1 +Ubiquity +-------- + +ubiquity-nanostation-m (dual ethernet) +ubiquity-bullet-m (single ethernet: Bullet M, Nanostation loco M) + +TP-Link +------- + +tp-link-tl-mr3020 +tp-link-tl-mr3040 +tp-link-tl-mr3220 +tp-link-tl-mr3420 +tp-link-tl-wdr3600-v1 +tp-link-tl-wdr4300-v1 +tp-link-tl-wdr4310-v1 +tp-link-tl-wr740n-nd-v1 +tp-link-tl-wr740n-nd-v3 +tp-link-tl-wr740n-nd-v4 +tp-link-tl-wr741n-nd-v1 +tp-link-tl-wr741n-nd-v2 +tp-link-tl-wr741n-nd-v4 +tp-link-tl-wr841n-nd-v8 +tp-link-tl-wr841n-nd-v1.5 +tp-link-tl-wr841n-nd-v3 +tp-link-tl-wr841n-nd-v5 +tp-link-tl-wr841n-nd-v7 +tp-link-tl-wr842n-nd-v1 +tp-link-tl-wr941n-nd-v2 +tp-link-tl-wr941n-nd-v3 +tp-link-tl-wr941n-nd-v4 +tp-link-tl-wr1043n-nd-v1 From f1dae6ca6eac1764d0967359c475ff5d70bc744e Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 21 Jan 2014 05:11:42 +0100 Subject: [PATCH 147/453] gluon-core: move initial/020-wireless from generate to files --- .../lib/gluon/upgrade/core/initial/020-wireless | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename package/gluon-core/{generate => files}/lib/gluon/upgrade/core/initial/020-wireless (100%) diff --git a/package/gluon-core/generate/lib/gluon/upgrade/core/initial/020-wireless b/package/gluon-core/files/lib/gluon/upgrade/core/initial/020-wireless similarity index 100% rename from package/gluon-core/generate/lib/gluon/upgrade/core/initial/020-wireless rename to package/gluon-core/files/lib/gluon/upgrade/core/initial/020-wireless From ff166453d4f035d9b2a237b21e589d368cb92609 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 21 Jan 2014 05:17:00 +0100 Subject: [PATCH 148/453] gluon-mesh-batman-adv: accept input on wan interface --- .../lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh index 5ce85c61..755a9c57 100755 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh @@ -24,6 +24,14 @@ uci add_list firewall.client.network='client' uci_set firewall client input 'ACCEPT' uci_set firewall client output 'ACCEPT' uci_set firewall client forward 'REJECT' + +config_load firewall +accept_input_on_wan() { + config_get name "$1" name + [ "$name" = 'wan' ] && uci_set firewall "$1" input 'ACCEPT' +} +config_foreach accept_input_on_wan 'zone' + uci_commit firewall uci_set dhcp '@dnsmasq[0]' boguspriv '0' From 2062d1fcb69e6dfaacc8b2adcb35cf4aa17c6b2e Mon Sep 17 00:00:00 2001 From: Daniel Ehlers Date: Tue, 21 Jan 2014 00:39:53 +0100 Subject: [PATCH 149/453] gluon-luci-autoupdater: Catch up mirror support in gluon-autoupdater --- .../files/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-luci-autoupdater/files/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua b/package/gluon-luci-autoupdater/files/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua index 0fbc85d7..f3197245 100644 --- a/package/gluon-luci-autoupdater/files/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua +++ b/package/gluon-luci-autoupdater/files/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua @@ -25,7 +25,7 @@ uci.cursor():foreach("autoupdater", "branch", function (section) f:value(section s = m:section(TypedSection, "branch", "Branches") s.addremove = true -s:option(Value, "url", "URL") +s:option(DynamicList, "mirror", "Mirrors") s:option(Value, "probability", "Update Wahrscheinlichkeit") s:option(Value, "good_signatures", "Benötigte Signaturen") From 2f5524fdb4c4a94149cb91d270d82c4102e4e80f Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 21 Jan 2014 00:19:13 +0100 Subject: [PATCH 150/453] gluon-autoupdater: Randomize mirror order This way we have a kind of load balancing among the mirrors. --- package/gluon-autoupdater/files/usr/sbin/autoupdater | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package/gluon-autoupdater/files/usr/sbin/autoupdater b/package/gluon-autoupdater/files/usr/sbin/autoupdater index 5e351b40..88e64346 100755 --- a/package/gluon-autoupdater/files/usr/sbin/autoupdater +++ b/package/gluon-autoupdater/files/usr/sbin/autoupdater @@ -20,7 +20,9 @@ if test "a$1" != "a-f"; then fi BRANCH_NAME=$(uci get autoupdater.${BRANCH}.name) -MIRRORS=$(uci get autoupdater.${BRANCH}.mirror) +MIRRORS=$(for mirror in $(uci get autoupdater.${BRANCH}.mirror); do \ + hexdump -n1 -e '/1 "%d '"$mirror"'\n"' /dev/urandom; \ + done | sort -n | cut -d' ' -f2) PUBKEYS=$(uci get autoupdater.${BRANCH}.pubkey) GOOD_SIGNATURES=$(uci get autoupdater.${BRANCH}.good_signatures) From bb3e93b55d37d244df221d0cc212850640fb8f91 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 21 Jan 2014 19:48:19 +0100 Subject: [PATCH 151/453] gluon-config-mode: more compact tc form Hide the downstream/upstream input fields when bandwitdh limiting is disabled. --- .../usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua index 4d8898bd..2c36dda1 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua @@ -33,11 +33,13 @@ o.rmempty = false o.description = "Begrenzt die Geschwindigkeit, mit der dieser Knoten auf das Internet zugreifen darf. Kann aktiviert werden, wenn der eigene Internetanschluss durch den Freifunkknoten merklich ausgebremst wird." o = s:option(Value, "_limit_ingress", "Downstream") +o:depends("_limit_enabled", "1") o.value = uci:get("gluon-simple-tc", meshvpn_name, "limit_ingress") o.rmempty = false o.datatype = "integer" o = s:option(Value, "_limit_egress", "Upstream") +o:depends("_limit_enabled", "1") o.value = uci:get("gluon-simple-tc", meshvpn_name, "limit_egress") o.rmempty = false o.datatype = "integer" From 566faeb6ca9ba02436537a20145e8948a3ca581d Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 21 Jan 2014 20:02:17 +0100 Subject: [PATCH 152/453] gluon-config-mode: bwlimit hidden when not meshvpn Hide the bandwidth limit checkbox when meshvpn is disabled. --- .../usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua index 2c36dda1..e3d6afbd 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua @@ -28,6 +28,7 @@ o.default = uci:get_bool("fastd", meshvpn_name, "enabled") and o.enabled or o.di o.rmempty = false o = s:option(Flag, "_limit_enabled", "Bandbreitenbegrenzung aktivieren?") +o:depends("_meshvpn", "1") o.default = uci:get_bool("gluon-simple-tc", meshvpn_name, "enabled") and o.enabled or o.disabled o.rmempty = false o.description = "Begrenzt die Geschwindigkeit, mit der dieser Knoten auf das Internet zugreifen darf. Kann aktiviert werden, wenn der eigene Internetanschluss durch den Freifunkknoten merklich ausgebremst wird." From 5b8e044893d01fc4d5044094f7b4c9ce7975c4dd Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 21 Jan 2014 22:19:25 +0100 Subject: [PATCH 153/453] gluon-config-mode: fix wizard Due to my previous two commits configmode was broken when either meshvpn or bandwidth limit was disabled. This fixes it but there may be a cleaner solution provided by luci. --- .../model/cbi/gluon-config-mode/wizard.lua | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua index e3d6afbd..517cf2b7 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua @@ -69,12 +69,22 @@ function f.handle(self, state, data) uci:save("autoupdater") uci:commit("autoupdater") - uci:set("gluon-simple-tc", meshvpn_name, "interface") - uci:set("gluon-simple-tc", meshvpn_name, "enabled", data._limit_enabled) - uci:set("gluon-simple-tc", meshvpn_name, "ifname", "mesh-vpn") - uci:set("gluon-simple-tc", meshvpn_name, "limit_ingress", data._limit_ingress) - uci:set("gluon-simple-tc", meshvpn_name, "limit_egress", data._limit_egress) - uci:commit("gluon-simple-tc") + -- checks for nil needed due to o:depends(...) + if data._limit_enabled ~= nil then + uci:set("gluon-simple-tc", meshvpn_name, "interface") + uci:set("gluon-simple-tc", meshvpn_name, "enabled", data._limit_enabled) + uci:set("gluon-simple-tc", meshvpn_name, "ifname", "mesh-vpn") + + if data._limit_ingress ~= nil then + uci:set("gluon-simple-tc", meshvpn_name, "limit_ingress", data._limit_ingress) + end + + if data._limit_egress ~= nil then + uci:set("gluon-simple-tc", meshvpn_name, "limit_egress", data._limit_egress) + end + + uci:commit("gluon-simple-tc") + end uci:set("fastd", meshvpn_name, "enabled", data._meshvpn) uci:save("fastd") From 5e0048ae8496d3f42b60061bd068c94edd04faa3 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 21 Jan 2014 23:42:03 +0100 Subject: [PATCH 154/453] gluon-config-mode: remove 'reset' button The reset button resets the form. I don't think this is needed in a wizard that simple and might confuse users so I removed it. --- .../usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua index 517cf2b7..9c1ee2fb 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua @@ -7,6 +7,7 @@ local f, s, o configmode.setup_fastd_secret(meshvpn_name) f = SimpleForm("wizard", "Willkommen!", "Willkommen zum Einrichtungsassistenten für deinen neuen Lübecker Freifunk-Knoten. Fülle das folgende Formular deinen Vorstellungen entsprechend aus und klicke anschließend auf den „Senden“-Button.") +f.reset = false s = f:section(SimpleSection, "Grundeinstellungen", nil) From 40c4659e18b67a678ebb47392798187eb6861168 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 22 Jan 2014 16:51:26 +0100 Subject: [PATCH 155/453] gluon-luci-theme: new theme, still magenta/yellow This is the initial version of our new configmode theme. It's far from finished but at least configmode looks good. There are lots of declarations copied from OpenWRT's default theme so most other luci modules would be somewhat usable when shown using this theme. --- package/gluon-luci-theme/Makefile | 39 + .../files/etc/uci-defaults/luci-theme-gluon | 6 + .../lib/lua/luci/view/themes/gluon/footer.htm | 19 + .../lib/lua/luci/view/themes/gluon/header.htm | 164 +++ .../files/www/luci-static/gluon/cascade.css | 804 +++++++++++++ package/gluon-luci-theme/sass/cascade.scss | 1014 +++++++++++++++++ 6 files changed, 2046 insertions(+) create mode 100644 package/gluon-luci-theme/Makefile create mode 100755 package/gluon-luci-theme/files/etc/uci-defaults/luci-theme-gluon create mode 100644 package/gluon-luci-theme/files/usr/lib/lua/luci/view/themes/gluon/footer.htm create mode 100644 package/gluon-luci-theme/files/usr/lib/lua/luci/view/themes/gluon/header.htm create mode 100644 package/gluon-luci-theme/files/www/luci-static/gluon/cascade.css create mode 100644 package/gluon-luci-theme/sass/cascade.scss diff --git a/package/gluon-luci-theme/Makefile b/package/gluon-luci-theme/Makefile new file mode 100644 index 00000000..4fc947c4 --- /dev/null +++ b/package/gluon-luci-theme/Makefile @@ -0,0 +1,39 @@ +# Copyright (C) 2013 Nils Schneider +# This is free software, licensed under the Apache 2.0 license. + +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-luci-theme +PKG_VERSION:=0.1 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-luci-theme + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Luci theme for Gluon + DEPENDS:= +endef + +define Package/gluon-luci-theme/description + Luci based config mode +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-luci-theme/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-luci-theme)) diff --git a/package/gluon-luci-theme/files/etc/uci-defaults/luci-theme-gluon b/package/gluon-luci-theme/files/etc/uci-defaults/luci-theme-gluon new file mode 100755 index 00000000..795bd186 --- /dev/null +++ b/package/gluon-luci-theme/files/etc/uci-defaults/luci-theme-gluon @@ -0,0 +1,6 @@ +#!/bin/sh +uci batch <<-EOF + set luci.themes.Gluon=/luci-static/gluon + commit luci +EOF + diff --git a/package/gluon-luci-theme/files/usr/lib/lua/luci/view/themes/gluon/footer.htm b/package/gluon-luci-theme/files/usr/lib/lua/luci/view/themes/gluon/footer.htm new file mode 100644 index 00000000..6b709030 --- /dev/null +++ b/package/gluon-luci-theme/files/usr/lib/lua/luci/view/themes/gluon/footer.htm @@ -0,0 +1,19 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +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$ + +-%> +
+ + + + diff --git a/package/gluon-luci-theme/files/usr/lib/lua/luci/view/themes/gluon/header.htm b/package/gluon-luci-theme/files/usr/lib/lua/luci/view/themes/gluon/header.htm new file mode 100644 index 00000000..c0f10b75 --- /dev/null +++ b/package/gluon-luci-theme/files/usr/lib/lua/luci/view/themes/gluon/header.htm @@ -0,0 +1,164 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008-2010 Jo-Philipp Wich + +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$ + +-%> +<% + local sys = require "luci.sys" + local http = require "luci.http" + local disp = require "luci.dispatcher" + + local hostname = sys.hostname() + local load1, load5, load15 = sys.loadavg() + + local request = disp.context.path + local request2 = disp.context.request + + local category = request[1] + local cattree = category and disp.node(category) + + local leaf = request2[#request2] + + local tree = disp.node() + local node = disp.context.dispatched + + local categories = disp.node_childs(tree) + + local c = tree + local i, r + + -- tag all nodes leading to this page + for i, r in ipairs(request) do + if c.nodes and c.nodes[r] then + c = c.nodes[r] + c._menu_selected = true + end + end + + http.prepare_content("application/xhtml+xml") + + local function nodeurl(prefix, name, query) + local url = controller .. prefix .. name .. "/" + if query then + url = url .. http.build_querystring(query) + end + return pcdata(url) + end + + local function subtree(prefix, node, level) + if not level then + level = 1 + end + + local childs = disp.node_childs(node) + if #childs > 0 then +%> +
+
    + <% + local selected_node + local selected_name + local i, v + + for i, v in ipairs(childs) do + local nnode = node.nodes[v] + if nnode._menu_selected then + selected_node = nnode + selected_name = v + end + %> +
  • + <%=striptags(translate(nnode.title))%> +
  • + <% + end + %> +
+
+<% + if selected_node then + subtree(prefix .. selected_name .. "/", selected_node, level + 1) + end +%> +
+<% + end + end +-%> + + + + + + + + +<% if node and node.css then %> +<% end -%> +<% if css then %> +<% end -%> + +<%=striptags( hostname .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI + + + + + +
+ <% if category then subtree("/" .. category .. "/", cattree) end %> + +
+ diff --git a/package/gluon-luci-theme/files/www/luci-static/gluon/cascade.css b/package/gluon-luci-theme/files/www/luci-static/gluon/cascade.css new file mode 100644 index 00000000..e8fa9f7d --- /dev/null +++ b/package/gluon-luci-theme/files/www/luci-static/gluon/cascade.css @@ -0,0 +1,804 @@ +@charset "UTF-8"; +.lang_he { + direction: RTL; + unicode-bidi: embed; } + +.hidden { + display: none; } + +html { + min-height: 100%; + height: auto; + position: relative; } + +body { + font-family: 'Open Sans', Arial, sans-serif; + font-size: 12pt; + color: #4d4e53; + line-height: 1.5em; + margin: 0; + display: flex; + flex-direction: column; + min-height: 100vh; + background-color: #f3f3f3; } + +a img { + border: none; + text-decoration: none; } + +.tabmenu1 { + text-align: center; } + +ul.tabmenu { + list-style: none; + padding: 0; + margin: 2em 0; + display: inline-flex; } + +ul.tabmenu li { + white-space: nowrap; + margin: 0 0.5em; + padding: 0; + text-align: center; } + ul.tabmenu li a { + display: block; + text-decoration: none; + padding: 1em; + margin: 0; + color: #333; + border-radius: 2em; } + ul.tabmenu li a:hover { + background: #ffe9b3; } + ul.tabmenu li.active a { + font-weight: bold; + background: white; + color: #333; } + +abbr, +acronym { + font-style: normal; + font-variant: normal; } + +abbr[title], +acronym[title] { + border-bottom: 1px dotted; + cursor: help; } + +a:link abbr[title], +a:visited abbr[title], +a:link acronym[title], +a:visited acronym[title] { + cursor: pointer; } + +code { + font-family: monospace; + white-space: pre; } + +#maincontent ul { + margin-left: 2em; } + +.warning { + color: red; + background-color: white; + font-weight: bold; } + +.clear { + clear: both; } + +.error { + color: #ff0000; + background-color: white; } + +div.hostinfo { + margin: 0; + padding: 0; + font-size: 80%; + padding: 0.5em; + flex: 1; + font-weight: bold; } + +#xhr_poll_status { + cursor: pointer; } + +#xhr_poll_status #xhr_poll_status_off { + font-weight: bold; + color: #FF0000; } + +#xhr_poll_status #xhr_poll_status_on { + font-weight: bold; + color: #00FF00; } + +#menubar { + display: flex; + background: #dc0067; + color: #ffffff; } + +#menubar .warning { + color: red; + background-color: #557788; } + +#menubar a:link, +#menubar a:visited { + position: relative; + display: block; + padding: 0.5em; + text-decoration: none; + font-size: 80%; + font-weight: normal; + color: white; } + +#menubar a:link:hover, +#menubar a:visited:hover, +#menubar a:link:focus, +#menubar a:visited:focus { + background: #ffb400; + color: black; } + +#menubar a:link.active, +#menubar a:visited.active { + background: #ffb400; + color: black; + font-weight: bold; } + +#menubar a:link.warning, +#menubar a:visited.warning { + background: #000000; + color: red; + font-weight: bold; } + +#modemenu { + list-style: none; + margin: 0; + padding: 0; } + +#modemenu li { + display: inline-block; } + +.lang_de #submenu_admin_uci { + width: 12em; } + +.lang_ru #submenu_admin_uci { + width: 11.5em; } + +textarea#syslog { + width: 98%; + min-height: 500px; + border: 3px solid #cccccc; + padding: 5px; + font-family: monospace; } + +#maincontent { + padding: 0 1em 2em; + max-width: 60em; + min-width: 40em; + margin: 1em auto; } + +.lang_he #maincontent { + direction: rtl; } + +#maincontent p { + margin-bottom: 1em; } + +.cbi-section { + margin: 0; + padding: 0; + border: none; } + +.cbi-section legend { + font-size: 1.4em; + font-weight: bold; + color: #dc0067; + position: relative; + padding: 0; + margin-bottom: 0.5em; } + +.cbi-section h2 { + margin: 0em 0 0.5em -0.5em !important; } + +.cbi-section h3 { + text-decoration: none !important; + font-weight: bold !important; + color: #555555 !important; + margin: 0.25em !important; + font-size: 100% !important; } + +.cbi-section-descr { + margin-bottom: 2em; } + +.cbi-title-ref { + color: inherit; + text-decoration: none; + padding-right: 18px; + background: url("../resources/cbi/link.gif") no-repeat scroll right center; + background-color: inherit; } + +ul.cbi-apply { + font-size: 90%; } + +input:-webkit-input-placeholder { + color: #AAAAAA; } + +input:-moz-placeholder { + color: #AAAAAA; } + +input:-ms-input-placeholder { + color: #AAAAAA; } + +input[type=checkbox] { + -moz-appearance: none; + -webkit-appearance: none; + -o-appearance: none; + appearance: none; + width: 2em; + height: 2em; + margin: 0; } + input[type=checkbox]:checked { + position: relative; } + input[type=checkbox]:checked::after { + content: '✔'; + color: #dc0067; + vertical-align: middle; + position: absolute; + top: 50%; + left: 0; + margin-top: -0.5em; + width: 100%; + text-align: center; + font-size: 1.7em; } + +input[type=submit], +input[type=reset], +input[type=image], +input[type=button] { + cursor: pointer; } + +select, +input, +textarea { + color: #003247; + border: none; + background: #ffe199; + border-radius: 3pt; + padding: 0.5em; } + +input[type=image] { + border: none; } + +select, +input[type=text], +input[type=password] { + width: 20em; } + +td select, +td input[type=text], +td input[type=password] { + width: 99%; } + +img.cbi-image-button { + cursor: pointer; + margin: 0 2px; + vertical-align: middle; } + +input.cbi-button { + display: inline-block; + zoom: 1; + line-height: normal; + white-space: nowrap; + vertical-align: baseline; + text-align: center; + cursor: pointer; + -webkit-user-drag: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + font-size: 100%; + padding: 0.5em 1em; + color: rgba(0, 0, 0, 0.8); + border: none rgba(0, 0, 0, 0); + background-color: #E6E6E6; + text-decoration: none; + border-radius: 2px; + /* Transitions */ + -webkit-transition: 0.1s linear -webkit-box-shadow; + -moz-transition: 0.1s linear -moz-box-shadow; + -ms-transition: 0.1s linear box-shadow; + -o-transition: 0.1s linear box-shadow; + transition: 0.1s linear box-shadow; + background-repeat: no-repeat; } + input.cbi-button::-moz-focus-inner { + padding: 0; + border: 0; } + input.cbi-button:active { + box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15) inset, 0 0 6px rgba(0, 0, 0, 0.2) inset; } + input.cbi-button:focus { + outline: 0; } + input.cbi-button:hover, input.cbi-button:focus { + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(transparent), color-stop(40%, rgba(0, 0, 0, 0.05)), to(rgba(0, 0, 0, 0.1))); + background-image: -webkit-linear-gradient(transparent, rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.1)); + background-image: -moz-linear-gradient(top, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.1)); + background-image: -o-linear-gradient(transparent, rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.1)); + background-image: linear-gradient(transparent, rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.1)); } + input.cbi-button[disabled] { + border: none; + background-image: none; + opacity: 0.40; + cursor: not-allowed; + box-shadow: none; } + +input.cbi-input-user { + background-image: url("../resources/cbi/user.gif"); + background-repeat: no-repeat; + background-position: 1px center; + color: #000000; + text-indent: 17px; } + +input.cbi-input-find, +input.cbi-button-find { + background-image: url("../resources/cbi/find.gif"); + color: #000000; + padding-left: 17px; } + +input.cbi-input-reload { + background-image: url("../resources/cbi/reload.gif"); + color: #000000; + padding-left: 17px; } + +input.cbi-input-add, +input.cbi-button-add { + background-image: url("../resources/cbi/add.gif"); + color: #000000; + padding-left: 17px; + padding-right: 1px; } + +input.cbi-input-fieldadd, +input.cbi-button-fieldadd { + background-image: url(../resources/cbi/fieldadd.gif); + color: #000000; + padding-left: 17px; + padding-right: 1px; } + +input.cbi-input-reset, +input.cbi-button-reset { + background-color: #ee3300; + color: #fff; } + +input.cbi-input-save, +input.cbi-button-save { + background-color: #009ee0; + color: #fff; } + +input.cbi-input-apply, +input.cbi-button-apply { + background-color: #009ee0; + color: #fff; } + +input.cbi-input-link, +input.cbi-button-link { + background-image: url("../resources/cbi/link.gif"); + color: #000000; + padding-left: 17px; + padding-right: 1px; } + +input.cbi-input-download, +input.cbi-button-download { + background-image: url("../resources/cbi/download.gif"); + color: #000000; + padding-left: 17px; + padding-right: 1px; } + +input.cbi-input-remove, +div.cbi-section-remove input { + background-image: url("../resources/cbi/remove.gif"); + color: #000000; + padding-left: 17px; + padding-right: 1px; } + +input.cbi-button-up { + background-image: url("../resources/cbi/up.gif"); + padding-left: 11px; + padding-right: 1px; } + +input.cbi-button-down { + background-image: url("../resources/cbi/down.gif"); + padding-left: 11px; + padding-right: 1px; } + +input.cbi-button-edit { + background-image: url("../resources/cbi/edit.gif"); + color: #000000; + padding-left: 17px; + padding-right: 1px; } + +input.cbi-button-reload { + background-image: url("../resources/cbi/reload.gif"); + color: #000000; + padding-left: 17px; + padding-right: 1px; } + +input.cbi-button-remove { + background-image: url("../resources/cbi/remove.gif"); + color: #000000; + padding-left: 17px; + padding-right: 1px; } + +.cbi-input-invalid { + background: #ee3300 !important; + color: white; } + +div.cbi-section-remove input { + border-bottom: none; } + +textarea { + margin-left: -1px; + margin-bottom: 0.5em; } + +form > div > input[type=submit], +form > div > input[type=reset] { + margin-left: 0.5em; } + +table td, +table th { + color: #000000; } + +table.smalltext { + background: #f5f5f5; + color: #000000; + border-top: 1px solid #666666; + border-right: 1px solid #666666; + border-bottom: 1px solid #666666; + font-size: 90%; + width: 80%; + margin-left: auto; + margin-right: auto; + border-collapse: collapse; } + +table.smalltext tr:hover td { + background-color: #bbddee; + color: #000000; } + +table.smalltext tr th { + padding: 0 0.25em; + border-left: 1px solid #666666; + text-align: left; } + +table.smalltext tr td { + padding: 0 0.25em; + border-top: 1px solid #666666; + border-left: 1px solid #666666; } + +table.cbi-section-table .cbi-rowstyle-1 { + background-color: #eeeeff; + color: #000000; } + +table.cbi-section-table .cbi-rowstyle-1:hover, +table.cbi-section-table .cbi-rowstyle-2:hover { + background-color: #b2c8d4; + color: #000000; } + +table.cbi-section-table .cbi-section-table-cell { + padding: 3px; + white-space: nowrap; } + +.cbi-section .cbi-rowstyle-1 h3 { + background-color: #eeeeff; + color: #555555; } + +.cbi-rowstyle-2 { + color: #000000; } + +div.cbi-value { + display: flex; + flex-direction: row; + margin-bottom: 0.5em; } + +.cbi-value-title { + flex: 2; + text-align: right; + padding-top: 0.39em; + padding-right: 1em; + font-weight: bold; } + +div.cbi-value-field { + flex: 3; } + +div.cbi-value-description { + font-size: 8pt; } + +div.cbi-section-create { + clear: left; + white-space: nowrap; + vertical-align: top; } + +div.cbi-section-create .cbi-button { + margin: 0.25em; } + +input.cbi-section-create-name { + margin-right: -0.25em; } + +div.cbi-map-descr { + margin-bottom: 1em; } + +.cbi-map-descr:empty, .cbi-section-descr:empty { + display: none; } + +.cbi-map-descr, .cbi-section-descr, .cbi-page-actions { + padding: 1em; + background: #ececec; } + +.cbi-page-actions { + text-align: right; + display: flex; + display: -moz-flex; + -moz-flex-flow: row-reverse; + flex-flow: row-reverse; } + +div.cbi-optionals { + padding: 0.25em; + border-bottom: 1px dotted #bbbbbb; } + +div.cbi-section-remove { + float: right; } + +.cbi-section-node { + clear: both; + position: relative; + border: none; } + +.cbi-section-node-tabbed { + border-top-left-radius: 0; } + +.cbi-section-node .cbi-value-last { + border-bottom: none; } + +.cbi-section-node table div { + padding-bottom: 0; + border-bottom: none; } + +.cbi-section-node div.cbi-section-table-row { + margin: 0.25em; } + +table.cbi-section-table { + width: 100%; + font-size: 95%; } + +table.cbi-section-table th, +table.cbi-section-table td { + text-align: center; } + +tr.cbi-section-table-descr th { + font-weight: normal; + font-size: 90%; + vertical-align: top; } + +td.cbi-section-table-optionals { + text-align: left !important; + padding-top: 1em; } + +.cbi-value-helpicon img { + display: none; } + +div.cbi-error { + font-size: 95%; + font-weight: bold; + color: #ff0000; + background-color: #ffffff; } + +td.cbi-value-error { + border-color: red; } + +.cbi-value-error input, +.cbi-value-error select { + color: red; + background-color: #ffcccc; } + +.cbi-section-error { + color: red; + background-color: white; + font-size: 95%; + border: 1px dotted red; + margin: 3px; + padding: 3px; } + +.cbi-value-field var { + color: #2222FF; } + +ul.cbi-tabmenu { + padding: 3px 0; + margin-left: 0 !important; + list-style-type: none; + position: relative; + z-index: 10; + top: 4px; + line-height: 20px; } + +ul.cbi-tabmenu li.cbi-tab, +ul.cbi-tabmenu li.cbi-tab-disabled { + display: inline; + margin: 0; } + +ul.cbi-tabmenu li.cbi-tab a, +ul.cbi-tabmenu li.cbi-tab-disabled a { + text-decoration: none; + padding: 3px 7px; + margin-right: 3px; + border: 1px solid #BBBBBB; + border-bottom: none; + border-radius: 3px 3px 0 0; + background-color: #EEEEEE; + color: #BBBBBB; } + +ul.cbi-tabmenu li.cbi-tab-highlighted a { + color: #000000; + background-color: #FFEEAA; } + +ul.cbi-tabmenu li a:hover { + color: #000000; } + +ul.cbi-tabmenu li.cbi-tab a { + padding-top: 4px; + color: #000000; + background-color: #FFFFFF; } + +div.cbi-tab-descr { + background-image: url(/luci-static/resources/cbi/help.gif); + background-position: 0.25em 50%; + background-repeat: no-repeat; + border-bottom: 1px solid #CCCCCC; + margin: 0.25em 0.25em 2em; + padding: 0.5em 0.5em 0.5em 2em; } + +.left { + text-align: left !important; } + +.right { + text-align: right !important; } + +.luci { + position: absolute; + bottom: 0; + left: 1em; + height: 1.5em; + font-size: 80%; } + +.luci a:link, +.luci a:visited { + background-color: transparent; + color: #666666; + text-decoration: none; + font-size: 70%; } + +.inline { + display: inline; } + +.error500 { + white-space: normal; + border: 1px dotted #ff0000; + background-color: #ffffff; + color: #000000; + padding: 0.5em; } + +.errorbox { + border: 1px solid #FF0000; + background-color: #FFCCCC; + padding: 5px; + margin-bottom: 5px; } + +.errorbox a { + color: #000000 !important; } + +.ifacebox { + background-color: #FFFFFF; + border: 1px solid #CCCCCC; + margin: 0 10px; + text-align: center; + white-space: nowrap; } + +.ifacebox .ifacebox-head { + border-bottom: 1px solid #CCCCCC; + padding: 2px; } + +.ifacebox .ifacebox-body { + padding: 2px; } + +.ifacebadge { + background-color: #FFFFFF; + border: 1px solid #CCCCCC; + padding: 2px; + margin-left: 2px; + display: inline-block; } + +.ifacebadge-active { + border-color: #000000; + font-weight: bold; } + +.zonebadge { + padding: 2px; + display: inline-block; + white-space: nowrap; + cursor: pointer; } + +.zonebadge em, +.zonebadge strong { + margin: 3px; + display: inline-block; } + +.zonebadge input { + width: 6em; + height: 1.5em; } + +.zonebadge-empty { + border: 1px dashed #AAAAAA; + color: #AAAAAA; + font-style: italic; + font-size: smaller; } + +.uci-change-list { + font-family: monospace; } + +.uci-change-list ins, +.uci-change-legend-label ins { + text-decoration: none; + border: 1px solid #00FF00; + background-color: #CCFFCC; + display: block; + padding: 2px; } + +.uci-change-list del, +.uci-change-legend-label del { + text-decoration: none; + border: 1px solid #FF0000; + background-color: #FFCCCC; + display: block; + font-style: normal; + padding: 2px; } + +.uci-change-list var, +.uci-change-legend-label var { + text-decoration: none; + border: 1px solid #CCCCCC; + background-color: #EEEEEE; + display: block; + font-style: normal; + padding: 2px; } + +.uci-change-list var ins, +.uci-change-list var del { + /*display: inline;*/ + border: none; + white-space: pre; + font-style: normal; + padding: 0px; } + +.uci-change-legend { + padding: 5px; } + +.uci-change-legend-label { + width: 150px; + float: left; + font-size: 80%; } + +.uci-change-legend-label > ins, +.uci-change-legend-label > del, +.uci-change-legend-label > var { + float: left; + margin-right: 4px; + width: 10px; + height: 10px; + display: block; } + +.uci-change-legend-label var ins, +.uci-change-legend-label var del { + line-height: 6px; + border: none; } + +.cbi-input-password + img { + display: none; } + +.the-key { + text-align: left; + font-size: 1.4em; + background: #ffe9b3; + border: 3pt dashed #dc0067; + margin-bottom: 0.5em; + padding: 0.5em; } diff --git a/package/gluon-luci-theme/sass/cascade.scss b/package/gluon-luci-theme/sass/cascade.scss new file mode 100644 index 00000000..eb0e1bc2 --- /dev/null +++ b/package/gluon-luci-theme/sass/cascade.scss @@ -0,0 +1,1014 @@ +/* ATTENTION: This file is not compiled when building gluon. + The compiled version is at ../files/www/luci-static/gluon/cascade.css + + Use sass like this to update it: + + sass cascade.scss ../files/www/luci-static/gluon/cascade.css + + When commiting changes to this file make sure to commit the respective + changes to the compilid version within the same commit! + */ + +@charset "utf-8"; + +$ffyellow: #ffb400; +$ffmagenta: #dc0067; +$ffzusatz: #009ee0; +$red: #ee3300; + +@mixin button { + &::-moz-focus-inner { + padding: 0; + border: 0; + } + + display: inline-block; + zoom: 1; + line-height: normal; + white-space: nowrap; + vertical-align: baseline; + text-align: center; + cursor: pointer; + -webkit-user-drag: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + + + font-size: 100%; + padding: 0.5em 1em; + color: rgba(0, 0, 0, 0.80); + border: none rgba(0, 0, 0, 0); + background-color: #E6E6E6; + text-decoration: none; + border-radius: 2px; + + /* Transitions */ + -webkit-transition: 0.1s linear -webkit-box-shadow; + -moz-transition: 0.1s linear -moz-box-shadow; + -ms-transition: 0.1s linear box-shadow; + -o-transition: 0.1s linear box-shadow; + transition: 0.1s linear box-shadow; + + &:active { + box-shadow: 0 0 0 1px rgba(0,0,0, 0.15) inset, 0 0 6px rgba(0,0,0, 0.20) inset; + } + + &:focus { + outline: 0; + } + + &:hover, &:focus { + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(transparent), color-stop(40%, rgba(0,0,0, 0.05)), to(rgba(0,0,0, 0.10))); + background-image: -webkit-linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); + background-image: -moz-linear-gradient(top, rgba(0,0,0, 0.05) 0%, rgba(0,0,0, 0.10)); + background-image: -o-linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); + background-image: linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); + } + + &[disabled] { + border: none; + background-image: none; + opacity: 0.40; + cursor: not-allowed; + box-shadow: none; + } +} + +@mixin button-primary { + background-color: $ffzusatz; + color: #fff; +} + +.lang_he { + direction: RTL; + unicode-bidi: embed; +} + +.hidden { + display: none; +} + +html { + min-height: 100%; + height: auto; + position:relative; +} + +body { + font-family: 'Open Sans', Arial, sans-serif; + font-size: 12pt; + color: rgb(77, 78, 83); + line-height: 1.5em; + margin: 0; + display: flex; + flex-direction: column; + min-height: 100vh; + background-color: #f3f3f3; +} + +a img { + border: none; + text-decoration: none; +} + +.tabmenu1 { + text-align: center; +} + +ul.tabmenu { + list-style: none; + padding: 0; + margin: 2em 0; + display: inline-flex; +} + +ul.tabmenu li { + white-space: nowrap; + margin: 0 0.5em; + padding: 0; + text-align: center; + + a { + display: block; + text-decoration: none; + padding: 1em; + margin: 0; + color: #333; + border-radius: 2em; + + &:hover { + background: lighten($ffyellow, 35); + } + } + + &.active a { + font-weight: bold; + background: white; + color: #333; + } +} + +abbr, +acronym { + font-style: normal; + font-variant: normal; +} + +abbr[title], +acronym[title] { + border-bottom: 1px dotted; + cursor: help; +} + +a:link abbr[title], +a:visited abbr[title], +a:link acronym[title], +a:visited acronym[title] { + cursor: pointer; +} + +code { + font-family: monospace; + white-space: pre; +} + +#maincontent ul { + margin-left: 2em; +} + +.warning { + color: red; + background-color: white; + font-weight: bold; +} + +.clear { + clear: both; +} + +.error { + color: #ff0000; + background-color: white; +} + +div.hostinfo { + margin: 0; + padding: 0; + font-size: 80%; + padding: 0.5em; + flex: 1; + font-weight: bold; +} + +#xhr_poll_status { + cursor: pointer; +} + +#xhr_poll_status #xhr_poll_status_off { + font-weight: bold; + color: #FF0000; +} + +#xhr_poll_status #xhr_poll_status_on { + font-weight: bold; + color: #00FF00; +} + +#menubar { + display: flex; + background: $ffmagenta; + color: #ffffff; +} + +#menubar .warning { + color: red; + background-color: #557788; +} + +#menubar a:link, +#menubar a:visited { + position: relative; + display: block; + padding: 0.5em; + text-decoration: none; + font-size: 80%; + font-weight: normal; + color: white; +} + +#menubar a:link:hover, +#menubar a:visited:hover, +#menubar a:link:focus, +#menubar a:visited:focus { + background: $ffyellow; + color: black; +} + +#menubar a:link.active, +#menubar a:visited.active { + background: $ffyellow; + color: black; + font-weight: bold; +} + +#menubar a:link.warning, +#menubar a:visited.warning { + background: #000000; + color: red; + font-weight: bold; +} + +#modemenu { + list-style: none; + margin: 0; + padding: 0; +} + +#modemenu li { + display: inline-block; +} + +#savemenu { +} + +.lang_he #savemenu { +} + +.lang_de #submenu_admin_uci { + width: 12em; +} + +.lang_ru #submenu_admin_uci { + width: 11.5em; +} + +textarea#syslog { + width: 98%; + min-height: 500px; + border: 3px solid #cccccc; + padding: 5px; + font-family: monospace; +} + +#maincontent { + padding: 0 1em 2em; + max-width: 60em; + min-width: 40em; + margin: 1em auto; +} + +.lang_he #maincontent { + direction: rtl; +} + +#maincontent h2 { +} + +#maincontent h3 { +} + +#maincontent p { + margin-bottom: 1em; +} + +.cbi-section { + margin: 0; + padding: 0; + border: none; +} + +.cbi-section legend { + font-size: 1.4em; + font-weight: bold; + color: $ffmagenta; + position: relative; + padding: 0; + margin-bottom: 0.5em; +} + +.cbi-section h2 { + margin: 0em 0 0.5em -0.5em !important; +} + +.cbi-section h3 { + text-decoration: none !important; + font-weight: bold !important; + color: #555555 !important; + margin: 0.25em !important; + font-size: 100% !important; +} + +.cbi-section-descr { + margin-bottom: 2em; +} + +.cbi-title-ref { + color: inherit; + text-decoration: none; + padding-right: 18px; + background: url('../resources/cbi/link.gif') no-repeat scroll right center; + background-color: inherit; +} + +ul.cbi-apply { + font-size: 90%; +} + +input:-webkit-input-placeholder { + color: #AAAAAA; +} + +input:-moz-placeholder { + color: #AAAAAA; +} + +input:-ms-input-placeholder { + color: #AAAAAA; +} + +input[type=checkbox] { + -moz-appearance:none; + -webkit-appearance:none; + -o-appearance:none; + appearance: none; + width: 2em; + height: 2em; + margin: 0; + + &:checked { + position: relative; + + &::after { + content: '✔'; + color: $ffmagenta; + vertical-align: middle; + position: absolute; + top: 50%; + left: 0; + margin-top: -0.5em; + width: 100%; + text-align: center; + font-size: 1.7em; + } + } +} + +input[type=submit], +input[type=reset], +input[type=image], +input[type=button] { + cursor: pointer; +} + +select, +input, +textarea { + color: darken($ffzusatz, 30); + border: none; + background: lighten($ffyellow, 30); + border-radius: 3pt; + padding: 0.5em; +} + +input[type=image] { + border: none; +} + +select, +input[type=text], +input[type=password] { + width: 20em; +} + +td select, +td input[type=text], +td input[type=password] { + width: 99%; +} + +img.cbi-image-button { + cursor: pointer; + margin: 0 2px; + vertical-align: middle; +} + +input.cbi-button { + @include button; + + background-repeat: no-repeat; +} + +input.cbi-input-user { + background-image: url('../resources/cbi/user.gif'); + background-repeat: no-repeat; + background-position: 1px center; + color: #000000; + text-indent: 17px; +} + +input.cbi-input-find, +input.cbi-button-find { + background-image: url('../resources/cbi/find.gif'); + color: #000000; + padding-left: 17px; +} + +input.cbi-input-reload { + background-image: url('../resources/cbi/reload.gif'); + color: #000000; + padding-left: 17px; +} + +input.cbi-input-add, +input.cbi-button-add { + background-image: url('../resources/cbi/add.gif'); + color: #000000; + padding-left: 17px; + padding-right: 1px; +} + +input.cbi-input-fieldadd, +input.cbi-button-fieldadd { + background-image: url(../resources/cbi/fieldadd.gif); + color: #000000; + padding-left: 17px; + padding-right: 1px; +} + +input.cbi-input-reset, +input.cbi-button-reset { + background-color: $red; + color: #fff; +} + +input.cbi-input-save, +input.cbi-button-save { + @include button-primary; +} + +input.cbi-input-apply, +input.cbi-button-apply { + @include button-primary; +} + +input.cbi-input-link, +input.cbi-button-link { + background-image: url('../resources/cbi/link.gif'); + color: #000000; + padding-left: 17px; + padding-right: 1px; +} + +input.cbi-input-download, +input.cbi-button-download { + background-image: url('../resources/cbi/download.gif'); + color: #000000; + padding-left: 17px; + padding-right: 1px; +} + +input.cbi-input-remove, +div.cbi-section-remove input { + background-image: url('../resources/cbi/remove.gif'); + color: #000000; + padding-left: 17px; + padding-right: 1px; +} + +input.cbi-button-up { + background-image: url('../resources/cbi/up.gif'); + padding-left: 11px; + padding-right: 1px; +} + +input.cbi-button-down { + background-image: url('../resources/cbi/down.gif'); + padding-left: 11px; + padding-right: 1px; +} + +input.cbi-button-edit { + background-image: url('../resources/cbi/edit.gif'); + color: #000000; + padding-left: 17px; + padding-right: 1px; +} + +input.cbi-button-reload { + background-image: url('../resources/cbi/reload.gif'); + color: #000000; + padding-left: 17px; + padding-right: 1px; +} + +input.cbi-button-remove { + background-image: url('../resources/cbi/remove.gif'); + color: #000000; + padding-left: 17px; + padding-right: 1px; +} + +.cbi-input-invalid { + background: $red !important; + color: white; +} + +div.cbi-section-remove input { + border-bottom: none; +} + +textarea { + margin-left: -1px; + margin-bottom: 0.5em; +} + +form > div > input[type=submit], +form > div > input[type=reset] { + margin-left: 0.5em; +} + +table td, +table th { + color: #000000; +} + +table.smalltext { + background: #f5f5f5; + color: #000000; + border-top: 1px solid #666666; + border-right: 1px solid #666666; + border-bottom: 1px solid #666666; + font-size: 90%; + width: 80%; + margin-left: auto; + margin-right: auto; + border-collapse: collapse; +} + +table.smalltext tr:hover td { + background-color: #bbddee; + color: #000000; +} + +table.smalltext tr th { + padding: 0 0.25em; + border-left: 1px solid #666666; + text-align: left; +} + +table.smalltext tr td { + padding: 0 0.25em; + border-top: 1px solid #666666; + border-left: 1px solid #666666; +} + +table.cbi-section-table .cbi-rowstyle-1 { + background-color: #eeeeff; + color: #000000; +} + +table.cbi-section-table .cbi-rowstyle-1:hover, +table.cbi-section-table .cbi-rowstyle-2:hover { + background-color: #b2c8d4; + color: #000000; +} + +table.cbi-section-table .cbi-section-table-cell { + padding: 3px; + white-space: nowrap; +} + +.cbi-section .cbi-rowstyle-1 h3 { + background-color: #eeeeff; + color: #555555; +} + +.cbi-rowstyle-2 { + color: #000000; +} + +div.cbi-value { + display: flex; + flex-direction: row; + margin-bottom: 0.5em; +} + +.cbi-value-title { + flex: 2; + text-align: right; + padding-top: 0.39em; + padding-right: 1em; + font-weight: bold; +} + +div.cbi-value-field { + flex: 3; +} + +div.cbi-value-description { + font-size: 8pt; +} + +div.cbi-section-create { + clear: left; + white-space: nowrap; + vertical-align: top; +} + +div.cbi-section-create .cbi-button { + margin: 0.25em; +} + +input.cbi-section-create-name { + margin-right: -0.25em; +} + +div.cbi-map-descr { + margin-bottom: 1em; +} + +.cbi-map-descr:empty, .cbi-section-descr:empty { + display: none; +} + +.cbi-map-descr, .cbi-section-descr, .cbi-page-actions { + padding: 1em; + background: #ececec; +} + +.cbi-page-actions { + text-align: right; + display: flex; + display: -moz-flex; + -moz-flex-flow: row-reverse; + flex-flow: row-reverse; +} + +div.cbi-optionals { + padding: 0.25em; + border-bottom: 1px dotted #bbbbbb; +} + +div.cbi-section-remove { + float: right; +} + +.cbi-section-node { + clear: both; + position: relative; + border: none; +} + +.cbi-section-node-tabbed { + border-top-left-radius: 0; +} + +.cbi-section-node .cbi-value-last { + border-bottom: none; +} + +.cbi-section-node table div { + padding-bottom: 0; + border-bottom: none; +} + +.cbi-section-node div.cbi-section-table-row { + margin: 0.25em; +} + +table.cbi-section-table { + width: 100%; + font-size: 95%; +} + +table.cbi-section-table th, +table.cbi-section-table td { + text-align: center; +} + +tr.cbi-section-table-descr th { + font-weight: normal; + font-size: 90%; + vertical-align: top; +} + +td.cbi-section-table-optionals { + text-align: left !important; + padding-top: 1em; +} + +.cbi-value-helpicon img { + display: none; +} + +div.cbi-error { + font-size: 95%; + font-weight: bold; + color: #ff0000; + background-color: #ffffff; +} + +td.cbi-value-error { + border-color: red; +} + +.cbi-value-error input, +.cbi-value-error select { + color: red; + background-color: #ffcccc; +} + +.cbi-section-error { + color: red; + background-color: white; + font-size: 95%; + border: 1px dotted red; + margin: 3px; + padding: 3px; +} + +.cbi-value-field var { + color: #2222FF; +} + +ul.cbi-tabmenu { + padding: 3px 0; + margin-left: 0 !important; + list-style-type: none; + position: relative; + z-index: 10; + top: 4px; + line-height: 20px; +} + +ul.cbi-tabmenu li.cbi-tab, +ul.cbi-tabmenu li.cbi-tab-disabled { + display: inline; + margin: 0; +} + +ul.cbi-tabmenu li.cbi-tab a, +ul.cbi-tabmenu li.cbi-tab-disabled a { + text-decoration: none; + padding: 3px 7px; + margin-right: 3px; + border: 1px solid #BBBBBB; + border-bottom: none; + border-radius: 3px 3px 0 0; + background-color: #EEEEEE; + color: #BBBBBB; +} + +ul.cbi-tabmenu li.cbi-tab-highlighted a { + color: #000000; + background-color: #FFEEAA; +} + +ul.cbi-tabmenu li a:hover { + color: #000000; +} + +ul.cbi-tabmenu li.cbi-tab a { + padding-top: 4px; + color: #000000; + background-color: #FFFFFF; +} + +div.cbi-tab-descr { + background-image: url(/luci-static/resources/cbi/help.gif); + background-position: 0.25em 50%; + background-repeat: no-repeat; + border-bottom: 1px solid #CCCCCC; + margin: 0.25em 0.25em 2em; + padding: 0.5em 0.5em 0.5em 2em; +} + +.left { + text-align: left !important; +} + +.right { + text-align: right !important; +} + +.luci { + position: absolute; + bottom: 0; + left: 1em; + height: 1.5em; + font-size: 80%; +} + +.luci a:link, +.luci a:visited { + background-color: transparent; + color: #666666; + text-decoration: none; + font-size: 70%; +} + +.inline { + display: inline; +} + +.error500 { + white-space: normal; + border: 1px dotted #ff0000; + background-color: #ffffff; + color: #000000; + padding: 0.5em; +} + +.errorbox { + border: 1px solid #FF0000; + background-color: #FFCCCC; + padding: 5px; + margin-bottom: 5px; +} + +.errorbox a { + color: #000000 !important; +} + + +.ifacebox { + background-color: #FFFFFF; + border: 1px solid #CCCCCC; + margin: 0 10px; + text-align: center; + white-space: nowrap; +} + +.ifacebox .ifacebox-head { + border-bottom: 1px solid #CCCCCC; + padding: 2px; +} + +.ifacebox .ifacebox-body { + padding: 2px; +} + + +.ifacebadge { + background-color: #FFFFFF; + border: 1px solid #CCCCCC; + padding: 2px; + margin-left: 2px; + display: inline-block; +} + +.ifacebadge-active { + border-color: #000000; + font-weight: bold; +} + + +.zonebadge { + padding: 2px; + display: inline-block; + white-space: nowrap; + cursor: pointer; +} + +.zonebadge em, +.zonebadge strong { + margin: 3px; + display: inline-block; +} + +.zonebadge input { + width: 6em; + height: 1.5em; +} + +.zonebadge-empty { + border: 1px dashed #AAAAAA; + color: #AAAAAA; + font-style: italic; + font-size: smaller; +} + + +.uci-change-list { + font-family: monospace; +} + +.uci-change-list ins, +.uci-change-legend-label ins { + text-decoration: none; + border: 1px solid #00FF00; + background-color: #CCFFCC; + display: block; + padding: 2px; +} + +.uci-change-list del, +.uci-change-legend-label del { + text-decoration: none; + border: 1px solid #FF0000; + background-color: #FFCCCC; + display: block; + font-style: normal; + padding: 2px; +} + +.uci-change-list var, +.uci-change-legend-label var { + text-decoration: none; + border: 1px solid #CCCCCC; + background-color: #EEEEEE; + display: block; + font-style: normal; + padding: 2px; +} + +.uci-change-list var ins, +.uci-change-list var del { + /*display: inline;*/ + border: none; + white-space: pre; + font-style: normal; + padding: 0px; +} + +.uci-change-legend { + padding: 5px; +} + +.uci-change-legend-label { + width: 150px; + float: left; + font-size: 80%; +} + +.uci-change-legend-label>ins, +.uci-change-legend-label>del, +.uci-change-legend-label>var { + float: left; + margin-right: 4px; + width: 10px; + height: 10px; + display: block; +} + +.uci-change-legend-label var ins, +.uci-change-legend-label var del { + line-height: 6px; + border: none; +} + +// Hide show/hide password toggle image +.cbi-input-password + img { + display: none; +} + +.the-key { + text-align: left; + font-size: 1.4em; + background: lighten($ffyellow, 35); + border: 3pt dashed $ffmagenta; + margin-bottom: 0.5em; + padding: 0.5em +} From b1cc62b680f770fab9fea45cc17c18b2328909f2 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 21 Jan 2014 16:15:27 +0100 Subject: [PATCH 156/453] gluon-config-mode,luci-admin: use gluon-luci-theme This makes gluon-config-mode and gluon-luci-admin depend on gluon-luci-theme instead of luci-theme-openwrt. --- package/gluon-config-mode/Makefile | 2 +- package/gluon-luci-admin/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/gluon-config-mode/Makefile b/package/gluon-config-mode/Makefile index 75a87826..dfd252ef 100644 --- a/package/gluon-config-mode/Makefile +++ b/package/gluon-config-mode/Makefile @@ -15,7 +15,7 @@ define Package/gluon-config-mode SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci based config mode for user friendly setup of new meshnodes - DEPENDS:=+gluon-core +gluon-lock-password +gluon-location +gluon-simple-tc +uhttpd +dnsmasq +luci-mod-admin-core +ip +luci-theme-openwrt + DEPENDS:=+gluon-core +gluon-lock-password +gluon-location +gluon-simple-tc +gluon-luci-theme +uhttpd +dnsmasq +luci-mod-admin-core +ip endef define Package/gluon-config-mode/description diff --git a/package/gluon-luci-admin/Makefile b/package/gluon-luci-admin/Makefile index 45a849dc..d9d96381 100644 --- a/package/gluon-luci-admin/Makefile +++ b/package/gluon-luci-admin/Makefile @@ -15,7 +15,7 @@ define Package/gluon-luci-admin SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci based simple administration interface for mesh nodes - DEPENDS:=+gluon-core +luci-mod-admin-core +luci-theme-openwrt + DEPENDS:=+gluon-core +gluon-luci-theme +luci-mod-admin-core endef define Package/gluon-luci-admin/description From 57f65acaf2a8c47e0c19490053026ed0c63674bb Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 21 Jan 2014 22:34:52 +0100 Subject: [PATCH 157/453] gluon-config-mode: replace inline style with class Replace the inline stylesheet for the public key box on the reboot page with a CSS class so it can be styled using the theme. --- .../generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm b/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm index 7d192b6a..27be9385 100644 --- a/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm +++ b/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm @@ -27,7 +27,7 @@ $Id$

@config_mode.msg_pubkey@

-
+
# <%=luci.sys.hostname()%>
<%=pubkey%> From de22275c607b8e666912a0da70a4ee16288d46f5 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 21 Jan 2014 17:08:03 +0100 Subject: [PATCH 158/453] gluon-config-mode: remove subsection headings Those headings do not convey much information make the wizard less compact. The help texts will be rewritten to guide the user instead. --- .../usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua index 9c1ee2fb..a7d13490 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua @@ -9,7 +9,7 @@ configmode.setup_fastd_secret(meshvpn_name) f = SimpleForm("wizard", "Willkommen!", "Willkommen zum Einrichtungsassistenten für deinen neuen Lübecker Freifunk-Knoten. Fülle das folgende Formular deinen Vorstellungen entsprechend aus und klicke anschließend auf den „Senden“-Button.") f.reset = false -s = f:section(SimpleSection, "Grundeinstellungen", nil) +s = f:section(SimpleSection, nil, nil) o = s:option(Value, "_hostname", "Knotenname") o.value = uci:get_first("system", "system", "hostname") @@ -22,7 +22,7 @@ o.default = uci:get_bool("autoupdater", "settings", "enabled") and o.enabled or o.rmempty = false o.description = "Aktiviert automatische Updates der Firmware (empfohlen)" -s = f:section(SimpleSection, "Mesh-VPN", "Nutzt die Internet-Verbindung, um diesem Knoten auch dann Zugang zum Freifunknetz zu geben, wenn er außerhalb der Funkreichweite anderer Freifunk-Knoten ist.") +s = f:section(SimpleSection, nil, "Nutzt die Internet-Verbindung, um diesem Knoten auch dann Zugang zum Freifunknetz zu geben, wenn er außerhalb der Funkreichweite anderer Freifunk-Knoten ist.") o = s:option(Flag, "_meshvpn", "Mesh-VPN aktivieren?") o.default = uci:get_bool("fastd", meshvpn_name, "enabled") and o.enabled or o.disabled @@ -46,7 +46,7 @@ o.value = uci:get("gluon-simple-tc", meshvpn_name, "limit_egress") o.rmempty = false o.datatype = "integer" -s = f:section(SimpleSection, "GPS Koordinaten", "Hier kannst du die GPS-Koordinaten deines Knotens eintragen, um ihn in der Knotenkarte anzeigen zu lassen.") +s = f:section(SimpleSection, nil, "Hier kannst du die GPS-Koordinaten deines Knotens eintragen, um ihn in der Knotenkarte anzeigen zu lassen.") o = s:option(Flag, "_location", "Koordinaten veröffentlichen?") o.default = uci:get_first("gluon-locaton", "location", "share_location", o.disabled) From efc958fbf85755a400bb6ad321dd1ad2f50f2bb6 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 21 Jan 2014 06:13:25 +0100 Subject: [PATCH 159/453] gluon-luci-admin: disable when not in configmode For security reasons we'd like to disable all HTTP config interfaces when the node is operating normally. This patch disables gluon-luci-admin when configmode is not enabled. --- .../files/usr/lib/lua/luci/controller/admin/index.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua index 8e91fd6d..1bf4d155 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua @@ -19,6 +19,11 @@ function index() local uci_state = luci.model.uci.cursor_state() local configmode = uci_state:get_first("gluon-config-mode", "wizard", "running", "0") == "1" + -- Disable gluon-luci-admin when configmode is not enabled + if not configmode then + return + end + local root = node() if not root.lock then root.target = alias("admin") From d85214d4c511e0644064eeda44593fa8d0825cb6 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 21 Jan 2014 06:16:19 +0100 Subject: [PATCH 160/453] gluon-luci-admin: fix indentation Replaces double-spaces with tabs to match surrounding code. --- .../lib/lua/luci/controller/admin/index.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua index 1bf4d155..13d9d83e 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua @@ -16,8 +16,8 @@ $Id$ module("luci.controller.admin.index", package.seeall) function index() - local uci_state = luci.model.uci.cursor_state() - local configmode = uci_state:get_first("gluon-config-mode", "wizard", "running", "0") == "1" + local uci_state = luci.model.uci.cursor_state() + local configmode = uci_state:get_first("gluon-config-mode", "wizard", "running", "0") == "1" -- Disable gluon-luci-admin when configmode is not enabled if not configmode then @@ -30,14 +30,14 @@ function index() root.index = true end - local page = entry({"admin"}, alias("admin", "index"), _("Expertmode"), 10) + local page = entry({"admin"}, alias("admin", "index"), _("Expertmode"), 10) page.sysauth = "root" - if configmode then - -- force root to be logged in when running in configmode - page.sysauth_authenticator = function() return "root" end - else - page.sysauth_authenticator = "htmlauth" - end + if configmode then + -- force root to be logged in when running in configmode + page.sysauth_authenticator = function() return "root" end + else + page.sysauth_authenticator = "htmlauth" + end page.index = true entry({"admin", "index"}, form("admin/index"), _("Overview"), 1).ignoreindex = true From 78f5efa7ce64c1d7a991a00cdfc50faf5a68beca Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 21 Jan 2014 23:06:32 +0100 Subject: [PATCH 161/453] gluon-luci-admin: no logout button in configmode Hide the "logout" button when in configmode. --- .../files/usr/lib/lua/luci/controller/admin/index.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua index 13d9d83e..fb5000af 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua @@ -41,7 +41,10 @@ function index() page.index = true entry({"admin", "index"}, form("admin/index"), _("Overview"), 1).ignoreindex = true - entry({"admin", "logout"}, call("action_logout"), _("Logout")) + + if not configmode then + entry({"admin", "logout"}, call("action_logout"), _("Logout")) + end end function action_logout() From dd7934a39afec3aaf826c3d5f19cf87b58eb7e64 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 22 Jan 2014 16:44:29 +0100 Subject: [PATCH 162/453] gluon-luci-admin: remove redundant headings --- .../files/usr/lib/lua/luci/view/admin/backup.htm | 3 +-- .../files/usr/lib/lua/luci/view/admin/reboot.htm | 3 +-- .../files/usr/lib/lua/luci/view/admin/upgrade.htm | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/backup.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/backup.htm index eb9dc46e..167419da 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/backup.htm +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/backup.htm @@ -13,8 +13,7 @@ $Id$ -%> <%+header%> -

<%:System%>

-

<%:Backup / Restore%>

+

<%:Backup / Restore%>

<%:Here you can backup and restore your configuration and - if possible - reset this device to the default settings.%>


diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm index 9e57d89f..5e671471 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm @@ -13,8 +13,7 @@ $Id$ -%> <%+header%> -

<%:System%>

-

<%:Reboot%>

+

<%:Reboot%>

<%:Reboots the operating system of your device%>

<%- local c = require("luci.model.uci").cursor():changes() diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm index 1083a161..3d75b415 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm @@ -15,8 +15,7 @@ $Id$ <%+header%> -

<%:System%>

-

<%:Flash Firmware%>

+

<%:Flash Firmware%>

<% if step == 1 then %> <% if supported then %> From 8d62f92a4d2540cf43bcc936bd514bb8bf9a418f Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 22 Jan 2014 16:45:30 +0100 Subject: [PATCH 163/453] gluon-luci-admin: replace overview text This completely replaces the text on the overview page. Consider this a placeholder until someone writes a better suited version :) --- .../usr/lib/lua/luci/view/admin/index.htm | 24 ++++--------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/index.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/index.htm index c14d3b0b..c1656a7e 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/index.htm +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/index.htm @@ -1,21 +1,5 @@ -<%# -LuCI - Lua Configuration Interface -Copyright 2008 Steven Barth -Copyright 2008 Jo-Philipp Wich - -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$ - --%>

<%:Hello!%>

-

<%_This is the administration area of LuCI.%>

-

<%_LuCI is a free, flexible, and user friendly graphical interface for configuring OpenWrt.%>
-<%:On the following pages you can adjust all important settings of this device.%>

-

<%:As we always want to improve this interface we are looking forward to your feedback and suggestions.%>

-

<%:And now have fun with your OpenWrt device!%>

-

<%_The LuCI Team%>

+

Dies ist der Experten-Modus deines Freifunkknotens.

+

Hier kannst du weitere Einstellungen vornehmen, Firmware Upates + einspielen und auch vieles kaputt machen.

+

Sei bitte vorsichtig!

From c7efde1acfc612d95e8d85ead7a31a3554c01ec1 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 22 Jan 2014 16:47:13 +0100 Subject: [PATCH 164/453] gluon-luci-admin: reboot.html, remove refresh Don't refresh the reboot page after rebooting the node. It's not going back to configmode anyway so it'll never reload without user intervention. --- .../files/usr/lib/lua/luci/view/admin/reboot.htm | 1 - 1 file changed, 1 deletion(-) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm index 5e671471..91699e3a 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm @@ -27,6 +27,5 @@ if not reboot then

<%:Perform reboot%>

<%- else -%>

<%:Please wait: Device rebooting...%>

- <%- end -%> <%+footer%> \ No newline at end of file From 33698020943cd2a72183a4954caaba3283b3f83d Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 22 Jan 2014 18:49:57 +0100 Subject: [PATCH 165/453] gluon-core: sysconfig: don't print error message for unset config --- package/gluon-core/files/lib/gluon/functions/sysconfig.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-core/files/lib/gluon/functions/sysconfig.sh b/package/gluon-core/files/lib/gluon/functions/sysconfig.sh index 40acf689..044cbf51 100644 --- a/package/gluon-core/files/lib/gluon/functions/sysconfig.sh +++ b/package/gluon-core/files/lib/gluon/functions/sysconfig.sh @@ -2,7 +2,7 @@ SYSCONFIGDIR=/lib/gluon/core/sysconfig sysconfig() { - cat "$SYSCONFIGDIR/$1" + cat "$SYSCONFIGDIR/$1" 2>/dev/null } sysconfig_set() { From 6d5e47eeec9074035527ef119024661a10ab74eb Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 22 Jan 2014 19:17:48 +0100 Subject: [PATCH 166/453] gluon-config-mode: respect switch configuration --- .../files/etc/init.d/gluon-config-mode | 40 ++++++++++++++++--- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode index 2af5e953..552323b1 100755 --- a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode +++ b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode @@ -3,13 +3,22 @@ START=12 -config_mode_iface=eth0 config_mode_addr=192.168.1.1 -config_mode_plen=24 +config_mode_netmask=255.255.255.0 config_mode_dnsname=freifunk config_mode_dhcp_range=192.168.1.2,192.168.1.254 + +. /lib/functions.sh +. /lib/gluon/functions/sysconfig.sh + + +delete_interface() { + [ "$1" = 'loopback' ] || uci_remove network "$1" +} + + check_enable() { config_get enabled "$1" enabled config_get configured "$1" configured @@ -29,8 +38,27 @@ start() { uci set 'gluon-config-mode.@wizard[0].enabled=0' uci commit gluon-config-mode - ip addr add $config_mode_addr/$config_mode_plen dev $config_mode_iface - ip link set up dev $config_mode_iface + mkdir -p /var/gluon/config-mode/config + mount -o bind /etc/config /var/gluon/config-mode/config + + touch /var/gluon/config-mode/wireless + mount -o bind /var/gluon/config-mode/wireless /etc/config/wireless + + cp /etc/config/network /var/gluon/config-mode + mount -o bind /var/gluon/config-mode/network /etc/config/network + + config_load network + config_foreach delete_interface interface + + uci_add network interface config + uci_set network config ifname "$(sysconfig lan_ifname || sysconfig wan_ifname)" + uci_set network config type 'bridge' + uci_set network config proto 'static' + uci_set network config ipaddr "$config_mode_addr" + uci_set network config netmask "$config_mode_netmask" + + uci_commit network + /etc/init.d/network start /usr/sbin/telnetd -l /lib/gluon/config-mode/ash-login /etc/init.d/dropbear start @@ -42,8 +70,8 @@ start() { # correctly finish firstboot /etc/init.d/done boot - echo "$config_mode_addr $config_mode_dnsname" > /tmp/hosts.gluon-config-mode - dnsmasq -h -H /tmp/hosts.gluon-config-mode -R -F interface:$config_mode_iface,$config_mode_dhcp_range -l /tmp/dhcp.leases -O option:router + echo "$config_mode_addr $config_mode_dnsname" > /var/gluon/config-mode/hosts + dnsmasq -h -H /var/gluon/config-mode/hosts -R -F interface:br-config,$config_mode_dhcp_range -l /tmp/dhcp.leases -O option:router . /etc/diag.sh get_status_led From bb4a9fd5af2853bb2faf628d0c7dd64f53b474b9 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 22 Jan 2014 19:44:27 +0100 Subject: [PATCH 167/453] Fix race condition in dnsmasq config dir handling --- package/gluon-core/files/etc/init.d/gluon-core | 8 ++++++++ .../files/lib/gluon/upgrade/core/invariant/010-dnsmasq.d | 2 +- .../files/lib/gluon/dnsmasq.d/010-mesh-batman-adv.conf | 1 - .../generate/lib/gluon/odhcp6c.d/010-mesh-batman-adv | 4 ++-- 4 files changed, 11 insertions(+), 4 deletions(-) create mode 100755 package/gluon-core/files/etc/init.d/gluon-core delete mode 120000 package/gluon-mesh-batman-adv/files/lib/gluon/dnsmasq.d/010-mesh-batman-adv.conf diff --git a/package/gluon-core/files/etc/init.d/gluon-core b/package/gluon-core/files/etc/init.d/gluon-core new file mode 100755 index 00000000..4c69a5fa --- /dev/null +++ b/package/gluon-core/files/etc/init.d/gluon-core @@ -0,0 +1,8 @@ +#!/bin/sh /etc/rc.common + +START=11 + + +start() { + mkdir -p /var/gluon/dnsmasq.d +} diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/invariant/010-dnsmasq.d b/package/gluon-core/files/lib/gluon/upgrade/core/invariant/010-dnsmasq.d index 8e84c1f5..ad7f1e2a 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/invariant/010-dnsmasq.d +++ b/package/gluon-core/files/lib/gluon/upgrade/core/invariant/010-dnsmasq.d @@ -1,3 +1,3 @@ #!/bin/sh -echo 'conf-dir=/lib/gluon/dnsmasq.d' > /etc/dnsmasq.conf +echo -e 'conf-dir=/lib/gluon/dnsmasq.d\nconf-dir=/var/gluon/dnsmasq.d' > /etc/dnsmasq.conf diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/dnsmasq.d/010-mesh-batman-adv.conf b/package/gluon-mesh-batman-adv/files/lib/gluon/dnsmasq.d/010-mesh-batman-adv.conf deleted file mode 120000 index f4b89cbe..00000000 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/dnsmasq.d/010-mesh-batman-adv.conf +++ /dev/null @@ -1 +0,0 @@ -/var/gluon/mesh-batman-adv/dnsmasq.conf \ No newline at end of file diff --git a/package/gluon-mesh-batman-adv/generate/lib/gluon/odhcp6c.d/010-mesh-batman-adv b/package/gluon-mesh-batman-adv/generate/lib/gluon/odhcp6c.d/010-mesh-batman-adv index 5f702522..e06837ed 100755 --- a/package/gluon-mesh-batman-adv/generate/lib/gluon/odhcp6c.d/010-mesh-batman-adv +++ b/package/gluon-mesh-batman-adv/generate/lib/gluon/odhcp6c.d/010-mesh-batman-adv @@ -10,12 +10,12 @@ for ns in $RDNSS $RA_DNS; do done done > /var/gluon/mesh-batman-adv/dnsmasq.conf.$$ -if cmp -s /var/gluon/mesh-batman-adv/dnsmasq.conf.$$ /var/gluon/mesh-batman-adv/dnsmasq.conf; then +if cmp -s /var/gluon/mesh-batman-adv/dnsmasq.conf.$$ /var/gluon/dnsmasq.d/mesh-batman-adv.conf; then rm /var/gluon/mesh-batman-adv/dnsmasq.conf.$$ exit 0 fi lock /var/gluon/mesh-batman-adv/dnsmasq.conf.lock -mv -f /var/gluon/mesh-batman-adv/dnsmasq.conf.$$ /var/gluon/mesh-batman-adv/dnsmasq.conf +mv -f /var/gluon/mesh-batman-adv/dnsmasq.conf.$$ /var/gluon/dnsmasq.d/mesh-batman-adv.conf /etc/init.d/dnsmasq restart lock -u /var/gluon/mesh-batman-adv/dnsmasq.conf.lock From b8820bab613f909c01bbf7d9e2198b1afc6bcd98 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 22 Jan 2014 20:44:34 +0100 Subject: [PATCH 168/453] Properly support devices with only one ethernet interface --- .../lib/gluon/upgrade/core/initial/001-sysconfig | 11 +++++++++-- .../gluon/upgrade/mesh-batman-adv/initial/010-mesh | 9 ++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig b/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig index 1bcedc3a..36cdffdb 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig +++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig @@ -15,7 +15,14 @@ get_primary_mac() { esac } +lan_ifname="$(uci get network.lan.ifname)" +wan_ifname="$(uci get network.wan.ifname)" + +if [ -n "$wan_ifname" ]; then + [ -z "$lan_ifname" ] || sysconfig_set lan_ifname "$lan_ifname" + sysconfig_set wan_ifname "$wan_ifname" +else + sysconfig_set wan_ifname "$lan_ifname" +fi -sysconfig_set lan_ifname "$(uci get network.lan.ifname)" -sysconfig_set wan_ifname "$(uci get network.wan.ifname)" sysconfig_set primary_mac "$(get_primary_mac)" diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh index 6fca7533..12aea75e 100755 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh @@ -3,9 +3,16 @@ . /lib/functions.sh . /lib/gluon/functions/sysconfig.sh +lan_ifname="$(sysconfig lan_ifname)" uci_add network interface client -uci_set network client ifname "$(sysconfig lan_ifname) bat0" + +if [ -n "$lan_ifname" ]; then + uci_set network client ifname "$lan_ifname bat0" +else + uci_set network client ifname "bat0" +fi + uci_set network client type 'bridge' uci_set network client proto 'dhcpv6' uci_set network client reqprefix 'no' From f1fa2a2971f82f088495798e08afd991104a69c2 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 22 Jan 2014 21:22:54 +0100 Subject: [PATCH 169/453] gluon-radvd: run on br-client --- package/gluon-radvd/Makefile | 2 +- package/gluon-radvd/generate/lib/gluon/radvd/radvd.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/gluon-radvd/Makefile b/package/gluon-radvd/Makefile index bb694942..915423f3 100644 --- a/package/gluon-radvd/Makefile +++ b/package/gluon-radvd/Makefile @@ -12,7 +12,7 @@ define Package/gluon-radvd SECTION:=gluon CATEGORY:=Gluon TITLE:=Advertise an IPv6 prefix from the node - DEPENDS:=+gluon-core +gluon-ebtables +gluon-next-node +radvd + DEPENDS:=+gluon-core +gluon-ebtables-filter-ra-dhcp +radvd endef define Package/gluon-radvd/description diff --git a/package/gluon-radvd/generate/lib/gluon/radvd/radvd.conf b/package/gluon-radvd/generate/lib/gluon/radvd/radvd.conf index 1ce7eab3..d112f6fc 100644 --- a/package/gluon-radvd/generate/lib/gluon/radvd/radvd.conf +++ b/package/gluon-radvd/generate/lib/gluon/radvd/radvd.conf @@ -1,4 +1,4 @@ -interface local-node +interface br-client { IgnoreIfMissing on; AdvSendAdvert on; From bc1be30486a742f1fbcea14f3f075a8f04301867 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 22 Jan 2014 22:04:08 +0100 Subject: [PATCH 170/453] More fixes for strange network interface configurations --- .../files/lib/gluon/upgrade/core/initial/001-sysconfig | 7 ++++++- .../files/lib/gluon/upgrade/core/initial/011-gluon-network | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig b/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig index 36cdffdb..9eed5ff9 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig +++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig @@ -15,10 +15,15 @@ get_primary_mac() { esac } +iface_exists() { + local name="$1" + ip link show dev "${name//.*/}" >/dev/null 2>&1 +} + lan_ifname="$(uci get network.lan.ifname)" wan_ifname="$(uci get network.wan.ifname)" -if [ -n "$wan_ifname" ]; then +if [ -n "$wan_ifname" ] && iface_exists "$wan_ifname"; then [ -z "$lan_ifname" ] || sysconfig_set lan_ifname "$lan_ifname" sysconfig_set wan_ifname "$wan_ifname" else diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network index 400cb40d..b335913a 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network +++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network @@ -7,7 +7,10 @@ uci_remove network lan +uci_remove network wan +uci_add network interface wan +uci_set network wan ifname "$(sysconfig wan_ifname)" uci_set network wan type 'bridge' uci_set network wan proto 'dhcp' From a299a150b61de33f79d217ef09bcaf2bea7f8dbd Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 22 Jan 2014 23:18:46 +0100 Subject: [PATCH 171/453] gluon-config-mode: fix indentation --- .../usr/lib/lua/luci/controller/gluon-config-mode/index.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua index 5dad4a15..b05205ea 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua @@ -51,7 +51,7 @@ function action_reboot() if meshvpn_enabled == "1" then pubkey = configmode.get_fastd_pubkey(meshvpn_name) end - luci.template.render("gluon-config-mode/reboot", {pubkey=pubkey}) + luci.template.render("gluon-config-mode/reboot", {pubkey=pubkey}) uci:foreach("gluon-config-mode", "wizard", function(s) uci:set("gluon-config-mode", s[".name"], "configured", "1") From 1e348ddd456a66876e75e0d67804e891f4ffc47c Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 22 Jan 2014 23:25:34 +0100 Subject: [PATCH 172/453] gluon-config-mode: delay reboot a little The reboot page should be delayed a little to give the browser time for fetching assets (like the stylesheet). This adds a two second delay. Unfortunately, I couldn't think of a sane way to do this within a luci controller. This patch forks the process. The parent will continue rendering the page for the browser while the child will sleep and then reboot the device. For this to work reliable the child needs to close stdout before sleeping so the webserver closes the connection to the browser. This, again, required a hack as lua does not allow closing std filehandles, when prevented using luci.reboot() which was calling os.execute() and that function will not work with stdout closed. --- .../controller/gluon-config-mode/index.lua | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua index b05205ea..1842caaf 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua @@ -51,7 +51,6 @@ function action_reboot() if meshvpn_enabled == "1" then pubkey = configmode.get_fastd_pubkey(meshvpn_name) end - luci.template.render("gluon-config-mode/reboot", {pubkey=pubkey}) uci:foreach("gluon-config-mode", "wizard", function(s) uci:set("gluon-config-mode", s[".name"], "configured", "1") @@ -59,5 +58,20 @@ function action_reboot() uci:save("gluon-config-mode") uci:commit("gluon-config-mode") - luci.sys.reboot() + if nixio.fork() ~= 0 then + luci.template.render("gluon-config-mode/reboot", {pubkey=pubkey}) + 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 From ad2d413f2397612f18e90705ea9f92dbae6602aa Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Thu, 23 Jan 2014 01:21:43 +0100 Subject: [PATCH 173/453] gluon-config-mode: use welcome text from site.conf --- .../model/cbi/gluon-config-mode/wizard.lua | 3 +- .../view/gluon-config-mode/cbi/wizard.htm | 62 +++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua index a7d13490..4dfb5168 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua @@ -6,8 +6,9 @@ local f, s, o -- prepare fastd key as early as possible configmode.setup_fastd_secret(meshvpn_name) -f = SimpleForm("wizard", "Willkommen!", "Willkommen zum Einrichtungsassistenten für deinen neuen Lübecker Freifunk-Knoten. Fülle das folgende Formular deinen Vorstellungen entsprechend aus und klicke anschließend auf den „Senden“-Button.") +f = SimpleForm("wizard") f.reset = false +f.template = "gluon-config-mode/cbi/wizard" s = f:section(SimpleSection, nil, nil) diff --git a/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm b/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm new file mode 100644 index 00000000..c67257ef --- /dev/null +++ b/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm @@ -0,0 +1,62 @@ +

Willkommen!

+

+ @config_mode.msg_welcome@ +

+ +<% if not self.embedded then %> +
+
+ + +
+<% end %> +
+ <% if self.title and #self.title > 0 then %>

<%=self.title%>

<% end %> + <% if self.description and #self.description > 0 then %>
<%=self.description%>
<% end %> + <% self:render_children() %> +
+
+<%- if self.message then %> +
<%=self.message%>
+<%- end %> +<%- if self.errmessage then %> +
<%=self.errmessage%>
+<%- end %> +<% if not self.embedded then %> +
+<%- + if type(self.hidden) == "table" then + for k, v in pairs(self.hidden) do +-%> + +<%- + end + end +%> +<% if redirect then %> +
+ +
+<% end %> +<%- if self.flow and self.flow.skip then %> + +<% end %> +<%- if self.submit ~= false then %> + +<% end %> +<%- if self.reset ~= false then %> + +<% end %> +<%- if self.cancel ~= false and self.on_cancel then %> + +<% end %> + +
+
+<% end %> From 68a0da5daa4fa0fb1cda2a0da730bf047f32530e Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Thu, 23 Jan 2014 01:34:25 +0100 Subject: [PATCH 174/453] gluon-config-mode: label submit button "Fertig" --- .../usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua index 4dfb5168..729bd7cb 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua @@ -9,6 +9,7 @@ configmode.setup_fastd_secret(meshvpn_name) f = SimpleForm("wizard") f.reset = false f.template = "gluon-config-mode/cbi/wizard" +f.submit = "Fertig" s = f:section(SimpleSection, nil, nil) From 5486cf2c4e4fc86db61b7cdd4e728a4a2a9abc37 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Thu, 23 Jan 2014 02:22:51 +0100 Subject: [PATCH 175/453] gluon-config-mode: new helptexts --- .../model/cbi/gluon-config-mode/wizard.lua | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua index 729bd7cb..d0caee7c 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua @@ -13,28 +13,28 @@ f.submit = "Fertig" s = f:section(SimpleSection, nil, nil) -o = s:option(Value, "_hostname", "Knotenname") +o = s:option(Value, "_hostname", "Name dieses Knotens") o.value = uci:get_first("system", "system", "hostname") o.rmempty = false o.datatype = "hostname" -o.description = "Öffentlicher Name deines Knotens. Wird z.B. für die Anzeige auf der Knotenkarte benutzt." -o = s:option(Flag, "_autoupdate", "Automatische Updates aktivieren?") +o = s:option(Flag, "_autoupdate", "Firmware automatisch aktualisieren") o.default = uci:get_bool("autoupdater", "settings", "enabled") and o.enabled or o.disabled o.rmempty = false -o.description = "Aktiviert automatische Updates der Firmware (empfohlen)" -s = f:section(SimpleSection, nil, "Nutzt die Internet-Verbindung, um diesem Knoten auch dann Zugang zum Freifunknetz zu geben, wenn er außerhalb der Funkreichweite anderer Freifunk-Knoten ist.") +s = f:section(SimpleSection, nil, [[Falls du deinen Knoten über das Internet +mit Freifunk verbinden möchtest, kannst du hier das Mesh-VPN aktivieren. +Solltest du dich dafür entscheiden, hast du die Möglichkeit die dafür +genutzte Bandbreite zu beschränken.]]) -o = s:option(Flag, "_meshvpn", "Mesh-VPN aktivieren?") +o = s:option(Flag, "_meshvpn", "Mesh-VPN aktivieren") o.default = uci:get_bool("fastd", meshvpn_name, "enabled") and o.enabled or o.disabled o.rmempty = false -o = s:option(Flag, "_limit_enabled", "Bandbreitenbegrenzung aktivieren?") +o = s:option(Flag, "_limit_enabled", "Mesh-VPN Bandbreite begrenzen") o:depends("_meshvpn", "1") o.default = uci:get_bool("gluon-simple-tc", meshvpn_name, "enabled") and o.enabled or o.disabled o.rmempty = false -o.description = "Begrenzt die Geschwindigkeit, mit der dieser Knoten auf das Internet zugreifen darf. Kann aktiviert werden, wenn der eigene Internetanschluss durch den Freifunkknoten merklich ausgebremst wird." o = s:option(Value, "_limit_ingress", "Downstream") o:depends("_limit_enabled", "1") @@ -48,9 +48,11 @@ o.value = uci:get("gluon-simple-tc", meshvpn_name, "limit_egress") o.rmempty = false o.datatype = "integer" -s = f:section(SimpleSection, nil, "Hier kannst du die GPS-Koordinaten deines Knotens eintragen, um ihn in der Knotenkarte anzeigen zu lassen.") +s = f:section(SimpleSection, nil, [[Um deinen Knoten auf der Karte anzeigen +zu können benötigen wir seine Koordinaten. Hier hast du die Möglichkeit +diese zu hinterlegen.]]) -o = s:option(Flag, "_location", "Koordinaten veröffentlichen?") +o = s:option(Flag, "_location", "Knoten auf der Karte anzeigen") o.default = uci:get_first("gluon-locaton", "location", "share_location", o.disabled) o.rmempty = false @@ -58,11 +60,13 @@ o = s:option(Value, "_latitude", "Breitengrad") o.default = string.format("%f", uci:get_first("gluon-location", "location", "latitude", "0")) o.rmempty = false o.datatype = "float" +o.description = "z.B. 53.873621" o = s:option(Value, "_longitude", "Längengrad") o.default = string.format("%f", uci:get_first("gluon-location", "location", "longitude", "0")) o.rmempty = false o.datatype = "float" +o.description = "z.B. 10.689901" function f.handle(self, state, data) if state == FORM_VALID then From ee74235a3b646d34155939cf3964ee9fc85e9537 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 23 Jan 2014 18:40:31 +0100 Subject: [PATCH 176/453] gluon-next-node: don't wait for br-client to get an address --- .../lib/gluon/upgrade/next-node/invariant/010-next-node | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-next-node/generate/lib/gluon/upgrade/next-node/invariant/010-next-node b/package/gluon-next-node/generate/lib/gluon/upgrade/next-node/invariant/010-next-node index bec0e1c1..649ec7c4 100755 --- a/package/gluon-next-node/generate/lib/gluon/upgrade/next-node/invariant/010-next-node +++ b/package/gluon-next-node/generate/lib/gluon/upgrade/next-node/invariant/010-next-node @@ -6,7 +6,7 @@ uci_remove network local_node_dev uci_add network device local_node_dev uci_set network local_node_dev name 'local-node' -uci_set network local_node_dev ifname '@client' +uci_set network local_node_dev ifname 'br-client' uci_set network local_node_dev type 'macvlan' uci_set network local_node_dev macaddr '@next_node.mac@' From f5dc52f665a6d68e438a7aac4fc5b2d275828b46 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 23 Jan 2014 18:41:41 +0100 Subject: [PATCH 177/453] Revert "gluon-radvd: run on br-client" This reverts commit f5c532a3a923053ab229952bde31da0b0284d8ab. --- package/gluon-radvd/Makefile | 2 +- package/gluon-radvd/generate/lib/gluon/radvd/radvd.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/gluon-radvd/Makefile b/package/gluon-radvd/Makefile index 915423f3..bb694942 100644 --- a/package/gluon-radvd/Makefile +++ b/package/gluon-radvd/Makefile @@ -12,7 +12,7 @@ define Package/gluon-radvd SECTION:=gluon CATEGORY:=Gluon TITLE:=Advertise an IPv6 prefix from the node - DEPENDS:=+gluon-core +gluon-ebtables-filter-ra-dhcp +radvd + DEPENDS:=+gluon-core +gluon-ebtables +gluon-next-node +radvd endef define Package/gluon-radvd/description diff --git a/package/gluon-radvd/generate/lib/gluon/radvd/radvd.conf b/package/gluon-radvd/generate/lib/gluon/radvd/radvd.conf index d112f6fc..1ce7eab3 100644 --- a/package/gluon-radvd/generate/lib/gluon/radvd/radvd.conf +++ b/package/gluon-radvd/generate/lib/gluon/radvd/radvd.conf @@ -1,4 +1,4 @@ -interface br-client +interface local-node { IgnoreIfMissing on; AdvSendAdvert on; From 410733d423f1fc1d3607fcea2d4f21ea570aed3e Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 24 Jan 2014 05:00:52 +0100 Subject: [PATCH 178/453] gluon-mesh-batman-adv: use kmod-batman-adv-legacy package --- package/gluon-mesh-batman-adv/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-mesh-batman-adv/Makefile b/package/gluon-mesh-batman-adv/Makefile index a800f975..7e6a0448 100644 --- a/package/gluon-mesh-batman-adv/Makefile +++ b/package/gluon-mesh-batman-adv/Makefile @@ -12,7 +12,7 @@ define Package/gluon-mesh-batman-adv SECTION:=gluon CATEGORY:=Gluon TITLE:=Support for batman-adv meshing - DEPENDS:=+gluon-core +kmod-batman-adv +firewall +kmod-ipt-nathelper + DEPENDS:=+gluon-core +kmod-batman-adv-legacy +firewall +kmod-ipt-nathelper endef define Package/gluon-mesh-batman-adv/description From ded5925f838fc35f071a98887799923a36248d46 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 25 Jan 2014 01:54:19 +0100 Subject: [PATCH 179/453] Remove odhcp6c.user hack --- package/gluon-core/files/etc/odhcp6c.user | 3 --- .../files/lib/gluon/odhcp6c.d/.keep | 0 .../lib/gluon/odhcp6c.d/010-mesh-batman-adv | 21 ------------------- 3 files changed, 24 deletions(-) delete mode 100644 package/gluon-core/files/etc/odhcp6c.user delete mode 100644 package/gluon-core/files/lib/gluon/odhcp6c.d/.keep delete mode 100755 package/gluon-mesh-batman-adv/generate/lib/gluon/odhcp6c.d/010-mesh-batman-adv diff --git a/package/gluon-core/files/etc/odhcp6c.user b/package/gluon-core/files/etc/odhcp6c.user deleted file mode 100644 index 14a96ebf..00000000 --- a/package/gluon-core/files/etc/odhcp6c.user +++ /dev/null @@ -1,3 +0,0 @@ -for file in /lib/gluon/odhcp6c.d/*; do - [ ! -x $file ] || $file -done diff --git a/package/gluon-core/files/lib/gluon/odhcp6c.d/.keep b/package/gluon-core/files/lib/gluon/odhcp6c.d/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/package/gluon-mesh-batman-adv/generate/lib/gluon/odhcp6c.d/010-mesh-batman-adv b/package/gluon-mesh-batman-adv/generate/lib/gluon/odhcp6c.d/010-mesh-batman-adv deleted file mode 100755 index e06837ed..00000000 --- a/package/gluon-mesh-batman-adv/generate/lib/gluon/odhcp6c.d/010-mesh-batman-adv +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -[ "$INTERFACE" = 'client' ] || exit 0 - -mkdir -p /var/gluon/mesh-batman-adv - -for ns in $RDNSS $RA_DNS; do - for domain in @mesh_domains@; do - echo "server=/$domain/$ns" - done -done > /var/gluon/mesh-batman-adv/dnsmasq.conf.$$ - -if cmp -s /var/gluon/mesh-batman-adv/dnsmasq.conf.$$ /var/gluon/dnsmasq.d/mesh-batman-adv.conf; then - rm /var/gluon/mesh-batman-adv/dnsmasq.conf.$$ - exit 0 -fi - -lock /var/gluon/mesh-batman-adv/dnsmasq.conf.lock -mv -f /var/gluon/mesh-batman-adv/dnsmasq.conf.$$ /var/gluon/dnsmasq.d/mesh-batman-adv.conf -/etc/init.d/dnsmasq restart -lock -u /var/gluon/mesh-batman-adv/dnsmasq.conf.lock From 4cf9b23e025b949872c22b941512d37790205371 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 25 Jan 2014 02:09:35 +0100 Subject: [PATCH 180/453] Enable DNS servers from mesh, disable on wan --- .../files/lib/gluon/upgrade/core/invariant/011-network | 7 +++++++ .../lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh | 2 -- .../lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/invariant/011-network diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/invariant/011-network b/package/gluon-core/files/lib/gluon/upgrade/core/invariant/011-network new file mode 100755 index 00000000..96a952e4 --- /dev/null +++ b/package/gluon-core/files/lib/gluon/upgrade/core/invariant/011-network @@ -0,0 +1,7 @@ +#!/bin/sh + +. /lib/functions.sh + + +uci_set network wan peerdns '0' +uci_commit network diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh index 12aea75e..6a249e79 100755 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh @@ -16,7 +16,5 @@ fi uci_set network client type 'bridge' uci_set network client proto 'dhcpv6' uci_set network client reqprefix 'no' -uci_set network client peerdns '0' -uci_set network client macaddr "$(sysconfig primary_mac)" echo 'net.ipv6.conf.br-client.forwarding=0' >> /etc/sysctl.conf diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh index 755a9c57..7b89edeb 100755 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh @@ -10,6 +10,9 @@ uci_set batman-adv bat0 orig_interval '5000' uci_set batman-adv bat0 gw_mode 'client' uci_commit batman-adv +uci_set network client macaddr "$(sysconfig primary_mac)" +uci_set network client peerdns '1' + uci_remove network bat0 uci_add network interface bat0 uci_set network bat0 ifname 'bat0' From 5bb4cf4e3a17c1444d79f707de86954730de2fc8 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 25 Jan 2014 03:20:03 +0100 Subject: [PATCH 181/453] gluon-mesh-vpn-fastd: always use wan DNS servers to resolve the peers --- package/gluon-mesh-vpn-fastd/Makefile | 2 + .../hotplug.d/iface/50-gluon-mesh-vpn-fastd | 3 + .../lib/gluon/mesh-vpn-fastd/update-dnsmasq | 101 ++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 package/gluon-mesh-vpn-fastd/files/etc/hotplug.d/iface/50-gluon-mesh-vpn-fastd create mode 100755 package/gluon-mesh-vpn-fastd/files/lib/gluon/mesh-vpn-fastd/update-dnsmasq diff --git a/package/gluon-mesh-vpn-fastd/Makefile b/package/gluon-mesh-vpn-fastd/Makefile index 1553af90..b679b930 100644 --- a/package/gluon-mesh-vpn-fastd/Makefile +++ b/package/gluon-mesh-vpn-fastd/Makefile @@ -31,6 +31,8 @@ define Build/Compile endef define Package/gluon-mesh-vpn-fastd/install + $(CP) ./files/* $(1)/ + $(INSTALL_DIR) $(1)/lib/gluon/upgrade/mesh-vpn-fastd/invariant $(INSTALL_BIN) $(PKG_BUILD_DIR)/fastd.sh $(1)/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd endef diff --git a/package/gluon-mesh-vpn-fastd/files/etc/hotplug.d/iface/50-gluon-mesh-vpn-fastd b/package/gluon-mesh-vpn-fastd/files/etc/hotplug.d/iface/50-gluon-mesh-vpn-fastd new file mode 100644 index 00000000..26ad4773 --- /dev/null +++ b/package/gluon-mesh-vpn-fastd/files/etc/hotplug.d/iface/50-gluon-mesh-vpn-fastd @@ -0,0 +1,3 @@ +[ "$INTERFACE" = 'wan' ] || exit 0 + +/lib/gluon/mesh-vpn-fastd/update-dnsmasq diff --git a/package/gluon-mesh-vpn-fastd/files/lib/gluon/mesh-vpn-fastd/update-dnsmasq b/package/gluon-mesh-vpn-fastd/files/lib/gluon/mesh-vpn-fastd/update-dnsmasq new file mode 100755 index 00000000..33e23a59 --- /dev/null +++ b/package/gluon-mesh-vpn-fastd/files/lib/gluon/mesh-vpn-fastd/update-dnsmasq @@ -0,0 +1,101 @@ +#!/bin/sh + + +. /lib/functions.sh + + +_json_push() { + export JSON_PATH="${JSON_PATH}/$1" +} + +_json_pop() { + export JSON_PATH="${JSON_PATH%/*}" +} + +json_init() { + export JSON_PATH='' +} + +json_add_object() { + _json_push "$1" +} + +json_close_object() { + _json_pop +} + +json_add_array() { + _json_push "$1" +} + +json_close_array() { + _json_pop +} + +json_add_int() { + return +} + +json_add_boolean() { + return +} + +json_add_double() { + return +} + +json_add_string() { + [ "$JSON_PATH" = '/inactive/dns_server' ] || return + echo "$2" +} + + +get_dns_server() { + eval `jshn -r "$(ubus call network.interface.wan status)"` +} + +generate_dnsmasq_conf_remote() { + local remote="$1"; local servers="$2" + + local hostname="$(echo "$remote" | awk -F \" '{print $2}')" + [ -n "$hostname" ] || return + + for ns in $servers; do + echo "server=/$hostname/$ns" + done +} + +generate_dnsmasq_conf_peer() { + local peer="$1"; local servers="$2" + local enabled; local net + + config_get_bool enabled "$peer" 'enabled' 0 + [ "$enabled" -gt 0 ] || return + + config_get net "$peer" 'net' + [ "$net" = 'mesh_vpn' ] || return + + config_list_foreach "$peer" 'remote' generate_dnsmasq_conf_remote "$servers" +} + +generate_dnsmasq_conf() { + local servers="$1" + + config_load fastd + config_foreach generate_dnsmasq_conf_peer 'peer' "$servers" +} + + +mkdir -p /var/gluon/mesh-vpn-fastd +generate_dnsmasq_conf "$(get_dns_server)" > /var/gluon/mesh-vpn-fastd/dnsmasq.conf.$$ + +lock /var/gluon/mesh-vpn-fastd/dnsmasq.conf.lock + +if cmp -s /var/gluon/mesh-vpn-fastd/dnsmasq.conf.$$ /var/gluon/dnsmasq.d/mesh-vpn-fastd.conf; then + rm /var/gluon/mesh-vpn-fastd/dnsmasq.conf.$$ +else + mv -f /var/gluon/mesh-vpn-fastd/dnsmasq.conf.$$ /var/gluon/dnsmasq.d/mesh-vpn-fastd.conf + /etc/init.d/dnsmasq restart +fi + +lock -u /var/gluon/mesh-vpn-fastd/dnsmasq.conf.lock From 1097fadc9250ff49fdca98b37119c5bf281b8ffe Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 28 Jan 2014 03:16:56 +0100 Subject: [PATCH 182/453] gluon-config-mode: correct hostname on reboot.html Display the correct hostname on the final page of configmode. Previously, this page used to simply call luci.sys.hostname() which would return the current hostname. However, when the configmode changes the hostname luci.sys.hostname() will not reflect this. This patch fetches the hostname directly from the UCI system config. This adds a variable called 'hostname' which may be used in site.conf at config_mode.msg_reboot and .msg_pubkey. --- .../usr/lib/lua/luci/controller/gluon-config-mode/index.lua | 5 ++++- .../usr/lib/lua/luci/view/gluon-config-mode/reboot.htm | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua index 1842caaf..906d926a 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua @@ -58,8 +58,11 @@ function action_reboot() uci:save("gluon-config-mode") uci:commit("gluon-config-mode") + hostname = uci:get_first("system", "system", "hostname") + if nixio.fork() ~= 0 then - luci.template.render("gluon-config-mode/reboot", {pubkey=pubkey}) + luci.template.render("gluon-config-mode/reboot", + {pubkey=pubkey, hostname=hostname}) else debug.setfenv(io.stdout, debug.getfenv(io.open '/dev/null')) io.stdout:close() diff --git a/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm b/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm index 27be9385..26a09a2f 100644 --- a/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm +++ b/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm @@ -15,7 +15,7 @@ $Id$ - <%=luci.sys.hostname()%> - <% if title then %><%=title%><% else %><%:Rebooting...%><% end %> + <%=hostname%> - <% if title then %><%=title%><% else %><%:Rebooting...%><% end %> @@ -28,7 +28,7 @@ $Id$ @config_mode.msg_pubkey@

- # <%=luci.sys.hostname()%> + # <%=hostname%>
<%=pubkey%>
From 869f81d12e43faf097c06ceb116a23122b62db1e Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 29 Jan 2014 17:17:49 +0100 Subject: [PATCH 183/453] Add stub gluon-status-page package --- package/gluon-status-page/Makefile | 37 +++++++++++++++++++ .../lib/gluon/status-page/www/index.html | 10 +++++ .../status-page/invariant/010-status-page | 13 +++++++ 3 files changed, 60 insertions(+) create mode 100644 package/gluon-status-page/Makefile create mode 100644 package/gluon-status-page/files/lib/gluon/status-page/www/index.html create mode 100755 package/gluon-status-page/files/lib/gluon/upgrade/status-page/invariant/010-status-page diff --git a/package/gluon-status-page/Makefile b/package/gluon-status-page/Makefile new file mode 100644 index 00000000..d0e9d488 --- /dev/null +++ b/package/gluon-status-page/Makefile @@ -0,0 +1,37 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-status-page +PKG_VERSION:=1 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-status-page + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Adds a status page showing information about the node. + DEPENDS:=+gluon-core +uhttpd +endef + +define Package/gluon-status-page/description + Adds a status page showing information about the node. + Especially useful in combination with the next-node feature. +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-status-page/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-status-page)) diff --git a/package/gluon-status-page/files/lib/gluon/status-page/www/index.html b/package/gluon-status-page/files/lib/gluon/status-page/www/index.html new file mode 100644 index 00000000..19911b81 --- /dev/null +++ b/package/gluon-status-page/files/lib/gluon/status-page/www/index.html @@ -0,0 +1,10 @@ + + + + +Status page ‒ TODO + + +

TODO

+ + diff --git a/package/gluon-status-page/files/lib/gluon/upgrade/status-page/invariant/010-status-page b/package/gluon-status-page/files/lib/gluon/upgrade/status-page/invariant/010-status-page new file mode 100755 index 00000000..ee7a58c9 --- /dev/null +++ b/package/gluon-status-page/files/lib/gluon/upgrade/status-page/invariant/010-status-page @@ -0,0 +1,13 @@ +#!/bin/sh + +uci batch <<-EOF + delete uhttpd.main.listen_http + add_list uhttpd.main.listen_http=0.0.0.0:80 + add_list uhttpd.main.listen_http=[::]:80 + + delete uhttpd.main.listen_https + + set uhttpd.main.home=/lib/gluon/status-page/www + + commit uhttpd +EOF From 48788391865a0f2af231a4bc27de8c4acc9de4af Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 29 Jan 2014 23:37:31 +0100 Subject: [PATCH 184/453] gluon-luci-theme: input fields on error readable Do not use 'red' as text color on input fields with errors as the backgronud color is already red, rendering the value unreadable. --- .../files/www/luci-static/gluon/cascade.css | 805 +----------------- package/gluon-luci-theme/sass/cascade.scss | 1 - 2 files changed, 1 insertion(+), 805 deletions(-) diff --git a/package/gluon-luci-theme/files/www/luci-static/gluon/cascade.css b/package/gluon-luci-theme/files/www/luci-static/gluon/cascade.css index e8fa9f7d..b29120e4 100644 --- a/package/gluon-luci-theme/files/www/luci-static/gluon/cascade.css +++ b/package/gluon-luci-theme/files/www/luci-static/gluon/cascade.css @@ -1,804 +1 @@ -@charset "UTF-8"; -.lang_he { - direction: RTL; - unicode-bidi: embed; } - -.hidden { - display: none; } - -html { - min-height: 100%; - height: auto; - position: relative; } - -body { - font-family: 'Open Sans', Arial, sans-serif; - font-size: 12pt; - color: #4d4e53; - line-height: 1.5em; - margin: 0; - display: flex; - flex-direction: column; - min-height: 100vh; - background-color: #f3f3f3; } - -a img { - border: none; - text-decoration: none; } - -.tabmenu1 { - text-align: center; } - -ul.tabmenu { - list-style: none; - padding: 0; - margin: 2em 0; - display: inline-flex; } - -ul.tabmenu li { - white-space: nowrap; - margin: 0 0.5em; - padding: 0; - text-align: center; } - ul.tabmenu li a { - display: block; - text-decoration: none; - padding: 1em; - margin: 0; - color: #333; - border-radius: 2em; } - ul.tabmenu li a:hover { - background: #ffe9b3; } - ul.tabmenu li.active a { - font-weight: bold; - background: white; - color: #333; } - -abbr, -acronym { - font-style: normal; - font-variant: normal; } - -abbr[title], -acronym[title] { - border-bottom: 1px dotted; - cursor: help; } - -a:link abbr[title], -a:visited abbr[title], -a:link acronym[title], -a:visited acronym[title] { - cursor: pointer; } - -code { - font-family: monospace; - white-space: pre; } - -#maincontent ul { - margin-left: 2em; } - -.warning { - color: red; - background-color: white; - font-weight: bold; } - -.clear { - clear: both; } - -.error { - color: #ff0000; - background-color: white; } - -div.hostinfo { - margin: 0; - padding: 0; - font-size: 80%; - padding: 0.5em; - flex: 1; - font-weight: bold; } - -#xhr_poll_status { - cursor: pointer; } - -#xhr_poll_status #xhr_poll_status_off { - font-weight: bold; - color: #FF0000; } - -#xhr_poll_status #xhr_poll_status_on { - font-weight: bold; - color: #00FF00; } - -#menubar { - display: flex; - background: #dc0067; - color: #ffffff; } - -#menubar .warning { - color: red; - background-color: #557788; } - -#menubar a:link, -#menubar a:visited { - position: relative; - display: block; - padding: 0.5em; - text-decoration: none; - font-size: 80%; - font-weight: normal; - color: white; } - -#menubar a:link:hover, -#menubar a:visited:hover, -#menubar a:link:focus, -#menubar a:visited:focus { - background: #ffb400; - color: black; } - -#menubar a:link.active, -#menubar a:visited.active { - background: #ffb400; - color: black; - font-weight: bold; } - -#menubar a:link.warning, -#menubar a:visited.warning { - background: #000000; - color: red; - font-weight: bold; } - -#modemenu { - list-style: none; - margin: 0; - padding: 0; } - -#modemenu li { - display: inline-block; } - -.lang_de #submenu_admin_uci { - width: 12em; } - -.lang_ru #submenu_admin_uci { - width: 11.5em; } - -textarea#syslog { - width: 98%; - min-height: 500px; - border: 3px solid #cccccc; - padding: 5px; - font-family: monospace; } - -#maincontent { - padding: 0 1em 2em; - max-width: 60em; - min-width: 40em; - margin: 1em auto; } - -.lang_he #maincontent { - direction: rtl; } - -#maincontent p { - margin-bottom: 1em; } - -.cbi-section { - margin: 0; - padding: 0; - border: none; } - -.cbi-section legend { - font-size: 1.4em; - font-weight: bold; - color: #dc0067; - position: relative; - padding: 0; - margin-bottom: 0.5em; } - -.cbi-section h2 { - margin: 0em 0 0.5em -0.5em !important; } - -.cbi-section h3 { - text-decoration: none !important; - font-weight: bold !important; - color: #555555 !important; - margin: 0.25em !important; - font-size: 100% !important; } - -.cbi-section-descr { - margin-bottom: 2em; } - -.cbi-title-ref { - color: inherit; - text-decoration: none; - padding-right: 18px; - background: url("../resources/cbi/link.gif") no-repeat scroll right center; - background-color: inherit; } - -ul.cbi-apply { - font-size: 90%; } - -input:-webkit-input-placeholder { - color: #AAAAAA; } - -input:-moz-placeholder { - color: #AAAAAA; } - -input:-ms-input-placeholder { - color: #AAAAAA; } - -input[type=checkbox] { - -moz-appearance: none; - -webkit-appearance: none; - -o-appearance: none; - appearance: none; - width: 2em; - height: 2em; - margin: 0; } - input[type=checkbox]:checked { - position: relative; } - input[type=checkbox]:checked::after { - content: '✔'; - color: #dc0067; - vertical-align: middle; - position: absolute; - top: 50%; - left: 0; - margin-top: -0.5em; - width: 100%; - text-align: center; - font-size: 1.7em; } - -input[type=submit], -input[type=reset], -input[type=image], -input[type=button] { - cursor: pointer; } - -select, -input, -textarea { - color: #003247; - border: none; - background: #ffe199; - border-radius: 3pt; - padding: 0.5em; } - -input[type=image] { - border: none; } - -select, -input[type=text], -input[type=password] { - width: 20em; } - -td select, -td input[type=text], -td input[type=password] { - width: 99%; } - -img.cbi-image-button { - cursor: pointer; - margin: 0 2px; - vertical-align: middle; } - -input.cbi-button { - display: inline-block; - zoom: 1; - line-height: normal; - white-space: nowrap; - vertical-align: baseline; - text-align: center; - cursor: pointer; - -webkit-user-drag: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - font-size: 100%; - padding: 0.5em 1em; - color: rgba(0, 0, 0, 0.8); - border: none rgba(0, 0, 0, 0); - background-color: #E6E6E6; - text-decoration: none; - border-radius: 2px; - /* Transitions */ - -webkit-transition: 0.1s linear -webkit-box-shadow; - -moz-transition: 0.1s linear -moz-box-shadow; - -ms-transition: 0.1s linear box-shadow; - -o-transition: 0.1s linear box-shadow; - transition: 0.1s linear box-shadow; - background-repeat: no-repeat; } - input.cbi-button::-moz-focus-inner { - padding: 0; - border: 0; } - input.cbi-button:active { - box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15) inset, 0 0 6px rgba(0, 0, 0, 0.2) inset; } - input.cbi-button:focus { - outline: 0; } - input.cbi-button:hover, input.cbi-button:focus { - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(transparent), color-stop(40%, rgba(0, 0, 0, 0.05)), to(rgba(0, 0, 0, 0.1))); - background-image: -webkit-linear-gradient(transparent, rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.1)); - background-image: -moz-linear-gradient(top, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.1)); - background-image: -o-linear-gradient(transparent, rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.1)); - background-image: linear-gradient(transparent, rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.1)); } - input.cbi-button[disabled] { - border: none; - background-image: none; - opacity: 0.40; - cursor: not-allowed; - box-shadow: none; } - -input.cbi-input-user { - background-image: url("../resources/cbi/user.gif"); - background-repeat: no-repeat; - background-position: 1px center; - color: #000000; - text-indent: 17px; } - -input.cbi-input-find, -input.cbi-button-find { - background-image: url("../resources/cbi/find.gif"); - color: #000000; - padding-left: 17px; } - -input.cbi-input-reload { - background-image: url("../resources/cbi/reload.gif"); - color: #000000; - padding-left: 17px; } - -input.cbi-input-add, -input.cbi-button-add { - background-image: url("../resources/cbi/add.gif"); - color: #000000; - padding-left: 17px; - padding-right: 1px; } - -input.cbi-input-fieldadd, -input.cbi-button-fieldadd { - background-image: url(../resources/cbi/fieldadd.gif); - color: #000000; - padding-left: 17px; - padding-right: 1px; } - -input.cbi-input-reset, -input.cbi-button-reset { - background-color: #ee3300; - color: #fff; } - -input.cbi-input-save, -input.cbi-button-save { - background-color: #009ee0; - color: #fff; } - -input.cbi-input-apply, -input.cbi-button-apply { - background-color: #009ee0; - color: #fff; } - -input.cbi-input-link, -input.cbi-button-link { - background-image: url("../resources/cbi/link.gif"); - color: #000000; - padding-left: 17px; - padding-right: 1px; } - -input.cbi-input-download, -input.cbi-button-download { - background-image: url("../resources/cbi/download.gif"); - color: #000000; - padding-left: 17px; - padding-right: 1px; } - -input.cbi-input-remove, -div.cbi-section-remove input { - background-image: url("../resources/cbi/remove.gif"); - color: #000000; - padding-left: 17px; - padding-right: 1px; } - -input.cbi-button-up { - background-image: url("../resources/cbi/up.gif"); - padding-left: 11px; - padding-right: 1px; } - -input.cbi-button-down { - background-image: url("../resources/cbi/down.gif"); - padding-left: 11px; - padding-right: 1px; } - -input.cbi-button-edit { - background-image: url("../resources/cbi/edit.gif"); - color: #000000; - padding-left: 17px; - padding-right: 1px; } - -input.cbi-button-reload { - background-image: url("../resources/cbi/reload.gif"); - color: #000000; - padding-left: 17px; - padding-right: 1px; } - -input.cbi-button-remove { - background-image: url("../resources/cbi/remove.gif"); - color: #000000; - padding-left: 17px; - padding-right: 1px; } - -.cbi-input-invalid { - background: #ee3300 !important; - color: white; } - -div.cbi-section-remove input { - border-bottom: none; } - -textarea { - margin-left: -1px; - margin-bottom: 0.5em; } - -form > div > input[type=submit], -form > div > input[type=reset] { - margin-left: 0.5em; } - -table td, -table th { - color: #000000; } - -table.smalltext { - background: #f5f5f5; - color: #000000; - border-top: 1px solid #666666; - border-right: 1px solid #666666; - border-bottom: 1px solid #666666; - font-size: 90%; - width: 80%; - margin-left: auto; - margin-right: auto; - border-collapse: collapse; } - -table.smalltext tr:hover td { - background-color: #bbddee; - color: #000000; } - -table.smalltext tr th { - padding: 0 0.25em; - border-left: 1px solid #666666; - text-align: left; } - -table.smalltext tr td { - padding: 0 0.25em; - border-top: 1px solid #666666; - border-left: 1px solid #666666; } - -table.cbi-section-table .cbi-rowstyle-1 { - background-color: #eeeeff; - color: #000000; } - -table.cbi-section-table .cbi-rowstyle-1:hover, -table.cbi-section-table .cbi-rowstyle-2:hover { - background-color: #b2c8d4; - color: #000000; } - -table.cbi-section-table .cbi-section-table-cell { - padding: 3px; - white-space: nowrap; } - -.cbi-section .cbi-rowstyle-1 h3 { - background-color: #eeeeff; - color: #555555; } - -.cbi-rowstyle-2 { - color: #000000; } - -div.cbi-value { - display: flex; - flex-direction: row; - margin-bottom: 0.5em; } - -.cbi-value-title { - flex: 2; - text-align: right; - padding-top: 0.39em; - padding-right: 1em; - font-weight: bold; } - -div.cbi-value-field { - flex: 3; } - -div.cbi-value-description { - font-size: 8pt; } - -div.cbi-section-create { - clear: left; - white-space: nowrap; - vertical-align: top; } - -div.cbi-section-create .cbi-button { - margin: 0.25em; } - -input.cbi-section-create-name { - margin-right: -0.25em; } - -div.cbi-map-descr { - margin-bottom: 1em; } - -.cbi-map-descr:empty, .cbi-section-descr:empty { - display: none; } - -.cbi-map-descr, .cbi-section-descr, .cbi-page-actions { - padding: 1em; - background: #ececec; } - -.cbi-page-actions { - text-align: right; - display: flex; - display: -moz-flex; - -moz-flex-flow: row-reverse; - flex-flow: row-reverse; } - -div.cbi-optionals { - padding: 0.25em; - border-bottom: 1px dotted #bbbbbb; } - -div.cbi-section-remove { - float: right; } - -.cbi-section-node { - clear: both; - position: relative; - border: none; } - -.cbi-section-node-tabbed { - border-top-left-radius: 0; } - -.cbi-section-node .cbi-value-last { - border-bottom: none; } - -.cbi-section-node table div { - padding-bottom: 0; - border-bottom: none; } - -.cbi-section-node div.cbi-section-table-row { - margin: 0.25em; } - -table.cbi-section-table { - width: 100%; - font-size: 95%; } - -table.cbi-section-table th, -table.cbi-section-table td { - text-align: center; } - -tr.cbi-section-table-descr th { - font-weight: normal; - font-size: 90%; - vertical-align: top; } - -td.cbi-section-table-optionals { - text-align: left !important; - padding-top: 1em; } - -.cbi-value-helpicon img { - display: none; } - -div.cbi-error { - font-size: 95%; - font-weight: bold; - color: #ff0000; - background-color: #ffffff; } - -td.cbi-value-error { - border-color: red; } - -.cbi-value-error input, -.cbi-value-error select { - color: red; - background-color: #ffcccc; } - -.cbi-section-error { - color: red; - background-color: white; - font-size: 95%; - border: 1px dotted red; - margin: 3px; - padding: 3px; } - -.cbi-value-field var { - color: #2222FF; } - -ul.cbi-tabmenu { - padding: 3px 0; - margin-left: 0 !important; - list-style-type: none; - position: relative; - z-index: 10; - top: 4px; - line-height: 20px; } - -ul.cbi-tabmenu li.cbi-tab, -ul.cbi-tabmenu li.cbi-tab-disabled { - display: inline; - margin: 0; } - -ul.cbi-tabmenu li.cbi-tab a, -ul.cbi-tabmenu li.cbi-tab-disabled a { - text-decoration: none; - padding: 3px 7px; - margin-right: 3px; - border: 1px solid #BBBBBB; - border-bottom: none; - border-radius: 3px 3px 0 0; - background-color: #EEEEEE; - color: #BBBBBB; } - -ul.cbi-tabmenu li.cbi-tab-highlighted a { - color: #000000; - background-color: #FFEEAA; } - -ul.cbi-tabmenu li a:hover { - color: #000000; } - -ul.cbi-tabmenu li.cbi-tab a { - padding-top: 4px; - color: #000000; - background-color: #FFFFFF; } - -div.cbi-tab-descr { - background-image: url(/luci-static/resources/cbi/help.gif); - background-position: 0.25em 50%; - background-repeat: no-repeat; - border-bottom: 1px solid #CCCCCC; - margin: 0.25em 0.25em 2em; - padding: 0.5em 0.5em 0.5em 2em; } - -.left { - text-align: left !important; } - -.right { - text-align: right !important; } - -.luci { - position: absolute; - bottom: 0; - left: 1em; - height: 1.5em; - font-size: 80%; } - -.luci a:link, -.luci a:visited { - background-color: transparent; - color: #666666; - text-decoration: none; - font-size: 70%; } - -.inline { - display: inline; } - -.error500 { - white-space: normal; - border: 1px dotted #ff0000; - background-color: #ffffff; - color: #000000; - padding: 0.5em; } - -.errorbox { - border: 1px solid #FF0000; - background-color: #FFCCCC; - padding: 5px; - margin-bottom: 5px; } - -.errorbox a { - color: #000000 !important; } - -.ifacebox { - background-color: #FFFFFF; - border: 1px solid #CCCCCC; - margin: 0 10px; - text-align: center; - white-space: nowrap; } - -.ifacebox .ifacebox-head { - border-bottom: 1px solid #CCCCCC; - padding: 2px; } - -.ifacebox .ifacebox-body { - padding: 2px; } - -.ifacebadge { - background-color: #FFFFFF; - border: 1px solid #CCCCCC; - padding: 2px; - margin-left: 2px; - display: inline-block; } - -.ifacebadge-active { - border-color: #000000; - font-weight: bold; } - -.zonebadge { - padding: 2px; - display: inline-block; - white-space: nowrap; - cursor: pointer; } - -.zonebadge em, -.zonebadge strong { - margin: 3px; - display: inline-block; } - -.zonebadge input { - width: 6em; - height: 1.5em; } - -.zonebadge-empty { - border: 1px dashed #AAAAAA; - color: #AAAAAA; - font-style: italic; - font-size: smaller; } - -.uci-change-list { - font-family: monospace; } - -.uci-change-list ins, -.uci-change-legend-label ins { - text-decoration: none; - border: 1px solid #00FF00; - background-color: #CCFFCC; - display: block; - padding: 2px; } - -.uci-change-list del, -.uci-change-legend-label del { - text-decoration: none; - border: 1px solid #FF0000; - background-color: #FFCCCC; - display: block; - font-style: normal; - padding: 2px; } - -.uci-change-list var, -.uci-change-legend-label var { - text-decoration: none; - border: 1px solid #CCCCCC; - background-color: #EEEEEE; - display: block; - font-style: normal; - padding: 2px; } - -.uci-change-list var ins, -.uci-change-list var del { - /*display: inline;*/ - border: none; - white-space: pre; - font-style: normal; - padding: 0px; } - -.uci-change-legend { - padding: 5px; } - -.uci-change-legend-label { - width: 150px; - float: left; - font-size: 80%; } - -.uci-change-legend-label > ins, -.uci-change-legend-label > del, -.uci-change-legend-label > var { - float: left; - margin-right: 4px; - width: 10px; - height: 10px; - display: block; } - -.uci-change-legend-label var ins, -.uci-change-legend-label var del { - line-height: 6px; - border: none; } - -.cbi-input-password + img { - display: none; } - -.the-key { - text-align: left; - font-size: 1.4em; - background: #ffe9b3; - border: 3pt dashed #dc0067; - margin-bottom: 0.5em; - padding: 0.5em; } +@charset "UTF-8";.lang_he{direction:RTL;unicode-bidi:embed}.hidden{display:none}html{min-height:100%;height:auto;position:relative}body{font-family:'Open Sans', Arial, sans-serif;font-size:12pt;color:#4d4e53;line-height:1.5em;margin:0;display:flex;flex-direction:column;min-height:100vh;background-color:#f3f3f3}a img{border:none;text-decoration:none}.tabmenu1{text-align:center}ul.tabmenu{list-style:none;padding:0;margin:2em 0;display:inline-flex}ul.tabmenu li{white-space:nowrap;margin:0 0.5em;padding:0;text-align:center}ul.tabmenu li a{display:block;text-decoration:none;padding:1em;margin:0;color:#333;border-radius:2em}ul.tabmenu li a:hover{background:#ffe9b3}ul.tabmenu li.active a{font-weight:bold;background:white;color:#333}abbr,acronym{font-style:normal;font-variant:normal}abbr[title],acronym[title]{border-bottom:1px dotted;cursor:help}a:link abbr[title],a:visited abbr[title],a:link acronym[title],a:visited acronym[title]{cursor:pointer}code{font-family:monospace;white-space:pre}#maincontent ul{margin-left:2em}.warning{color:red;background-color:white;font-weight:bold}.clear{clear:both}.error{color:#ff0000;background-color:white}div.hostinfo{margin:0;padding:0;font-size:80%;padding:0.5em;flex:1;font-weight:bold}#xhr_poll_status{cursor:pointer}#xhr_poll_status #xhr_poll_status_off{font-weight:bold;color:#FF0000}#xhr_poll_status #xhr_poll_status_on{font-weight:bold;color:#00FF00}#menubar{display:flex;background:#dc0067;color:#ffffff}#menubar .warning{color:red;background-color:#557788}#menubar a:link,#menubar a:visited{position:relative;display:block;padding:0.5em;text-decoration:none;font-size:80%;font-weight:normal;color:white}#menubar a:link:hover,#menubar a:visited:hover,#menubar a:link:focus,#menubar a:visited:focus{background:#ffb400;color:black}#menubar a:link.active,#menubar a:visited.active{background:#ffb400;color:black;font-weight:bold}#menubar a:link.warning,#menubar a:visited.warning{background:#000000;color:red;font-weight:bold}#modemenu{list-style:none;margin:0;padding:0}#modemenu li{display:inline-block}.lang_de #submenu_admin_uci{width:12em}.lang_ru #submenu_admin_uci{width:11.5em}textarea#syslog{width:98%;min-height:500px;border:3px solid #cccccc;padding:5px;font-family:monospace}#maincontent{padding:0 1em 2em;max-width:60em;min-width:40em;margin:1em auto}.lang_he #maincontent{direction:rtl}#maincontent p{margin-bottom:1em}.cbi-section{margin:0;padding:0;border:none}.cbi-section legend{font-size:1.4em;font-weight:bold;color:#dc0067;position:relative;padding:0;margin-bottom:0.5em}.cbi-section h2{margin:0em 0 0.5em -0.5em !important}.cbi-section h3{text-decoration:none !important;font-weight:bold !important;color:#555555 !important;margin:0.25em !important;font-size:100% !important}.cbi-section-descr{margin-bottom:2em}.cbi-title-ref{color:inherit;text-decoration:none;padding-right:18px;background:url("../resources/cbi/link.gif") no-repeat scroll right center;background-color:inherit}ul.cbi-apply{font-size:90%}input:-webkit-input-placeholder{color:#AAAAAA}input:-moz-placeholder{color:#AAAAAA}input:-ms-input-placeholder{color:#AAAAAA}input[type=checkbox]{-moz-appearance:none;-webkit-appearance:none;-o-appearance:none;appearance:none;width:2em;height:2em;margin:0}input[type=checkbox]:checked{position:relative}input[type=checkbox]:checked::after{content:'✔';color:#dc0067;vertical-align:middle;position:absolute;top:50%;left:0;margin-top:-0.5em;width:100%;text-align:center;font-size:1.7em}input[type=submit],input[type=reset],input[type=image],input[type=button]{cursor:pointer}select,input,textarea{color:#003247;border:none;background:#ffe199;border-radius:3pt;padding:0.5em}input[type=image]{border:none}select,input[type=text],input[type=password]{width:20em}td select,td input[type=text],td input[type=password]{width:99%}img.cbi-image-button{cursor:pointer;margin:0 2px;vertical-align:middle}input.cbi-button{display:inline-block;zoom:1;line-height:normal;white-space:nowrap;vertical-align:baseline;text-align:center;cursor:pointer;-webkit-user-drag:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;font-size:100%;padding:0.5em 1em;color:rgba(0,0,0,0.8);border:none rgba(0,0,0,0);background-color:#E6E6E6;text-decoration:none;border-radius:2px;-webkit-transition:0.1s linear -webkit-box-shadow;-moz-transition:0.1s linear -moz-box-shadow;-ms-transition:0.1s linear box-shadow;-o-transition:0.1s linear box-shadow;transition:0.1s linear box-shadow;background-repeat:no-repeat}input.cbi-button::-moz-focus-inner{padding:0;border:0}input.cbi-button:active{box-shadow:0 0 0 1px rgba(0,0,0,0.15) inset,0 0 6px rgba(0,0,0,0.2) inset}input.cbi-button:focus{outline:0}input.cbi-button:hover,input.cbi-button:focus{background-image:-webkit-gradient(linear, 0 0, 0 100%, from(transparent), color-stop(40%, rgba(0,0,0,0.05)), to(rgba(0,0,0,0.1)));background-image:-webkit-linear-gradient(transparent, rgba(0,0,0,0.05) 40%, rgba(0,0,0,0.1));background-image:-moz-linear-gradient(top, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.1));background-image:-o-linear-gradient(transparent, rgba(0,0,0,0.05) 40%, rgba(0,0,0,0.1));background-image:linear-gradient(transparent, rgba(0,0,0,0.05) 40%, rgba(0,0,0,0.1))}input.cbi-button[disabled]{border:none;background-image:none;opacity:0.40;cursor:not-allowed;box-shadow:none}input.cbi-input-user{background-image:url("../resources/cbi/user.gif");background-repeat:no-repeat;background-position:1px center;color:#000000;text-indent:17px}input.cbi-input-find,input.cbi-button-find{background-image:url("../resources/cbi/find.gif");color:#000000;padding-left:17px}input.cbi-input-reload{background-image:url("../resources/cbi/reload.gif");color:#000000;padding-left:17px}input.cbi-input-add,input.cbi-button-add{background-image:url("../resources/cbi/add.gif");color:#000000;padding-left:17px;padding-right:1px}input.cbi-input-fieldadd,input.cbi-button-fieldadd{background-image:url(../resources/cbi/fieldadd.gif);color:#000000;padding-left:17px;padding-right:1px}input.cbi-input-reset,input.cbi-button-reset{background-color:#e30;color:#fff}input.cbi-input-save,input.cbi-button-save{background-color:#009ee0;color:#fff}input.cbi-input-apply,input.cbi-button-apply{background-color:#009ee0;color:#fff}input.cbi-input-link,input.cbi-button-link{background-image:url("../resources/cbi/link.gif");color:#000000;padding-left:17px;padding-right:1px}input.cbi-input-download,input.cbi-button-download{background-image:url("../resources/cbi/download.gif");color:#000000;padding-left:17px;padding-right:1px}input.cbi-input-remove,div.cbi-section-remove input{background-image:url("../resources/cbi/remove.gif");color:#000000;padding-left:17px;padding-right:1px}input.cbi-button-up{background-image:url("../resources/cbi/up.gif");padding-left:11px;padding-right:1px}input.cbi-button-down{background-image:url("../resources/cbi/down.gif");padding-left:11px;padding-right:1px}input.cbi-button-edit{background-image:url("../resources/cbi/edit.gif");color:#000000;padding-left:17px;padding-right:1px}input.cbi-button-reload{background-image:url("../resources/cbi/reload.gif");color:#000000;padding-left:17px;padding-right:1px}input.cbi-button-remove{background-image:url("../resources/cbi/remove.gif");color:#000000;padding-left:17px;padding-right:1px}.cbi-input-invalid{background:#e30 !important;color:white}div.cbi-section-remove input{border-bottom:none}textarea{margin-left:-1px;margin-bottom:0.5em}form>div>input[type=submit],form>div>input[type=reset]{margin-left:0.5em}table td,table th{color:#000000}table.smalltext{background:#f5f5f5;color:#000000;border-top:1px solid #666666;border-right:1px solid #666666;border-bottom:1px solid #666666;font-size:90%;width:80%;margin-left:auto;margin-right:auto;border-collapse:collapse}table.smalltext tr:hover td{background-color:#bbddee;color:#000000}table.smalltext tr th{padding:0 0.25em;border-left:1px solid #666666;text-align:left}table.smalltext tr td{padding:0 0.25em;border-top:1px solid #666666;border-left:1px solid #666666}table.cbi-section-table .cbi-rowstyle-1{background-color:#eeeeff;color:#000000}table.cbi-section-table .cbi-rowstyle-1:hover,table.cbi-section-table .cbi-rowstyle-2:hover{background-color:#b2c8d4;color:#000000}table.cbi-section-table .cbi-section-table-cell{padding:3px;white-space:nowrap}.cbi-section .cbi-rowstyle-1 h3{background-color:#eeeeff;color:#555555}.cbi-rowstyle-2{color:#000000}div.cbi-value{display:flex;flex-direction:row;margin-bottom:0.5em}.cbi-value-title{flex:2;text-align:right;padding-top:0.39em;padding-right:1em;font-weight:bold}div.cbi-value-field{flex:3}div.cbi-value-description{font-size:8pt}div.cbi-section-create{clear:left;white-space:nowrap;vertical-align:top}div.cbi-section-create .cbi-button{margin:0.25em}input.cbi-section-create-name{margin-right:-0.25em}div.cbi-map-descr{margin-bottom:1em}.cbi-map-descr:empty,.cbi-section-descr:empty{display:none}.cbi-map-descr,.cbi-section-descr,.cbi-page-actions{padding:1em;background:#ececec}.cbi-page-actions{text-align:right;display:flex;display:-moz-flex;-moz-flex-flow:row-reverse;flex-flow:row-reverse}div.cbi-optionals{padding:0.25em;border-bottom:1px dotted #bbbbbb}div.cbi-section-remove{float:right}.cbi-section-node{clear:both;position:relative;border:none}.cbi-section-node-tabbed{border-top-left-radius:0}.cbi-section-node .cbi-value-last{border-bottom:none}.cbi-section-node table div{padding-bottom:0;border-bottom:none}.cbi-section-node div.cbi-section-table-row{margin:0.25em}table.cbi-section-table{width:100%;font-size:95%}table.cbi-section-table th,table.cbi-section-table td{text-align:center}tr.cbi-section-table-descr th{font-weight:normal;font-size:90%;vertical-align:top}td.cbi-section-table-optionals{text-align:left !important;padding-top:1em}.cbi-value-helpicon img{display:none}div.cbi-error{font-size:95%;font-weight:bold;color:#ff0000;background-color:#ffffff}td.cbi-value-error{border-color:red}.cbi-value-error input,.cbi-value-error select{background-color:#ffcccc}.cbi-section-error{color:red;background-color:white;font-size:95%;border:1px dotted red;margin:3px;padding:3px}.cbi-value-field var{color:#2222FF}ul.cbi-tabmenu{padding:3px 0;margin-left:0 !important;list-style-type:none;position:relative;z-index:10;top:4px;line-height:20px}ul.cbi-tabmenu li.cbi-tab,ul.cbi-tabmenu li.cbi-tab-disabled{display:inline;margin:0}ul.cbi-tabmenu li.cbi-tab a,ul.cbi-tabmenu li.cbi-tab-disabled a{text-decoration:none;padding:3px 7px;margin-right:3px;border:1px solid #BBBBBB;border-bottom:none;border-radius:3px 3px 0 0;background-color:#EEEEEE;color:#BBBBBB}ul.cbi-tabmenu li.cbi-tab-highlighted a{color:#000000;background-color:#FFEEAA}ul.cbi-tabmenu li a:hover{color:#000000}ul.cbi-tabmenu li.cbi-tab a{padding-top:4px;color:#000000;background-color:#FFFFFF}div.cbi-tab-descr{background-image:url(/luci-static/resources/cbi/help.gif);background-position:0.25em 50%;background-repeat:no-repeat;border-bottom:1px solid #CCCCCC;margin:0.25em 0.25em 2em;padding:0.5em 0.5em 0.5em 2em}.left{text-align:left !important}.right{text-align:right !important}.luci{position:absolute;bottom:0;left:1em;height:1.5em;font-size:80%}.luci a:link,.luci a:visited{background-color:transparent;color:#666666;text-decoration:none;font-size:70%}.inline{display:inline}.error500{white-space:normal;border:1px dotted #ff0000;background-color:#ffffff;color:#000000;padding:0.5em}.errorbox{border:1px solid #FF0000;background-color:#FFCCCC;padding:5px;margin-bottom:5px}.errorbox a{color:#000000 !important}.ifacebox{background-color:#FFFFFF;border:1px solid #CCCCCC;margin:0 10px;text-align:center;white-space:nowrap}.ifacebox .ifacebox-head{border-bottom:1px solid #CCCCCC;padding:2px}.ifacebox .ifacebox-body{padding:2px}.ifacebadge{background-color:#FFFFFF;border:1px solid #CCCCCC;padding:2px;margin-left:2px;display:inline-block}.ifacebadge-active{border-color:#000000;font-weight:bold}.zonebadge{padding:2px;display:inline-block;white-space:nowrap;cursor:pointer}.zonebadge em,.zonebadge strong{margin:3px;display:inline-block}.zonebadge input{width:6em;height:1.5em}.zonebadge-empty{border:1px dashed #AAAAAA;color:#AAAAAA;font-style:italic;font-size:smaller}.uci-change-list{font-family:monospace}.uci-change-list ins,.uci-change-legend-label ins{text-decoration:none;border:1px solid #00FF00;background-color:#CCFFCC;display:block;padding:2px}.uci-change-list del,.uci-change-legend-label del{text-decoration:none;border:1px solid #FF0000;background-color:#FFCCCC;display:block;font-style:normal;padding:2px}.uci-change-list var,.uci-change-legend-label var{text-decoration:none;border:1px solid #CCCCCC;background-color:#EEEEEE;display:block;font-style:normal;padding:2px}.uci-change-list var ins,.uci-change-list var del{border:none;white-space:pre;font-style:normal;padding:0px}.uci-change-legend{padding:5px}.uci-change-legend-label{width:150px;float:left;font-size:80%}.uci-change-legend-label>ins,.uci-change-legend-label>del,.uci-change-legend-label>var{float:left;margin-right:4px;width:10px;height:10px;display:block}.uci-change-legend-label var ins,.uci-change-legend-label var del{line-height:6px;border:none}.cbi-input-password+img{display:none}.the-key{text-align:left;font-size:1.4em;background:#ffe9b3;border:3pt dashed #dc0067;margin-bottom:0.5em;padding:0.5em} diff --git a/package/gluon-luci-theme/sass/cascade.scss b/package/gluon-luci-theme/sass/cascade.scss index eb0e1bc2..70892a5b 100644 --- a/package/gluon-luci-theme/sass/cascade.scss +++ b/package/gluon-luci-theme/sass/cascade.scss @@ -756,7 +756,6 @@ td.cbi-value-error { .cbi-value-error input, .cbi-value-error select { - color: red; background-color: #ffcccc; } From 62c30abd6fb894c85ee6651af7838035c7a9a1ec Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 31 Jan 2014 15:25:49 +0100 Subject: [PATCH 185/453] gluon-core: ensure the release file is always up-to-date --- package/gluon-core/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package/gluon-core/Makefile b/package/gluon-core/Makefile index c064694f..5872dac3 100644 --- a/package/gluon-core/Makefile +++ b/package/gluon-core/Makefile @@ -27,7 +27,6 @@ define Build/Configure endef define Build/Compile - echo "$(GLUON_RELEASE)" > $(PKG_BUILD_DIR)/release endef define Package/gluon-core/install @@ -35,7 +34,7 @@ define Package/gluon-core/install $(GLUON_GENERATE) ./generate/* $(1)/ $(INSTALL_DIR) $(1)/lib/gluon - $(INSTALL_DATA) $(PKG_BUILD_DIR)/release $(1)/lib/gluon/release + echo "$(GLUON_RELEASE)" > $(1)/lib/gluon/release endef $(eval $(call BuildPackage,gluon-core)) From 2d8dda6eeeb5557def23e91ed712c7f5b2ae0763 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Mon, 3 Feb 2014 23:59:22 +0100 Subject: [PATCH 186/453] gluon-status-page: make index.html redirect to cgi --- .../lib/gluon/status-page/www/index.html | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/package/gluon-status-page/files/lib/gluon/status-page/www/index.html b/package/gluon-status-page/files/lib/gluon/status-page/www/index.html index 19911b81..75700015 100644 --- a/package/gluon-status-page/files/lib/gluon/status-page/www/index.html +++ b/package/gluon-status-page/files/lib/gluon/status-page/www/index.html @@ -1,10 +1,12 @@ - - - - -Status page ‒ TODO - - -

TODO

- + + + + + + + + + + Redirecting... + From c839bd8892d8bbf7b7e68a9e05c2ca9d1b72ac9e Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 4 Feb 2014 13:15:18 +0100 Subject: [PATCH 187/453] statusscript --- .../lib/gluon/status-page/www/cgi-bin/status | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100755 package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status diff --git a/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status b/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status new file mode 100755 index 00000000..dd30ae57 --- /dev/null +++ b/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status @@ -0,0 +1,60 @@ +#!/bin/sh + +linknodes() { + PREFIX=$(uci get network.local_node_route6.target | cut -d: -f 1-4) + sed 's#\([0-9a-f]\{2\}\):\([0-9a-f]\{2\}\):\([0-9a-f]\{2\}\):\([0-9a-f]\{2\}\):\([0-9a-f]\{2\}\):\([0-9a-f]\{2\}\)#&#g' +} + +echo Content-type: text/html +echo "" + +cat < + + + $(cat /proc/sys/kernel/hostname) + + +EOF + +echo "

$(cat /proc/sys/kernel/hostname)

" + +echo "
"
+
+echo "Firmware release: $(cat /lib/gluon/release)"
+echo
+
+uptime | sed 's/^ \+//'
+echo
+
+ip address show dev br-client
+echo
+
+free -m
+echo
+
+df /rom /overlay
+
+echo "
" + +echo "

Neighbours

" + + +iw dev | grep IBSS -B 4 | grep Interface | cut -d' ' -f2 | while read if +do + echo "

$if

" + echo "
"
+  
+  iw dev $if link
+
+  echo 
+  
+  iw dev $if station dump | linknodes
+
+  echo "
" +done + +cat < + +EOF From ebceae82ad8aa6b6eb35f9437677e52f84bccfad Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 6 Feb 2014 00:05:10 +0100 Subject: [PATCH 188/453] gluon-config-mode: don't include sysconfig before the start function is called Otherwise the enable during image create will throw a few error messages --- .../gluon-config-mode/files/etc/init.d/gluon-config-mode | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode index 552323b1..a29d26d2 100755 --- a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode +++ b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode @@ -10,10 +10,6 @@ config_mode_dnsname=freifunk config_mode_dhcp_range=192.168.1.2,192.168.1.254 -. /lib/functions.sh -. /lib/gluon/functions/sysconfig.sh - - delete_interface() { [ "$1" = 'loopback' ] || uci_remove network "$1" } @@ -29,6 +25,8 @@ check_enable() { } start() { + . /lib/gluon/functions/sysconfig.sh + enable=0 config_load gluon-config-mode config_foreach check_enable wizard From 5c81f5fa70f82f44e4d7c59f5b7f7a3429ff3bdc Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 6 Feb 2014 00:17:33 +0100 Subject: [PATCH 189/453] gluon-autoupdater: add SHA512 support --- package/gluon-autoupdater/files/usr/sbin/autoupdater | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/package/gluon-autoupdater/files/usr/sbin/autoupdater b/package/gluon-autoupdater/files/usr/sbin/autoupdater index 88e64346..40c52750 100755 --- a/package/gluon-autoupdater/files/usr/sbin/autoupdater +++ b/package/gluon-autoupdater/files/usr/sbin/autoupdater @@ -102,7 +102,7 @@ analyse_manifest() { fi fw_version=$(echo "${my_firmware}"|cut -d' ' -f2) - fw_md5=$(echo "${my_firmware}"|cut -d' ' -f3) + fw_checksum=$(echo "${my_firmware}"|cut -d' ' -f3) fw_file=$(echo "${my_firmware}"|cut -d' ' -f4) return 0 @@ -141,8 +141,9 @@ autoupdate() { local fw_image=$(mktemp) fetch_firmware $MIRROR $fw_image || { rm -f $fw_image; return 1; } - image_md5=$(md5sum "$fw_image"|cut -b-32) - if test "$image_md5" != "$fw_md5"; then + image_sha512=$(sha512sum "$fw_image" | awk '{print $1}') + image_md5=$(md5sum "$fw_image" | awk '{print $1}') + if [ "$image_sha512" != "$fw_checksum" -a "$image_md5" != "$fw_checksum" ]; then echo "Invalid image checksum" >&2 rm -f $fw_image return 1 @@ -174,7 +175,7 @@ for mirror in $MIRRORS; do autoupdate $mirror && exit 0 unset fw_version - unset fw_md5 + unset fw_checksum unset fw_file done From b562ad7bbde967e59ae1b26e21ad654e51526058 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Thu, 6 Feb 2014 15:34:24 +0100 Subject: [PATCH 190/453] gluon-status-page: escape HTML special characters --- .../lib/gluon/status-page/www/cgi-bin/status | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status b/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status index dd30ae57..01b468da 100755 --- a/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status +++ b/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status @@ -1,5 +1,9 @@ #!/bin/sh +escape_html() { + sed 's/&/\&/g; s//\>/g; s/"/\"/g; s/'"'"'/\'/g' +} + linknodes() { PREFIX=$(uci get network.local_node_route6.target | cut -d: -f 1-4) sed 's#\([0-9a-f]\{2\}\):\([0-9a-f]\{2\}\):\([0-9a-f]\{2\}\):\([0-9a-f]\{2\}\):\([0-9a-f]\{2\}\):\([0-9a-f]\{2\}\)#&#g' @@ -21,19 +25,19 @@ echo "

$(cat /proc/sys/kernel/hostname)

" echo "
"
 
-echo "Firmware release: $(cat /lib/gluon/release)"
+echo "Firmware release: $(cat /lib/gluon/release | escape_html)"
 echo
 
-uptime | sed 's/^ \+//'
+uptime | sed 's/^ \+//' | escape_html
 echo
 
-ip address show dev br-client
+ip address show dev br-client | escape_html
 echo
 
-free -m
+free -m | escape_html
 echo
 
-df /rom /overlay
+df /rom /overlay | escape_html
 
 echo "
" @@ -45,11 +49,11 @@ do echo "

$if

" echo "
"
   
-  iw dev $if link
+  iw dev $if link | escape_html
 
   echo 
   
-  iw dev $if station dump | linknodes
+  iw dev $if station dump | escape_html | linknodes
 
   echo "
" done From cc1af68caae41ee7dd3ed660001550700446e930 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 6 Feb 2014 19:57:39 +0100 Subject: [PATCH 191/453] Don't use site config in compile step --- package/gluon-autoupdater/Makefile | 5 +++-- package/gluon-mesh-vpn-fastd/Makefile | 4 ++-- package/gluon-simple-tc/Makefile | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/package/gluon-autoupdater/Makefile b/package/gluon-autoupdater/Makefile index 7d025176..0be3cbc9 100644 --- a/package/gluon-autoupdater/Makefile +++ b/package/gluon-autoupdater/Makefile @@ -23,13 +23,14 @@ define Build/Configure endef define Build/Compile - $(GLUON_CONFIGURE) invariant.pl > $(PKG_BUILD_DIR)/invariant.sh endef define Package/gluon-autoupdater/install $(CP) ./files/* $(1)/ + $(INSTALL_DIR) $(1)/lib/gluon/upgrade/autoupdater/invariant - $(INSTALL_BIN) $(PKG_BUILD_DIR)/invariant.sh $(1)/lib/gluon/upgrade/autoupdater/invariant/010-autoupdater + $(GLUON_CONFIGURE) invariant.pl > $(1)/lib/gluon/upgrade/autoupdater/invariant/010-autoupdater + chmod +x $(1)/lib/gluon/upgrade/autoupdater/invariant/010-autoupdater endef $(eval $(call BuildPackage,gluon-autoupdater)) diff --git a/package/gluon-mesh-vpn-fastd/Makefile b/package/gluon-mesh-vpn-fastd/Makefile index b679b930..27342ded 100644 --- a/package/gluon-mesh-vpn-fastd/Makefile +++ b/package/gluon-mesh-vpn-fastd/Makefile @@ -27,14 +27,14 @@ define Build/Configure endef define Build/Compile - $(GLUON_CONFIGURE) fastd.pl > $(PKG_BUILD_DIR)/fastd.sh endef define Package/gluon-mesh-vpn-fastd/install $(CP) ./files/* $(1)/ $(INSTALL_DIR) $(1)/lib/gluon/upgrade/mesh-vpn-fastd/invariant - $(INSTALL_BIN) $(PKG_BUILD_DIR)/fastd.sh $(1)/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd + $(GLUON_CONFIGURE) fastd.pl > $(1)/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd + chmod +x $(1)/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd endef $(eval $(call BuildPackage,gluon-mesh-vpn-fastd)) diff --git a/package/gluon-simple-tc/Makefile b/package/gluon-simple-tc/Makefile index 98609551..1c8ae9b1 100644 --- a/package/gluon-simple-tc/Makefile +++ b/package/gluon-simple-tc/Makefile @@ -27,13 +27,14 @@ define Build/Configure endef define Build/Compile - $(GLUON_CONFIGURE) invariant.pl > $(PKG_BUILD_DIR)/invariant.sh endef define Package/gluon-simple-tc/install $(CP) ./files/* $(1)/ + $(INSTALL_DIR) $(1)/lib/gluon/upgrade/simple-tc/invariant - $(INSTALL_BIN) $(PKG_BUILD_DIR)/invariant.sh $(1)/lib/gluon/upgrade/simple-tc/invariant/010-site-defaults + $(GLUON_CONFIGURE) invariant.pl > $(1)/lib/gluon/upgrade/simple-tc/invariant/010-site-defaults + chmod +x $(1)/lib/gluon/upgrade/simple-tc/invariant/010-site-defaults endef $(eval $(call BuildPackage,gluon-simple-tc)) From b4ce3416015a79f0afcc91d73e9a6f63b9ddb3ef Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Thu, 6 Feb 2014 20:21:11 +0100 Subject: [PATCH 192/453] gluon-config-mode: fix type (gluon-locaton -> gluon-location) --- .../usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua index d0caee7c..01678156 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua @@ -53,7 +53,7 @@ zu können benötigen wir seine Koordinaten. Hier hast du die Möglichkeit diese zu hinterlegen.]]) o = s:option(Flag, "_location", "Knoten auf der Karte anzeigen") -o.default = uci:get_first("gluon-locaton", "location", "share_location", o.disabled) +o.default = uci:get_first("gluon-location", "location", "share_location", o.disabled) o.rmempty = false o = s:option(Value, "_latitude", "Breitengrad") From 732727dde5ad38ecb7f11c876f884c567916ce27 Mon Sep 17 00:00:00 2001 From: ruben Date: Thu, 6 Feb 2014 23:10:41 +0100 Subject: [PATCH 193/453] gluon-config-mode: Corrected grammar --- .../usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua index 01678156..a96993f7 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua @@ -49,7 +49,7 @@ o.rmempty = false o.datatype = "integer" s = f:section(SimpleSection, nil, [[Um deinen Knoten auf der Karte anzeigen -zu können benötigen wir seine Koordinaten. Hier hast du die Möglichkeit +zu können, benötigen wir seine Koordinaten. Hier hast du die Möglichkeit, diese zu hinterlegen.]]) o = s:option(Flag, "_location", "Knoten auf der Karte anzeigen") From bb32d5c3a9f7f44df2baf482a6760cc242d30d53 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Sun, 9 Feb 2014 23:16:34 +0100 Subject: [PATCH 194/453] gluon-autoupdater: depend on sha512sum This makes gluon-autoupdater depend on coreutils-sha512sum when it's not included in busybox. --- package/gluon-autoupdater/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-autoupdater/Makefile b/package/gluon-autoupdater/Makefile index 0be3cbc9..93b08067 100644 --- a/package/gluon-autoupdater/Makefile +++ b/package/gluon-autoupdater/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/package.mk define Package/gluon-autoupdater SECTION:=gluon CATEGORY:=Gluon - DEPENDS:=+gluon-core +gluon-cron +ecdsautils + DEPENDS:=+gluon-core +gluon-cron +ecdsautils +!BUSYBOX_CONFIG_SHA512SUM:coreutils-sha512sum TITLE:=Automatically update firmware endef From 6e4596fe8759a32b64d22abae60f043fa9fe68a5 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Sun, 9 Feb 2014 23:17:50 +0100 Subject: [PATCH 195/453] gluon-luci-admin: remove translation support We'll have to revisit translations at a later point after configmode and expertmode have matured. Texts in this package were pretty inconsistent anyway so there is no point in keeping translations for random text fragments. --- .../lib/lua/luci/controller/admin/index.lua | 6 +-- .../lib/lua/luci/controller/admin/system.lua | 8 ++-- .../lib/lua/luci/model/cbi/admin/passwd.lua | 16 ++++---- .../lib/lua/luci/view/admin/applyreboot.htm | 8 ++-- .../usr/lib/lua/luci/view/admin/backup.htm | 12 +++--- .../usr/lib/lua/luci/view/admin/index.htm | 2 +- .../usr/lib/lua/luci/view/admin/reboot.htm | 12 +++--- .../usr/lib/lua/luci/view/admin/upgrade.htm | 38 +++++++++---------- 8 files changed, 51 insertions(+), 51 deletions(-) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua index fb5000af..a39fc73a 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua @@ -30,7 +30,7 @@ function index() root.index = true end - local page = entry({"admin"}, alias("admin", "index"), _("Expertmode"), 10) + local page = entry({"admin"}, alias("admin", "index"), "Expertmode", 10) page.sysauth = "root" if configmode then -- force root to be logged in when running in configmode @@ -40,10 +40,10 @@ function index() end page.index = true - entry({"admin", "index"}, form("admin/index"), _("Overview"), 1).ignoreindex = true + entry({"admin", "index"}, form("admin/index"), "Overview", 1).ignoreindex = true if not configmode then - entry({"admin", "logout"}, call("action_logout"), _("Logout")) + entry({"admin", "logout"}, call("action_logout"), "Logout") end end diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua index 457f1dde..1ca546a3 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua @@ -16,10 +16,10 @@ $Id$ module("luci.controller.admin.system", package.seeall) function index() - entry({"admin", "passwd"}, cbi("admin/passwd"), _("Admin Password"), 10) - entry({"admin", "backup"}, call("action_backup"), _("Backup / Restore"), 80) - entry({"admin", "upgrade"}, call("action_upgrade"), _("Flash Firmware"), 90) - entry({"admin", "reboot"}, call("action_reboot"), _("Reboot"), 100) + entry({"admin", "passwd"}, cbi("admin/passwd"), "Admin Password", 10) + entry({"admin", "backup"}, call("action_backup"), "Backup / Restore", 80) + entry({"admin", "upgrade"}, call("action_upgrade"), "Flash Firmware", 90) + entry({"admin", "reboot"}, call("action_reboot"), "Reboot", 100) end function action_backup() diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/passwd.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/passwd.lua index 9f1ba873..5658ce9f 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/passwd.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/passwd.lua @@ -20,16 +20,16 @@ local m, s, pw1, pw2 m = Map("system", "Passwort & SSH Keys") -s = m:section(TypedSection, translate("Router Password"), - translate("Changes the administrator password for accessing the device")) +s = m:section(TypedSection, "Router Password", + "Changes the administrator password for accessing the device") s.addremove = false s.anonymous = true -pw1 = s:option(Value, "pw1", translate("Password")) +pw1 = s:option(Value, "pw1", "Password") pw1.password = true -pw2 = s:option(Value, "pw2", translate("Confirmation")) +pw2 = s:option(Value, "pw2", "Confirmation") pw2.password = true function s.cfgsections() @@ -43,19 +43,19 @@ function m.on_commit(map) if v1 and v2 and #v1 > 0 and #v2 > 0 then if v1 == v2 then if luci.sys.user.setpasswd(luci.dispatcher.context.authuser, v1) == 0 then - m.message = translate("Password successfully changed!") + m.message = "Password successfully changed!" else - m.message = translate("Unknown Error, password not changed!") + m.message = "Unknown Error, password not changed!" end else - m.message = translate("Given password confirmation did not match, password not changed!") + m.message = "Given password confirmation did not match, password not changed!" end end end if fs.access("/etc/config/dropbear") then s = m:section(TypedSection, "_keys", "SSH Keys", - translate("Here you can paste public SSH-Keys (one per line) for SSH public-key authentication.")) + "Here you can paste public SSH-Keys (one per line) for SSH public-key authentication.") s.addremove = false s.anonymous = true diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/applyreboot.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/applyreboot.htm index 8ff7118c..46fa4b6d 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/applyreboot.htm +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/applyreboot.htm @@ -13,9 +13,9 @@ $Id$ -%> <%+header%> -

<%:System%>

+

System


-

<% if msg then %><%=msg%><% else %><%:Changes applied.%><% end %>

-

<%:Please wait: Device rebooting...%>

+

<% if msg then %><%=msg%><% else %>Changes applied.<% end %>

+

Please wait: Device rebooting...

-<%+footer%> \ No newline at end of file +<%+footer%> diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/backup.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/backup.htm index 167419da..5299b013 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/backup.htm +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/backup.htm @@ -13,14 +13,14 @@ $Id$ -%> <%+header%> -

<%:Backup / Restore%>

-

<%:Here you can backup and restore your configuration and - if possible - reset this device to the default settings.%>

+

Backup / Restore

+

Here you can backup and restore your configuration and - if possible - reset this device to the default settings.


@@ -28,12 +28,12 @@ $Id$
-
<%:Backup Archive%>:
+
Backup Archive:
- +
<%+footer%> diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/index.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/index.htm index c1656a7e..c789bb88 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/index.htm +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/index.htm @@ -1,4 +1,4 @@ -

<%:Hello!%>

+

Hallo!

Dies ist der Experten-Modus deines Freifunkknotens.

Hier kannst du weitere Einstellungen vornehmen, Firmware Upates einspielen und auch vieles kaputt machen.

diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm index 91699e3a..2eaf6d70 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm @@ -13,19 +13,19 @@ $Id$ -%> <%+header%> -

<%:Reboot%>

-

<%:Reboots the operating system of your device%>

+

Reboot

+

Reboots the operating system of your device

<%- local c = require("luci.model.uci").cursor():changes() if c and next(c) then -%> -

<%:Warning: There are unsaved changes that will be lost while rebooting!%>

+

Warning: There are unsaved changes that will be lost while rebooting!

<%- end if not reboot then -%> -

<%:Perform reboot%>

+

Perform reboot

<%- else -%> -

<%:Please wait: Device rebooting...%>

+

Please wait: Device rebooting...

<%- end -%> -<%+footer%> \ No newline at end of file +<%+footer%> diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm index 3d75b415..3380dc63 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm @@ -15,58 +15,58 @@ $Id$ <%+header%> -

<%:Flash Firmware%>

+

Flash Firmware

<% if step == 1 then %> <% if supported then %>

- <%:Upload an OpenWrt image file to reflash the device.%> + Upload an OpenWrt image file to reflash the device. <% if bad_image then %>

-

<%:The uploaded image file does not +
The uploaded image file does not contain a supported format. Make sure that you choose the generic - image format for your platform. %>
+ image format for your platform.
<% end %>

- <%:Firmware image%>:
+ Firmware image:


<% if keepavail then -%> - <%:Keep configuration files%> + Keep configuration files <% end -%>
- +
<% else %> -
<%_ Sorry. +
Sorry. OpenWrt does not support a system upgrade on this platform.
- You need to manually flash your device. %>
+ You need to manually flash your device.
<% end %> <% elseif step == 2 then %>

- <%_ The flash image was uploaded. + The flash image was uploaded. Below is the checksum and file size listed, compare them with the original file to ensure data integrity.
- Click "Proceed" below to start the flash procedure. %> + Click "Proceed" below to start the flash procedure. <% if flashsize > 0 and filesize > flashsize then %>

-

<%:It appears that you try to +
It appears that you try to flash an image that does not fit into the flash memory, please verify - the image file! %>
+ the image file!
<% end %>
    -
  • <%:Checksum%>: <%=checksum%>
  • -
  • <%:Size%>: <% +
  • Checksum: <%=checksum%>
  • +
  • Size: <% local w = require "luci.tools.webadmin" write(w.byte_format(filesize)) @@ -83,20 +83,20 @@ $Id$
    " /> - +
    " /> - +
<% elseif step == 3 then %> -

<%_ The system is flashing now.
+

The system is flashing now.
DO NOT POWER OFF THE DEVICE!
Wait a few minutes until you try to reconnect. It might be necessary to renew the address of your computer to reach the device - again, depending on your settings. %>

+ again, depending on your settings.

<% end %> From a365d626c295dfc8109c9f34df64054d5c264c99 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Sun, 9 Feb 2014 23:20:38 +0100 Subject: [PATCH 196/453] gluon-luci-core: replacing luci-mod-admin-core This commit adds gluon-luci-core, a package both gluon-config-mode and gluon-luci-admin will depend on. gluon-luci-core itself will depends on gluon-luci-theme, gluon-core and most importantly luci-lib-web. It also copies a few files from luci-mod-admin-core but leaves out everyting we do not use. At a later point I plan to move functionality from luci-lib-web into this package, too. luci-lib-web contains most parts of luci including hardcoded templates for CBI, which I intend to replace. --- package/gluon-config-mode/Makefile | 2 +- package/gluon-luci-admin/Makefile | 2 +- package/gluon-luci-core/Makefile | 39 ++++++++++++++ .../files/usr/lib/lua/luci/view/error404.htm | 19 +++++++ .../files/usr/lib/lua/luci/view/error500.htm | 19 +++++++ .../files/usr/lib/lua/luci/view/footer.htm | 15 ++++++ .../files/usr/lib/lua/luci/view/header.htm | 21 ++++++++ .../files/usr/lib/lua/luci/view/sysauth.htm | 54 +++++++++++++++++++ 8 files changed, 169 insertions(+), 2 deletions(-) create mode 100644 package/gluon-luci-core/Makefile create mode 100644 package/gluon-luci-core/files/usr/lib/lua/luci/view/error404.htm create mode 100644 package/gluon-luci-core/files/usr/lib/lua/luci/view/error500.htm create mode 100644 package/gluon-luci-core/files/usr/lib/lua/luci/view/footer.htm create mode 100644 package/gluon-luci-core/files/usr/lib/lua/luci/view/header.htm create mode 100644 package/gluon-luci-core/files/usr/lib/lua/luci/view/sysauth.htm diff --git a/package/gluon-config-mode/Makefile b/package/gluon-config-mode/Makefile index dfd252ef..4d52bd29 100644 --- a/package/gluon-config-mode/Makefile +++ b/package/gluon-config-mode/Makefile @@ -15,7 +15,7 @@ define Package/gluon-config-mode SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci based config mode for user friendly setup of new meshnodes - DEPENDS:=+gluon-core +gluon-lock-password +gluon-location +gluon-simple-tc +gluon-luci-theme +uhttpd +dnsmasq +luci-mod-admin-core +ip + DEPENDS:=+gluon-luci-core +gluon-lock-password +gluon-location +gluon-simple-tc +uhttpd +dnsmasq +ip endef define Package/gluon-config-mode/description diff --git a/package/gluon-luci-admin/Makefile b/package/gluon-luci-admin/Makefile index d9d96381..16dc0cbf 100644 --- a/package/gluon-luci-admin/Makefile +++ b/package/gluon-luci-admin/Makefile @@ -15,7 +15,7 @@ define Package/gluon-luci-admin SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci based simple administration interface for mesh nodes - DEPENDS:=+gluon-core +gluon-luci-theme +luci-mod-admin-core + DEPENDS:=+gluon-luci-core +gluon-config-mode endef define Package/gluon-luci-admin/description diff --git a/package/gluon-luci-core/Makefile b/package/gluon-luci-core/Makefile new file mode 100644 index 00000000..2cee3861 --- /dev/null +++ b/package/gluon-luci-core/Makefile @@ -0,0 +1,39 @@ +# Copyright (C) 2013 Nils Schneider +# This is free software, licensed under the Apache 2.0 license. + +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-luci-core +PKG_VERSION:=0.1 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-luci-core + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Luci code shared by configmode and expertmode + DEPENDS:=+gluon-core +gluon-luci-theme +luci-lib-web +endef + +define Package/gluon-luci-core/description + Luci code shared by various gluon packages +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-luci-core/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-luci-core)) diff --git a/package/gluon-luci-core/files/usr/lib/lua/luci/view/error404.htm b/package/gluon-luci-core/files/usr/lib/lua/luci/view/error404.htm new file mode 100644 index 00000000..813604d1 --- /dev/null +++ b/package/gluon-luci-core/files/usr/lib/lua/luci/view/error404.htm @@ -0,0 +1,19 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +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$ + +-%> +<%+header%> +

404 <%:Not Found%>

+

<%:Sorry, the object you requested was not found.%>

+<%:Unable to dispatch%>: <%=luci.http.request.env.PATH_INFO%> +<%+footer%> diff --git a/package/gluon-luci-core/files/usr/lib/lua/luci/view/error500.htm b/package/gluon-luci-core/files/usr/lib/lua/luci/view/error500.htm new file mode 100644 index 00000000..14ba0410 --- /dev/null +++ b/package/gluon-luci-core/files/usr/lib/lua/luci/view/error500.htm @@ -0,0 +1,19 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +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$ + +-%> +<%+header%> +

500 <%:Internal Server Error%>

+

<%:Sorry, the server encountered an unexpected error.%>

+
<%=message%>
+<%+footer%> diff --git a/package/gluon-luci-core/files/usr/lib/lua/luci/view/footer.htm b/package/gluon-luci-core/files/usr/lib/lua/luci/view/footer.htm new file mode 100644 index 00000000..6c6d2142 --- /dev/null +++ b/package/gluon-luci-core/files/usr/lib/lua/luci/view/footer.htm @@ -0,0 +1,15 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +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$ + +-%> +<% include("themes/" .. theme .. "/footer") %> \ No newline at end of file diff --git a/package/gluon-luci-core/files/usr/lib/lua/luci/view/header.htm b/package/gluon-luci-core/files/usr/lib/lua/luci/view/header.htm new file mode 100644 index 00000000..77018b11 --- /dev/null +++ b/package/gluon-luci-core/files/usr/lib/lua/luci/view/header.htm @@ -0,0 +1,21 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +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$ + +-%> + +<% + if not luci.dispatcher.context.template_header_sent then + include("themes/" .. theme .. "/header") + luci.dispatcher.context.template_header_sent = true + end +%> diff --git a/package/gluon-luci-core/files/usr/lib/lua/luci/view/sysauth.htm b/package/gluon-luci-core/files/usr/lib/lua/luci/view/sysauth.htm new file mode 100644 index 00000000..8c4b19c7 --- /dev/null +++ b/package/gluon-luci-core/files/usr/lib/lua/luci/view/sysauth.htm @@ -0,0 +1,54 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008-2012 Jo-Philipp Wich + +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$ + +-%> + +<%+header%> + +
"> +
+

<%:Authorization Required%>

+
+ <%:Please enter your username and password.%> + <%- if fuser then %> +
<%:Invalid username and/or password! Please try again.%>
+
+ <% end -%> +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+ + +
+
+ +<%+footer%> From 30869d9080c6389a43a7ac4e290c283943efa62f Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 11 Feb 2014 17:10:11 +0100 Subject: [PATCH 197/453] gluon-autoupdater: enable by default only if GLUON_BRANCH is set, set default branch accordingly --- package/gluon-autoupdater/Makefile | 4 ++-- package/gluon-autoupdater/invariant.pl | 14 ++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/package/gluon-autoupdater/Makefile b/package/gluon-autoupdater/Makefile index 93b08067..046a1bcb 100644 --- a/package/gluon-autoupdater/Makefile +++ b/package/gluon-autoupdater/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-autoupdater PKG_VERSION:=0.1 -PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) +PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION)$(if $(GLUON_BRANCH),.$(GLUON_BRANCH)) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) @@ -29,7 +29,7 @@ define Package/gluon-autoupdater/install $(CP) ./files/* $(1)/ $(INSTALL_DIR) $(1)/lib/gluon/upgrade/autoupdater/invariant - $(GLUON_CONFIGURE) invariant.pl > $(1)/lib/gluon/upgrade/autoupdater/invariant/010-autoupdater + GLUON_BRANCH='$(GLUON_BRANCH)' $(GLUON_CONFIGURE) invariant.pl > $(1)/lib/gluon/upgrade/autoupdater/invariant/010-autoupdater chmod +x $(1)/lib/gluon/upgrade/autoupdater/invariant/010-autoupdater endef diff --git a/package/gluon-autoupdater/invariant.pl b/package/gluon-autoupdater/invariant.pl index c6bb3b72..7c5a0a5c 100644 --- a/package/gluon-autoupdater/invariant.pl +++ b/package/gluon-autoupdater/invariant.pl @@ -1,18 +1,16 @@ my $cfg = $CONFIG->{autoupdater}; -print <<'END'; +my $branch = $ENV{GLUON_BRANCH} || $cfg->{branch}; +my $enabled = $ENV{GLUON_BRANCH} ? 1 : 0; + +print <{$_}\n"; -} - -print <<'END'; +set autoupdater.settings.branch=$branch +set autoupdater.settings.enabled=$enabled EOF } From de2c9ceefa2dc5fa02269e42cba22bd15bcff189 Mon Sep 17 00:00:00 2001 From: Daniel Ehlers Date: Thu, 13 Feb 2014 00:21:40 +0100 Subject: [PATCH 198/453] gluon-luci-autoupdater: Fix typo --- .../files/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-luci-autoupdater/files/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua b/package/gluon-luci-autoupdater/files/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua index f3197245..8d6b3f32 100644 --- a/package/gluon-luci-autoupdater/files/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua +++ b/package/gluon-luci-autoupdater/files/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua @@ -14,7 +14,7 @@ $Id$ m = Map("autoupdater", "Autoupdater") -s = m:section(TypedSection, "autoupdater", "Einstelleungen") +s = m:section(TypedSection, "autoupdater", "Einstellungen") s.addremove = false s:option(Flag, "enabled", "Aktivieren") From 601fd3f3ead177e021e71f2348f3b42a40bce402 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Thu, 13 Feb 2014 12:55:34 +0100 Subject: [PATCH 199/453] gluon-status-page: show model --- .../files/lib/gluon/status-page/www/cgi-bin/status | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status b/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status index 01b468da..9cec1f22 100755 --- a/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status +++ b/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status @@ -1,5 +1,7 @@ #!/bin/sh +. /lib/gluon/functions/model.sh + escape_html() { sed 's/&/\&/g; s//\>/g; s/"/\"/g; s/'"'"'/\'/g' } @@ -25,6 +27,7 @@ echo "

$(cat /proc/sys/kernel/hostname)

" echo "
"
 
+echo "Model: $(get_model | escape_html)"
 echo "Firmware release: $(cat /lib/gluon/release | escape_html)"
 echo
 

From 24fd45d4245ef9c8e9625548eb9f2f89980d816a Mon Sep 17 00:00:00 2001
From: Matthias Schiffer 
Date: Thu, 13 Feb 2014 15:41:58 +0100
Subject: [PATCH 200/453] gluon-config-mode: remove bind mounts

---
 .../files/etc/init.d/gluon-config-mode        | 64 +++++++++++--------
 1 file changed, 37 insertions(+), 27 deletions(-)

diff --git a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode
index a29d26d2..20617c72 100755
--- a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode
+++ b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode
@@ -3,11 +3,10 @@
 START=12
 
 
-config_mode_addr=192.168.1.1
-config_mode_netmask=255.255.255.0
+CONFIG_MODE_ADDR=192.168.1.1
+CONFIG_MODE_NETMASK=255.255.255.0
 
-config_mode_dnsname=freifunk
-config_mode_dhcp_range=192.168.1.2,192.168.1.254
+CONFIG_MODE_DHCP_RANGE=192.168.1.2,192.168.1.254
 
 
 delete_interface() {
@@ -24,6 +23,38 @@ check_enable() {
 	fi
 }
 
+setup_network() {
+	export UCI_CONFIG_DIR=/var/gluon/config-mode/config
+
+	mkdir -p "$UCI_CONFIG_DIR"
+
+	cp /etc/config/network "$UCI_CONFIG_DIR"
+
+	config_load network
+	config_foreach delete_interface interface
+
+	uci_add network interface config
+	uci_set network config ifname "$(sysconfig lan_ifname || sysconfig wan_ifname)"
+	uci_set network config type 'bridge'
+	uci_set network config proto 'static'
+	uci_set network config ipaddr "$CONFIG_MODE_ADDR"
+	uci_set network config netmask "$CONFIG_MODE_NETMASK"
+
+	uci_commit network
+
+
+	SERVICE_DAEMONIZE=1
+	SERVICE_WRITE_PID=1
+	service_start /sbin/netifd -c "$UCI_CONFIG_DIR"
+
+	setup_switch() { return 0; }
+
+	include /lib/network
+	setup_switch
+
+	sleep 5
+}
+
 start() {
 	. /lib/gluon/functions/sysconfig.sh
 
@@ -36,27 +67,7 @@ start() {
 		uci set 'gluon-config-mode.@wizard[0].enabled=0'
 		uci commit gluon-config-mode
 
-		mkdir -p /var/gluon/config-mode/config
-		mount -o bind /etc/config /var/gluon/config-mode/config
-
-		touch /var/gluon/config-mode/wireless
-		mount -o bind /var/gluon/config-mode/wireless /etc/config/wireless
-
-		cp /etc/config/network /var/gluon/config-mode
-		mount -o bind /var/gluon/config-mode/network /etc/config/network
-
-		config_load network
-		config_foreach delete_interface interface
-
-		uci_add network interface config
-		uci_set network config ifname "$(sysconfig lan_ifname || sysconfig wan_ifname)"
-		uci_set network config type 'bridge'
-		uci_set network config proto 'static'
-		uci_set network config ipaddr "$config_mode_addr"
-		uci_set network config netmask "$config_mode_netmask"
-
-		uci_commit network
-		/etc/init.d/network start
+		setup_network
 
 		/usr/sbin/telnetd -l /lib/gluon/config-mode/ash-login
 		/etc/init.d/dropbear start
@@ -68,8 +79,7 @@ start() {
 		# correctly finish firstboot
 		/etc/init.d/done boot
 
-		echo "$config_mode_addr $config_mode_dnsname" > /var/gluon/config-mode/hosts
-		dnsmasq -h -H /var/gluon/config-mode/hosts -R -F interface:br-config,$config_mode_dhcp_range -l /tmp/dhcp.leases -O option:router
+		dnsmasq -h -R -F interface:br-config,$CONFIG_MODE_DHCP_RANGE -l /tmp/dhcp.leases -O option:router
 
 		. /etc/diag.sh
 		get_status_led

From 39eed2b9130d9dfa18252462c726a8cb3623109e Mon Sep 17 00:00:00 2001
From: Matthias Schiffer 
Date: Thu, 13 Feb 2014 16:27:40 +0100
Subject: [PATCH 201/453] gluon-config-mode: simplify dnsmasq command, remove
 sleep after network setup

---
 .../gluon-config-mode/files/etc/init.d/gluon-config-mode    | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode
index 20617c72..5492c0ea 100755
--- a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode
+++ b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode
@@ -51,8 +51,6 @@ setup_network() {
 
 	include /lib/network
 	setup_switch
-
-	sleep 5
 }
 
 start() {
@@ -74,13 +72,13 @@ start() {
 
 		/usr/sbin/uhttpd -h /lib/gluon/config-mode/www -x /cgi-bin -A 1 -R -p 0.0.0.0:80
 
+		/usr/sbin/dnsmasq -p 0 -F $CONFIG_MODE_DHCP_RANGE -l /tmp/dhcp.leases -O option:router
+
 		/etc/init.d/led start
 
 		# correctly finish firstboot
 		/etc/init.d/done boot
 
-		dnsmasq -h -R -F interface:br-config,$CONFIG_MODE_DHCP_RANGE -l /tmp/dhcp.leases -O option:router
-
 		. /etc/diag.sh
 		get_status_led
 		status_led_set_timer 1000 300

From c2adf36e200a25053a983d38d367ebe0551e61a6 Mon Sep 17 00:00:00 2001
From: Matthias Schiffer 
Date: Thu, 13 Feb 2014 19:40:36 +0100
Subject: [PATCH 202/453] gluon-config-mode: don't let UCI_CONFIG_DIR leak to
 the telnet environment etc.

---
 .../files/etc/init.d/gluon-config-mode        | 39 ++++++++++---------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode
index 5492c0ea..845ab4c3 100755
--- a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode
+++ b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode
@@ -24,33 +24,34 @@ check_enable() {
 }
 
 setup_network() {
-	export UCI_CONFIG_DIR=/var/gluon/config-mode/config
+	(
+		export UCI_CONFIG_DIR=/var/gluon/config-mode/config
 
-	mkdir -p "$UCI_CONFIG_DIR"
+		mkdir -p "$UCI_CONFIG_DIR"
 
-	cp /etc/config/network "$UCI_CONFIG_DIR"
+		cp /etc/config/network "$UCI_CONFIG_DIR"
 
-	config_load network
-	config_foreach delete_interface interface
+		config_load network
+		config_foreach delete_interface interface
 
-	uci_add network interface config
-	uci_set network config ifname "$(sysconfig lan_ifname || sysconfig wan_ifname)"
-	uci_set network config type 'bridge'
-	uci_set network config proto 'static'
-	uci_set network config ipaddr "$CONFIG_MODE_ADDR"
-	uci_set network config netmask "$CONFIG_MODE_NETMASK"
+		uci_add network interface config
+		uci_set network config ifname "$(sysconfig lan_ifname || sysconfig wan_ifname)"
+		uci_set network config type 'bridge'
+		uci_set network config proto 'static'
+		uci_set network config ipaddr "$CONFIG_MODE_ADDR"
+		uci_set network config netmask "$CONFIG_MODE_NETMASK"
 
-	uci_commit network
+		uci_commit network
 
+		SERVICE_DAEMONIZE=1
+		SERVICE_WRITE_PID=1
+		service_start /sbin/netifd -c "$UCI_CONFIG_DIR"
 
-	SERVICE_DAEMONIZE=1
-	SERVICE_WRITE_PID=1
-	service_start /sbin/netifd -c "$UCI_CONFIG_DIR"
+		setup_switch() { return 0; }
 
-	setup_switch() { return 0; }
-
-	include /lib/network
-	setup_switch
+		include /lib/network
+		setup_switch
+	)
 }
 
 start() {

From 6f302fc8df7d9fb668838362f218b9715d6f0c04 Mon Sep 17 00:00:00 2001
From: Daniel Ehlers 
Date: Mon, 17 Feb 2014 23:23:29 +0100
Subject: [PATCH 203/453] gluon-core: force kernel panic on out of memory

In combination with kernel.panic the node will reboot if out of memory.
---
 package/gluon-core/files/lib/gluon/functions/sysctl.sh       | 4 ++++
 .../files/lib/gluon/upgrade/core/invariant/012-reboot-on-oom | 5 +++++
 2 files changed, 9 insertions(+)
 create mode 100644 package/gluon-core/files/lib/gluon/functions/sysctl.sh
 create mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/invariant/012-reboot-on-oom

diff --git a/package/gluon-core/files/lib/gluon/functions/sysctl.sh b/package/gluon-core/files/lib/gluon/functions/sysctl.sh
new file mode 100644
index 00000000..df1ea217
--- /dev/null
+++ b/package/gluon-core/files/lib/gluon/functions/sysctl.sh
@@ -0,0 +1,4 @@
+sysctl_set() {
+  sed -i "/^${1//./\.}=/d" /etc/sysctl.conf 
+  echo "${1}=$2" >> /etc/sysctl.conf
+}
diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/invariant/012-reboot-on-oom b/package/gluon-core/files/lib/gluon/upgrade/core/invariant/012-reboot-on-oom
new file mode 100755
index 00000000..a457a9c3
--- /dev/null
+++ b/package/gluon-core/files/lib/gluon/upgrade/core/invariant/012-reboot-on-oom
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+. /lib/gluon/functions/sysctl.sh
+
+sysctl_set vm.panic_on_oom 1

From 123fef47f05f0d4de8a3bad99f456d1dad184ee2 Mon Sep 17 00:00:00 2001
From: Nils Schneider 
Date: Tue, 18 Feb 2014 19:17:47 +0100
Subject: [PATCH 204/453] gluon-luci-admin: remove reboot feature

Configmode should be exited by using the wizard instead.
---
 .../lib/lua/luci/controller/admin/system.lua  |  9 ------
 .../usr/lib/lua/luci/view/admin/reboot.htm    | 31 -------------------
 2 files changed, 40 deletions(-)
 delete mode 100644 package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm

diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua
index 1ca546a3..9836284f 100644
--- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua
+++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua
@@ -19,7 +19,6 @@ function index()
 	entry({"admin", "passwd"}, cbi("admin/passwd"), "Admin Password", 10)
 	entry({"admin", "backup"}, call("action_backup"), "Backup / Restore", 80)
 	entry({"admin", "upgrade"}, call("action_upgrade"), "Flash Firmware", 90)
-	entry({"admin", "reboot"}, call("action_reboot"), "Reboot", 100)
 end
 
 function action_backup()
@@ -63,14 +62,6 @@ function action_backup()
 	end
 end
 
-function action_reboot()
-	local reboot = luci.http.formvalue("reboot")
-	luci.template.render("admin/reboot", {reboot=reboot})
-	if reboot then
-		luci.sys.reboot()
-	end
-end
-
 function action_upgrade()
 	require("luci.model.uci")
 
diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm
deleted file mode 100644
index 2eaf6d70..00000000
--- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm
+++ /dev/null
@@ -1,31 +0,0 @@
-<%#
-LuCI - Lua Configuration Interface
-Copyright 2008 Steven Barth 
-Copyright 2008 Jo-Philipp Wich 
-
-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$
-
--%>
-<%+header%>
-

Reboot

-

Reboots the operating system of your device

-<%- -local c = require("luci.model.uci").cursor():changes() -if c and next(c) then --%> -

Warning: There are unsaved changes that will be lost while rebooting!

-<%- -end -if not reboot then --%> -

Perform reboot

-<%- else -%> -

Please wait: Device rebooting...

-<%- end -%> -<%+footer%> From 08bc198e368b8a3cec391c005b440b49c5eaf11e Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 18 Feb 2014 22:21:31 +0100 Subject: [PATCH 205/453] gluon-luci-admin: fix firmware upgrade feature --- .../lib/lua/luci/controller/admin/system.lua | 63 ++++++++++--------- .../usr/lib/lua/luci/view/admin/upgrade.htm | 16 +++-- 2 files changed, 47 insertions(+), 32 deletions(-) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua index 9836284f..fb7eabde 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua @@ -129,35 +129,13 @@ function action_upgrade() local has_platform = nixio.fs.access("/lib/upgrade/platform.sh") local has_upload = luci.http.formvalue("image") - -- This does the actual flashing which is invoked inside an iframe - -- so don't produce meaningful errors here because the the - -- previous pages should arrange the stuff as required. - if step == 4 then - if has_platform and has_image and has_support then - -- Mimetype text/plain - luci.http.prepare_content("text/plain") - luci.http.write("Starting luci-flash...\n") - - -- Now invoke sysupgrade - local keepcfg = keep_avail and luci.http.formvalue("keepcfg") == "1" - local flash = ltn12_popen("/sbin/luci-flash %s %q" %{ - keepcfg and "-k %q" % _keep_pattern() or "", tmpfile - }) - - luci.ltn12.pump.all(flash, luci.http.write) - - -- Make sure the device is rebooted - luci.sys.reboot() - end - - -- -- This is step 1-3, which does the user interaction and -- image upload. -- -- Step 1: file upload, error on unsupported image format - elseif not has_image or not has_support or step == 1 then + if not has_image or not has_support or step == 1 then -- If there is an image but user has requested step 1 -- or type is not supported, then remove it. if has_image then @@ -183,11 +161,16 @@ function action_upgrade() -- Step 3: load iframe which calls the actual flash procedure elseif step == 3 then - luci.template.render("admin/upgrade", { - step=3, - keepconfig=(keep_avail and luci.http.formvalue("keepcfg") == "1") - } ) - end + -- invoke sysupgrade + local keepcfg = keep_avail and luci.http.formvalue("keepcfg") == "1" + fork_exec("/sbin/sysupgrade %s %q" % + { keepcfg and "" or "-n" + , tmpfile + } + ) + + luci.template.render("admin/upgrade", { step=3 } ) + end end function _keep_pattern() @@ -233,3 +216,27 @@ function ltn12_popen(command) nixio.exec("/bin/sh", "-c", command) end end + +function fork_exec(command) + local pid = nixio.fork() + if pid > 0 then + return + elseif pid == 0 then + -- change to root dir + nixio.chdir("/") + + -- patch stdin, out, err to /dev/null + local null = nixio.open("/dev/null", "w+") + if null then + nixio.dup(null, nixio.stderr) + nixio.dup(null, nixio.stdout) + nixio.dup(null, nixio.stdin) + if null:fileno() > 2 then + null:close() + end + end + + -- replace with target command + nixio.exec("/bin/sh", "-c", command) + end +end diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm index 3380dc63..d8827a03 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm @@ -67,8 +67,18 @@ $Id$
  • Checksum: <%=checksum%>
  • Size: <% - local w = require "luci.tools.webadmin" - write(w.byte_format(filesize)) + function byte_format(byte) + local suff = {"B", "KB", "MB", "GB", "TB"} + for i=1, 5 do + if byte > 1024 and i < 5 then + byte = byte / 1024 + else + return string.format("%.2f %s", byte, suff[i]) + end + end + end + + write(byte_format(filesize)) if flashsize > 0 then write(luci.i18n.translatef( @@ -97,8 +107,6 @@ $Id$ Wait a few minutes until you try to reconnect. It might be necessary to renew the address of your computer to reach the device again, depending on your settings.

    - - <% end %> <%+footer%> From 3712f8795c2527cf4afbee641b7802a96854e8f0 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 18 Feb 2014 23:13:42 +0100 Subject: [PATCH 206/453] gluon-luci-admin: remove backup/restore --- .../lib/lua/luci/controller/admin/system.lua | 72 ------------------- .../lib/lua/luci/view/admin/applyreboot.htm | 21 ------ .../usr/lib/lua/luci/view/admin/backup.htm | 39 ---------- 3 files changed, 132 deletions(-) delete mode 100644 package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/applyreboot.htm delete mode 100644 package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/backup.htm diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua index fb7eabde..a27fb7a1 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua @@ -17,51 +17,9 @@ module("luci.controller.admin.system", package.seeall) function index() entry({"admin", "passwd"}, cbi("admin/passwd"), "Admin Password", 10) - entry({"admin", "backup"}, call("action_backup"), "Backup / Restore", 80) entry({"admin", "upgrade"}, call("action_upgrade"), "Flash Firmware", 90) end -function action_backup() - local reset_avail = os.execute([[grep '"rootfs_data"' /proc/mtd >/dev/null 2>&1]]) == 0 - local restore_cmd = "gunzip | tar -xC/ >/dev/null 2>&1" - local backup_cmd = "tar -c %s | gzip 2>/dev/null" - - local restore_fpi - luci.http.setfilehandler( - function(meta, chunk, eof) - if not restore_fpi then - restore_fpi = io.popen(restore_cmd, "w") - end - if chunk then - restore_fpi:write(chunk) - end - if eof then - restore_fpi:close() - end - end - ) - - local upload = luci.http.formvalue("archive") - local backup = luci.http.formvalue("backup") - local reset = reset_avail and luci.http.formvalue("reset") - - if upload and #upload > 0 then - luci.template.render("admin/applyreboot") - luci.sys.reboot() - elseif backup then - local reader = ltn12_popen(backup_cmd:format(_keep_pattern())) - luci.http.header('Content-Disposition', 'attachment; filename="backup-%s-%s.tar.gz"' % { - luci.sys.hostname(), os.date("%Y-%m-%d")}) - luci.http.prepare_content("application/x-targz") - luci.ltn12.pump.all(reader, luci.http.write) - elseif reset then - luci.template.render("admin/applyreboot") - luci.util.exec("mtd -r erase rootfs_data") - else - luci.template.render("admin/backup", {reset_avail = reset_avail}) - end -end - function action_upgrade() require("luci.model.uci") @@ -187,36 +145,6 @@ function _keep_pattern() return kpattern end -function ltn12_popen(command) - - local fdi, fdo = nixio.pipe() - local pid = nixio.fork() - - if pid > 0 then - fdo:close() - local close - return function() - local buffer = fdi:read(2048) - local wpid, stat = nixio.waitpid(pid, "nohang") - if not close and wpid and stat == "exited" then - close = true - end - - if buffer and #buffer > 0 then - return buffer - elseif close then - fdi:close() - return nil - end - end - elseif pid == 0 then - nixio.dup(fdo, nixio.stdout) - fdi:close() - fdo:close() - nixio.exec("/bin/sh", "-c", command) - end -end - function fork_exec(command) local pid = nixio.fork() if pid > 0 then diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/applyreboot.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/applyreboot.htm deleted file mode 100644 index 46fa4b6d..00000000 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/applyreboot.htm +++ /dev/null @@ -1,21 +0,0 @@ -<%# -LuCI - Lua Configuration Interface -Copyright 2008 Steven Barth -Copyright 2008 Jo-Philipp Wich - -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$ - --%> -<%+header%> -

    System

    -
    -

    <% if msg then %><%=msg%><% else %>Changes applied.<% end %>

    -

    Please wait: Device rebooting...

    - -<%+footer%> diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/backup.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/backup.htm deleted file mode 100644 index 5299b013..00000000 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/backup.htm +++ /dev/null @@ -1,39 +0,0 @@ -<%# -LuCI - Lua Configuration Interface -Copyright 2008 Steven Barth -Copyright 2008 Jo-Philipp Wich - -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$ - --%> -<%+header%> -

    Backup / Restore

    -

    Here you can backup and restore your configuration and - if possible - reset this device to the default settings.

    -
    -
    - -
    - -
    - -
    -
    Backup Archive:
    -
    - -
    -
    - -
    -
    -<%+footer%> From 6a2e7d45d8ce92fdf662dff34e1f990e19521daf Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 19 Feb 2014 01:01:41 +0100 Subject: [PATCH 207/453] gluon-autoupdater: drop caches before upgrade This will free about 5 to 12 MB of RAM even on lightly used devices yielding plenty of RAM for autoupdate to succeed. --- package/gluon-autoupdater/files/usr/sbin/autoupdater | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/gluon-autoupdater/files/usr/sbin/autoupdater b/package/gluon-autoupdater/files/usr/sbin/autoupdater index 40c52750..641e437b 100755 --- a/package/gluon-autoupdater/files/usr/sbin/autoupdater +++ b/package/gluon-autoupdater/files/usr/sbin/autoupdater @@ -138,6 +138,10 @@ autoupdate() { if newer_than "$fw_version" "$my_version"; then echo "New version available" + # drop caches to make room for firmware image + sync + sysctl -w vm.drop_caches=3 + local fw_image=$(mktemp) fetch_firmware $MIRROR $fw_image || { rm -f $fw_image; return 1; } From 9c2ba883c9816c2d6e358e86a1f9ec895e343738 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 19 Feb 2014 02:50:52 +0100 Subject: [PATCH 208/453] gluon-luci-admin: system.lua -> upgrade.lua --- .../controller/admin/{system.lua => upgrade.lua} | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) rename package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/{system.lua => upgrade.lua} (98%) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua similarity index 98% rename from package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua rename to package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua index a27fb7a1..477ab27b 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/system.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua @@ -13,7 +13,7 @@ You may obtain a copy of the License at $Id$ ]]-- -module("luci.controller.admin.system", package.seeall) +module("luci.controller.admin.upgrade", package.seeall) function index() entry({"admin", "passwd"}, cbi("admin/passwd"), "Admin Password", 10) @@ -24,7 +24,7 @@ function action_upgrade() require("luci.model.uci") local tmpfile = "/tmp/firmware.img" - + local function image_supported() -- XXX: yay... return ( 0 == os.execute( @@ -34,11 +34,11 @@ function action_upgrade() % tmpfile ) ) end - + local function image_checksum() return (luci.sys.exec("md5sum %q" % tmpfile):match("^([^%s]+)")) end - + local function storage_size() local size = 0 if nixio.fs.access("/proc/mtd") then @@ -86,7 +86,7 @@ function action_upgrade() local has_support = image_supported() local has_platform = nixio.fs.access("/lib/upgrade/platform.sh") local has_upload = luci.http.formvalue("image") - + -- -- This is step 1-3, which does the user interaction and -- image upload. @@ -99,7 +99,7 @@ function action_upgrade() if has_image then nixio.fs.unlink(tmpfile) end - + luci.template.render("admin/upgrade", { step=1, bad_image=(has_image and not has_support or false), @@ -116,7 +116,7 @@ function action_upgrade() flashsize=storage_size(), keepconfig=(keep_avail and luci.http.formvalue("keepcfg") == "1") } ) - + -- Step 3: load iframe which calls the actual flash procedure elseif step == 3 then -- invoke sysupgrade From 072acf5ae3e07e8b37d34e4f41e1e93141f9b1f8 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 19 Feb 2014 01:24:33 +0100 Subject: [PATCH 209/453] gluon-luci-admin: remove unused function --- .../usr/lib/lua/luci/controller/admin/upgrade.lua | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua index 477ab27b..f341b779 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua @@ -131,20 +131,6 @@ function action_upgrade() end end -function _keep_pattern() - local kpattern = "" - local files = luci.model.uci.cursor():get_all("luci", "flash_keep") - if files then - kpattern = "" - for k, v in pairs(files) do - if k:sub(1,1) ~= "." and nixio.fs.glob(v)() then - kpattern = kpattern .. " " .. v - end - end - end - return kpattern -end - function fork_exec(command) local pid = nixio.fork() if pid > 0 then From 26305a715065027c922b1d665f270179076ac94e Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 19 Feb 2014 00:26:49 +0100 Subject: [PATCH 210/453] gluon-luci-admin: replace overview with ssh/pass Various changes and moving stuff around. --- .../lib/lua/luci/controller/admin/index.lua | 2 +- .../lib/lua/luci/controller/admin/upgrade.lua | 3 +- .../lib/lua/luci/model/cbi/admin/index.lua | 14 ---- .../cbi/admin/{passwd.lua => remote.lua} | 70 ++++++++++--------- .../lib/lua/luci/view/admin/expertmode.htm | 57 +++++++++++++++ .../usr/lib/lua/luci/view/admin/index.htm | 5 -- 6 files changed, 96 insertions(+), 55 deletions(-) delete mode 100644 package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/index.lua rename package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/{passwd.lua => remote.lua} (81%) create mode 100644 package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/expertmode.htm delete mode 100644 package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/index.htm diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua index a39fc73a..3b04b37c 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua @@ -40,7 +40,7 @@ function index() end page.index = true - entry({"admin", "index"}, form("admin/index"), "Overview", 1).ignoreindex = true + entry({"admin", "index"}, cbi("admin/remote"), "Remotezugriff", 1).ignoreindex = true if not configmode then entry({"admin", "logout"}, call("action_logout"), "Logout") diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua index f341b779..ff248bfa 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua @@ -16,8 +16,7 @@ $Id$ module("luci.controller.admin.upgrade", package.seeall) function index() - entry({"admin", "passwd"}, cbi("admin/passwd"), "Admin Password", 10) - entry({"admin", "upgrade"}, call("action_upgrade"), "Flash Firmware", 90) + entry({"admin", "upgrade"}, call("action_upgrade"), "Firmware aktualisieren", 90) end function action_upgrade() diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/index.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/index.lua deleted file mode 100644 index cd057248..00000000 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/index.lua +++ /dev/null @@ -1,14 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2008 Steven Barth - -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$ -]]-- -return Template("admin/index") diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/passwd.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/remote.lua similarity index 81% rename from package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/passwd.lua rename to package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/remote.lua index 5658ce9f..ebbba3a3 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/passwd.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/remote.lua @@ -18,9 +18,42 @@ local fs = require "nixio.fs" local m, s, pw1, pw2 -m = Map("system", "Passwort & SSH Keys") +m = Map("system", "Remotezugriff") +m.submit = "Speichern" +m.reset = "Zurücksetzen" +m.pageaction = false +m.template = "admin/expertmode" -s = m:section(TypedSection, "Router Password", +if fs.access("/etc/config/dropbear") then + s = m:section(TypedSection, "_keys", nil, + "Here you can paste public SSH-Keys (one per line) for SSH public-key authentication.") + + s.addremove = false + s.anonymous = true + + function s.cfgsections() + return { "_keys" } + end + + local keys + + keys = s:option(TextValue, "_data", "") + keys.wrap = "off" + keys.rows = 5 + keys.rmempty = false + + function keys.cfgvalue() + return fs.readfile("/etc/dropbear/authorized_keys") or "" + end + + function keys.write(self, section, value) + if value then + fs.writefile("/etc/dropbear/authorized_keys", value:gsub("\r\n", "\n")) + end + end +end + +s = m:section(TypedSection, "_pass", nil, "Changes the administrator password for accessing the device") s.addremove = false @@ -45,39 +78,10 @@ function m.on_commit(map) if luci.sys.user.setpasswd(luci.dispatcher.context.authuser, v1) == 0 then m.message = "Password successfully changed!" else - m.message = "Unknown Error, password not changed!" + m.errmessage = "Unknown Error, password not changed!" end else - m.message = "Given password confirmation did not match, password not changed!" - end - end -end - -if fs.access("/etc/config/dropbear") then - s = m:section(TypedSection, "_keys", "SSH Keys", - "Here you can paste public SSH-Keys (one per line) for SSH public-key authentication.") - - s.addremove = false - s.anonymous = true - - function s.cfgsections() - return { "_keys" } - end - - local keys - - keys = s:option(TextValue, "_data", "") - keys.wrap = "off" - keys.rows = 3 - keys.rmempty = false - - function keys.cfgvalue() - return fs.readfile("/etc/dropbear/authorized_keys") or "" - end - - function keys.write(self, section, value) - if value then - fs.writefile("/etc/dropbear/authorized_keys", value:gsub("\r\n", "\n")) + m.errmessage = "Given password confirmation did not match, password not changed!" end end end diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/expertmode.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/expertmode.htm new file mode 100644 index 00000000..5fe211b8 --- /dev/null +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/expertmode.htm @@ -0,0 +1,57 @@ +<%- if self.message then %> +

    <%=self.message%>

    +<%- end %> +<%- if self.errmessage then %> +

    <%=self.errmessage%>

    +<%- end %> +<% if not self.embedded then %> +
    +
    + + +
    +<% end %> +
    + <% if self.title and #self.title > 0 then %>

    <%=self.title%>

    <% end %> + <% if self.description and #self.description > 0 then %>
    <%=self.description%>
    <% end %> + <% self:render_children() %> +
    +
    +<% if not self.embedded then %> +
    +<%- + if type(self.hidden) == "table" then + for k, v in pairs(self.hidden) do +-%> + +<%- + end + end +%> +<% if redirect then %> +
    + +
    +<% end %> +<%- if self.flow and self.flow.skip then %> + +<% end %> +<%- if self.submit ~= false then %> + +<% end %> +<%- if self.reset ~= false then %> + +<% end %> +<%- if self.cancel ~= false and self.on_cancel then %> + +<% end %> + +
    +
    +<% end %> diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/index.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/index.htm deleted file mode 100644 index c789bb88..00000000 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/index.htm +++ /dev/null @@ -1,5 +0,0 @@ -

    Hallo!

    -

    Dies ist der Experten-Modus deines Freifunkknotens.

    -

    Hier kannst du weitere Einstellungen vornehmen, Firmware Upates - einspielen und auch vieles kaputt machen.

    -

    Sei bitte vorsichtig!

    From cbacca61087ffea5ad2134de4b4b27db034560d3 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 19 Feb 2014 01:16:21 +0100 Subject: [PATCH 211/453] gluon-luci-autoupdater: use expertmode template --- .../files/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/gluon-luci-autoupdater/files/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua b/package/gluon-luci-autoupdater/files/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua index 8d6b3f32..960fe404 100644 --- a/package/gluon-luci-autoupdater/files/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua +++ b/package/gluon-luci-autoupdater/files/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua @@ -13,6 +13,10 @@ $Id$ ]]-- m = Map("autoupdater", "Autoupdater") +m.submit = "Speichern" +m.reset = "Zurücksetzen" +m.pageaction = false +m.template = "admin/expertmode" s = m:section(TypedSection, "autoupdater", "Einstellungen") s.addremove = false From 0b3db87d6fe30d178a41352286e3ab36d66c53cf Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 19 Feb 2014 03:20:41 +0100 Subject: [PATCH 212/453] gluon-luci-admin: expertmode texts translated --- .../lib/lua/luci/model/cbi/admin/remote.lua | 14 ++-- .../lib/lua/luci/view/admin/expertmode.htm | 1 - .../usr/lib/lua/luci/view/admin/upgrade.htm | 67 +++++++++---------- 3 files changed, 37 insertions(+), 45 deletions(-) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/remote.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/remote.lua index ebbba3a3..4513d59c 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/remote.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/remote.lua @@ -26,7 +26,7 @@ m.template = "admin/expertmode" if fs.access("/etc/config/dropbear") then s = m:section(TypedSection, "_keys", nil, - "Here you can paste public SSH-Keys (one per line) for SSH public-key authentication.") + "Hier hast du die Möglichkeit SSH-Keys (einen pro Zeile) zu hinterlegen:") s.addremove = false s.anonymous = true @@ -54,15 +54,15 @@ if fs.access("/etc/config/dropbear") then end s = m:section(TypedSection, "_pass", nil, - "Changes the administrator password for accessing the device") + "Alternativ kannst du auch ein Passwort setzen. Wähle bitte ein sicheres Passwort, das du nirgendswo anders verwendest.") s.addremove = false s.anonymous = true -pw1 = s:option(Value, "pw1", "Password") +pw1 = s:option(Value, "pw1", "Passwort") pw1.password = true -pw2 = s:option(Value, "pw2", "Confirmation") +pw2 = s:option(Value, "pw2", "Wiederholung") pw2.password = true function s.cfgsections() @@ -76,12 +76,12 @@ function m.on_commit(map) if v1 and v2 and #v1 > 0 and #v2 > 0 then if v1 == v2 then if luci.sys.user.setpasswd(luci.dispatcher.context.authuser, v1) == 0 then - m.message = "Password successfully changed!" + m.message = "Passwort geändert." else - m.errmessage = "Unknown Error, password not changed!" + m.errmessage = "Das Passwort konnte nicht geändert werden." end else - m.errmessage = "Given password confirmation did not match, password not changed!" + m.errmessage = "Die beiden Passwörter stimmen nicht überein." end end end diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/expertmode.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/expertmode.htm index 5fe211b8..2907ecb3 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/expertmode.htm +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/expertmode.htm @@ -15,7 +15,6 @@ <% if self.title and #self.title > 0 then %>

    <%=self.title%>

    <% end %> <% if self.description and #self.description > 0 then %>
    <%=self.description%>
    <% end %> <% self:render_children() %> -
<% if not self.embedded then %>
diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm index d8827a03..ad0901f9 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm @@ -15,58 +15,50 @@ $Id$ <%+header%> -

Flash Firmware

+

Firmware aktualisieren

<% if step == 1 then %> <% if supported then %>

- Upload an OpenWrt image file to reflash the device. - <% if bad_image then %> -

-

The uploaded image file does not - contain a supported format. Make sure that you choose the generic - image format for your platform.
- <% end %> + Hier kannst du ein manuelles Firmwareupdate durchführen.

+ <% if bad_image then %> +

Die übermittelte Firmwaredatei kann nicht verwendet werden.

+ <% end %>
- Firmware image:
+

Firmware image

-
-
<% if keepavail then -%> +
- Keep configuration files + <% end -%> -
- +
+ +
<% else %> -
Sorry. - OpenWrt does not support a system upgrade on this platform.
- You need to manually flash your device.
+

Auf diesem Gerät kann kein Upgrade durchgeführt werden. + Bitte führe das Upgrade manuell durch.

<% end %> <% elseif step == 2 then %>

- The flash image was uploaded. - Below is the checksum and file size listed, - compare them with the original file to ensure data integrity.
- Click "Proceed" below to start the flash procedure. + Die Firmwaredatei wurde übermittelt. Bitte vergleiche MD5-Checksumme + und Dateigröße und klicke anschließend auf "Fortfahren". +

- <% if flashsize > 0 and filesize > flashsize then %> -

-
It appears that you try to - flash an image that does not fit into the flash memory, please verify - the image file!
- <% end %> + <% if flashsize > 0 and filesize > flashsize then %> +

Die Firmware passt nicht in den Speicher des Gerätes.

+ <% end %> -
+

    -
  • Checksum: <%=checksum%>
  • -
  • Size: <% +
  • md5sum: <%=checksum%>
  • +
  • Größe: <% function byte_format(byte) local suff = {"B", "KB", "MB", "GB", "TB"} for i=1, 5 do @@ -93,20 +85,21 @@ $Id$
    " /> - +
    " /> - +
<% elseif step == 3 then %> -

The system is flashing now.
- DO NOT POWER OFF THE DEVICE!
- Wait a few minutes until you try to reconnect. - It might be necessary to renew the address of your computer to reach the device - again, depending on your settings.

+

+ Die Firmware wird jetzt aktualisiert. + UNTERBRECHE AUF KEINEN FALL DIE STROMVERSORGUNG! + Dieser Vorgang wird einige Minuten dauern. Anschließend startet + das Gerät automatisch neu. +

<% end %> <%+footer%> From c31df31553db058ecca8439112de0c63bc9a5db7 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 19 Feb 2014 11:26:22 +0100 Subject: [PATCH 213/453] gluon-luci-theme: show gluon release --- .../files/usr/lib/lua/luci/view/themes/gluon/header.htm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package/gluon-luci-theme/files/usr/lib/lua/luci/view/themes/gluon/header.htm b/package/gluon-luci-theme/files/usr/lib/lua/luci/view/themes/gluon/header.htm index c0f10b75..730647bc 100644 --- a/package/gluon-luci-theme/files/usr/lib/lua/luci/view/themes/gluon/header.htm +++ b/package/gluon-luci-theme/files/usr/lib/lua/luci/view/themes/gluon/header.htm @@ -16,8 +16,10 @@ $Id$ local sys = require "luci.sys" local http = require "luci.http" local disp = require "luci.dispatcher" + local fs = require "nixio.fs" local hostname = sys.hostname() + local release = fs.readfile("/lib/gluon/release") local load1, load5, load15 = sys.loadavg() local request = disp.context.path @@ -116,6 +118,9 @@ $Id$ From 41dbaed19e374b34cf19d2ec7e96ee3413e12adb Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 14 May 2014 13:48:47 +0200 Subject: [PATCH 254/453] gluon-config-mode: fix reboot.htm validity --- .../files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm b/package/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm index fdf04d9a..238da275 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm @@ -1,5 +1,8 @@ - + + + + <%=hostname%> - <% if title then %><%=title%><% else %><%:Rebooting...%><% end %> From ee829e8c90259d5a456a0219d760711f0160535b Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 14 May 2014 14:22:06 +0200 Subject: [PATCH 255/453] gluon-radvd: replace pregenerated config file with Lua script --- package/gluon-radvd/Makefile | 4 +--- package/gluon-radvd/files/etc/init.d/gluon-radvd | 9 ++++++++- .../files/lib/gluon/radvd/generate_config | 14 ++++++++++++++ .../generate/lib/gluon/radvd/radvd.conf | 10 ---------- 4 files changed, 23 insertions(+), 14 deletions(-) create mode 100755 package/gluon-radvd/files/lib/gluon/radvd/generate_config delete mode 100644 package/gluon-radvd/generate/lib/gluon/radvd/radvd.conf diff --git a/package/gluon-radvd/Makefile b/package/gluon-radvd/Makefile index 6421b4a5..2b99c283 100644 --- a/package/gluon-radvd/Makefile +++ b/package/gluon-radvd/Makefile @@ -1,8 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-radvd -PKG_VERSION:=1 -PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) +PKG_VERSION:=2 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) @@ -31,7 +30,6 @@ endef define Package/gluon-radvd/install $(CP) ./files/* $(1)/ - $(GLUON_GENERATE) ./generate/* $(1)/ endef $(eval $(call BuildPackage,gluon-radvd)) diff --git a/package/gluon-radvd/files/etc/init.d/gluon-radvd b/package/gluon-radvd/files/etc/init.d/gluon-radvd index 2cfe0980..83814d50 100755 --- a/package/gluon-radvd/files/etc/init.d/gluon-radvd +++ b/package/gluon-radvd/files/etc/init.d/gluon-radvd @@ -7,12 +7,19 @@ SERVICE_NAME=gluon-radvd SERVICE_PID_DIR=/var/run/gluon-radvd SERVICE_PID_FILE="$SERVICE_PID_DIR"/gluon-radvd.pid +radvd_conf=/var/gluon/radvd/radvd.conf + start() { mkdir -p "$SERVICE_PID_DIR" chown gluon-radvd "$SERVICE_PID_DIR" - service_start /usr/sbin/radvd -C /lib/gluon/radvd/radvd.conf -m stderr_syslog -u gluon-radvd -p "$SERVICE_PID_FILE" + + mkdir -p "$(dirname "$radvd_conf")" + /lib/gluon/radvd/generate_config > "$radvd_conf" + + service_start /usr/sbin/radvd -C "$radvd_conf" -m stderr_syslog -u gluon-radvd -p "$SERVICE_PID_FILE" } stop() { service_stop /usr/sbin/radvd + rm "$radvd_conf" } diff --git a/package/gluon-radvd/files/lib/gluon/radvd/generate_config b/package/gluon-radvd/files/lib/gluon/radvd/generate_config new file mode 100755 index 00000000..7c0e3a92 --- /dev/null +++ b/package/gluon-radvd/files/lib/gluon/radvd/generate_config @@ -0,0 +1,14 @@ +#!/usr/bin/lua + +local site = require 'gluon.site_config' + +print([[ +interface br-client +{ + IgnoreIfMissing on; + AdvSendAdvert on; + AdvDefaultLifetime 0; + + prefix ]] .. site.prefix6 .. [[ {}; +}; +]]) diff --git a/package/gluon-radvd/generate/lib/gluon/radvd/radvd.conf b/package/gluon-radvd/generate/lib/gluon/radvd/radvd.conf deleted file mode 100644 index d112f6fc..00000000 --- a/package/gluon-radvd/generate/lib/gluon/radvd/radvd.conf +++ /dev/null @@ -1,10 +0,0 @@ -interface br-client -{ - IgnoreIfMissing on; - AdvSendAdvert on; - AdvDefaultLifetime 0; - - prefix @prefix6@ - { - }; -}; From 0953c9befb39ed6c8aeb8d9c2b24022aeb64a05b Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 14 May 2014 15:02:57 +0200 Subject: [PATCH 256/453] gluon-ebtables: use Lua instead of sh for the rule DSL to increase flexibility --- .../files/lib/gluon/ebtables/100-mcast-chain | 2 +- .../lib/gluon/ebtables/110-mcast-allow-arp | 2 +- .../lib/gluon/ebtables/110-mcast-allow-babel | 2 +- .../lib/gluon/ebtables/110-mcast-allow-btlpd | 2 +- .../lib/gluon/ebtables/110-mcast-allow-dhcpv4 | 2 +- .../lib/gluon/ebtables/110-mcast-allow-dhcpv6 | 2 +- .../lib/gluon/ebtables/110-mcast-allow-icmp | 2 +- .../lib/gluon/ebtables/110-mcast-allow-icmpv6 | 2 +- .../lib/gluon/ebtables/110-mcast-allow-igmp | 2 +- .../lib/gluon/ebtables/110-mcast-allow-ospf | 4 +-- .../files/lib/gluon/ebtables/300-mcast | 4 +-- .../files/lib/gluon/ebtables/200-dir-dhcpv4 | 8 +++--- .../files/lib/gluon/ebtables/200-dir-dhcpv6 | 8 +++--- .../files/lib/gluon/ebtables/200-dir-radv | 8 +++--- .../files/etc/init.d/gluon-ebtables | 25 +++++++++---------- .../files/lib/gluon/ebtables/100-dir-chain | 4 +-- .../files/lib/gluon/ebtables/101-dir-rules | 4 +-- .../generate/lib/gluon/ebtables/250-next-node | 24 +++++++++--------- .../lib/gluon/ebtables/300-radv-input-output | 4 +-- 19 files changed, 55 insertions(+), 56 deletions(-) diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/100-mcast-chain b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/100-mcast-chain index 93382f30..ec0013a3 100644 --- a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/100-mcast-chain +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/100-mcast-chain @@ -1 +1 @@ -chain MULTICAST_OUT DROP +chain('MULTICAST_OUT', 'DROP') diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-arp b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-arp index fdb20b1f..1083966d 100644 --- a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-arp +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-arp @@ -1 +1 @@ -rule MULTICAST_OUT -p ARP -j RETURN +rule 'MULTICAST_OUT -p ARP -j RETURN' diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-babel b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-babel index 096ae50e..d5b81771 100644 --- a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-babel +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-babel @@ -1 +1 @@ -rule MULTICAST_OUT -p IPv6 --ip6-protocol udp --ip6-destination-port 6696 -j RETURN +rule 'MULTICAST_OUT -p IPv6 --ip6-protocol udp --ip6-destination-port 6696 -j RETURN' diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-btlpd b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-btlpd index 9776157a..20b709f8 100644 --- a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-btlpd +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-btlpd @@ -1 +1 @@ -rule MULTICAST_OUT -p IPv4 --ip-destination 239.192.152.143 --ip-protocol udp --ip-destination-port 6771 -j RETURN +rule 'MULTICAST_OUT -p IPv4 --ip-destination 239.192.152.143 --ip-protocol udp --ip-destination-port 6771 -j RETURN' diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-dhcpv4 b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-dhcpv4 index 440107a9..2fca2223 100644 --- a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-dhcpv4 +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-dhcpv4 @@ -1 +1 @@ -rule MULTICAST_OUT -p IPv4 --ip-protocol udp --ip-destination-port 67 -j RETURN +rule 'MULTICAST_OUT -p IPv4 --ip-protocol udp --ip-destination-port 67 -j RETURN' diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-dhcpv6 b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-dhcpv6 index 1b523ec4..d156de4f 100644 --- a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-dhcpv6 +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-dhcpv6 @@ -1 +1 @@ -rule MULTICAST_OUT -p IPv6 --ip6-protocol udp --ip6-destination-port 546 -j RETURN +rule 'MULTICAST_OUT -p IPv6 --ip6-protocol udp --ip6-destination-port 546 -j RETURN' diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmp b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmp index e52e5c78..25a95f39 100644 --- a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmp +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmp @@ -1 +1 @@ -rule MULTICAST_OUT -p IPv4 --ip-protocol icmp -j RETURN +rule 'MULTICAST_OUT -p IPv4 --ip-protocol icmp -j RETURN' diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 index 7c50ff5e..b670ff45 100644 --- a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 @@ -1 +1 @@ -rule MULTICAST_OUT -p IPv6 --ip6-protocol ipv6-icmp -j RETURN +rule 'MULTICAST_OUT -p IPv6 --ip6-protocol ipv6-icmp -j RETURN' diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-igmp b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-igmp index 521af563..2d3814ae 100644 --- a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-igmp +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-igmp @@ -1 +1 @@ -rule MULTICAST_OUT -p IPv4 --ip-protocol igmp -j RETURN +rule 'MULTICAST_OUT -p IPv4 --ip-protocol igmp -j RETURN' diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-ospf b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-ospf index 6e540751..da928d4b 100644 --- a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-ospf +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-ospf @@ -1,2 +1,2 @@ -rule MULTICAST_OUT -p IPv4 --ip-protocol ospf -j RETURN -rule MULTICAST_OUT -p IPv6 --ip6-protocol ospf -j RETURN +rule 'MULTICAST_OUT -p IPv4 --ip-protocol ospf -j RETURN' +rule 'MULTICAST_OUT -p IPv6 --ip6-protocol ospf -j RETURN' diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/300-mcast b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/300-mcast index afbc8057..c52f122f 100644 --- a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/300-mcast +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/300-mcast @@ -1,2 +1,2 @@ -rule FORWARD --logical-out br-client -o bat0 -d Multicast -j MULTICAST_OUT -rule OUTPUT --logical-out br-client -o bat0 -d Multicast -j MULTICAST_OUT +rule 'FORWARD --logical-out br-client -o bat0 -d Multicast -j MULTICAST_OUT' +rule 'OUTPUT --logical-out br-client -o bat0 -d Multicast -j MULTICAST_OUT' diff --git a/package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-dhcpv4 b/package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-dhcpv4 index 8771ee15..ec56ff1d 100644 --- a/package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-dhcpv4 +++ b/package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-dhcpv4 @@ -1,5 +1,5 @@ -rule FORWARD -p IPv4 --ip-protocol udp --ip-destination-port 67 -j OUT_ONLY -rule OUTPUT -p IPv4 --ip-protocol udp --ip-destination-port 67 -j OUT_ONLY +rule 'FORWARD -p IPv4 --ip-protocol udp --ip-destination-port 67 -j OUT_ONLY' +rule 'OUTPUT -p IPv4 --ip-protocol udp --ip-destination-port 67 -j OUT_ONLY' -rule FORWARD -p IPv4 --ip-protocol udp --ip-destination-port 68 -j IN_ONLY -rule INPUT -p IPv4 --ip-protocol udp --ip-destination-port 68 -j IN_ONLY +rule 'FORWARD -p IPv4 --ip-protocol udp --ip-destination-port 68 -j IN_ONLY' +rule 'INPUT -p IPv4 --ip-protocol udp --ip-destination-port 68 -j IN_ONLY' diff --git a/package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-dhcpv6 b/package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-dhcpv6 index 234e54e5..d433cdde 100644 --- a/package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-dhcpv6 +++ b/package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-dhcpv6 @@ -1,5 +1,5 @@ -rule FORWARD -p IPv6 --ip6-protocol udp --ip6-destination-port 546 -j OUT_ONLY -rule OUTPUT -p IPv6 --ip6-protocol udp --ip6-destination-port 546 -j OUT_ONLY +rule 'FORWARD -p IPv6 --ip6-protocol udp --ip6-destination-port 546 -j OUT_ONLY' +rule 'OUTPUT -p IPv6 --ip6-protocol udp --ip6-destination-port 546 -j OUT_ONLY' -rule FORWARD -p IPv6 --ip6-protocol udp --ip6-destination-port 547 -j IN_ONLY -rule INPUT -p IPv6 --ip6-protocol udp --ip6-destination-port 547 -j IN_ONLY +rule 'FORWARD -p IPv6 --ip6-protocol udp --ip6-destination-port 547 -j IN_ONLY' +rule 'INPUT -p IPv6 --ip6-protocol udp --ip6-destination-port 547 -j IN_ONLY' diff --git a/package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-radv b/package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-radv index c7257032..b34d4c76 100644 --- a/package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-radv +++ b/package/gluon-ebtables-filter-ra-dhcp/files/lib/gluon/ebtables/200-dir-radv @@ -1,5 +1,5 @@ -rule FORWARD -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type router-solicitation -j OUT_ONLY -rule OUTPUT -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type router-solicitation -j OUT_ONLY +rule 'FORWARD -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type router-solicitation -j OUT_ONLY' +rule 'OUTPUT -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type router-solicitation -j OUT_ONLY' -rule FORWARD -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type router-advertisement -j IN_ONLY -rule INPUT -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type router-advertisement -j IN_ONLY +rule 'FORWARD -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type router-advertisement -j IN_ONLY' +rule 'INPUT -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type router-advertisement -j IN_ONLY' diff --git a/package/gluon-ebtables/files/etc/init.d/gluon-ebtables b/package/gluon-ebtables/files/etc/init.d/gluon-ebtables index cbc3d6ae..5a770452 100755 --- a/package/gluon-ebtables/files/etc/init.d/gluon-ebtables +++ b/package/gluon-ebtables/files/etc/init.d/gluon-ebtables @@ -23,15 +23,14 @@ STOP=91 exec_file() { local file="$1" - sh -c " - eval 'rule() { - $EBTABLES_RULE - }' - eval 'chain() { - $EBTABLES_CHAIN - }' - source \"$1\" - " - "$file" + /usr/bin/lua -e " + function rule(command) + os.execute($EBTABLES_RULE) + end + function chain(name, policy) + os.execute($EBTABLES_CHAIN) + end + " "$file" } exec_all() { @@ -49,8 +48,8 @@ exec_all() { start() { ( - export EBTABLES_RULE='ebtables -A "$@"' - export EBTABLES_CHAIN='ebtables -N "$1" -P "$2"' + export EBTABLES_RULE='"ebtables -A " .. command' + export EBTABLES_CHAIN='"ebtables -N " .. name .. " -P " .. policy' if [ -z "$1" ]; then exec_all '' @@ -62,8 +61,8 @@ start() { stop() { ( - export EBTABLES_RULE='ebtables -D "$@"' - export EBTABLES_CHAIN='ebtables -X "$1"' + export EBTABLES_RULE='"ebtables -D " .. command' + export EBTABLES_CHAIN='"ebtables -X " .. name' if [ -z "$1" ]; then exec_all '-r' diff --git a/package/gluon-ebtables/files/lib/gluon/ebtables/100-dir-chain b/package/gluon-ebtables/files/lib/gluon/ebtables/100-dir-chain index 99908dc4..31c19c53 100644 --- a/package/gluon-ebtables/files/lib/gluon/ebtables/100-dir-chain +++ b/package/gluon-ebtables/files/lib/gluon/ebtables/100-dir-chain @@ -1,2 +1,2 @@ -chain IN_ONLY RETURN -chain OUT_ONLY RETURN +chain('IN_ONLY', 'RETURN') +chain('OUT_ONLY', 'RETURN') diff --git a/package/gluon-ebtables/files/lib/gluon/ebtables/101-dir-rules b/package/gluon-ebtables/files/lib/gluon/ebtables/101-dir-rules index 6c8f44cc..b1cd4e24 100644 --- a/package/gluon-ebtables/files/lib/gluon/ebtables/101-dir-rules +++ b/package/gluon-ebtables/files/lib/gluon/ebtables/101-dir-rules @@ -1,2 +1,2 @@ -rule IN_ONLY --logical-in br-client -i ! bat0 -j DROP -rule OUT_ONLY --logical-out br-client -o ! bat0 -j DROP +rule 'IN_ONLY --logical-in br-client -i ! bat0 -j DROP' +rule 'OUT_ONLY --logical-out br-client -o ! bat0 -j DROP' diff --git a/package/gluon-next-node/generate/lib/gluon/ebtables/250-next-node b/package/gluon-next-node/generate/lib/gluon/ebtables/250-next-node index 08b70dad..7595df29 100644 --- a/package/gluon-next-node/generate/lib/gluon/ebtables/250-next-node +++ b/package/gluon-next-node/generate/lib/gluon/ebtables/250-next-node @@ -1,14 +1,14 @@ -rule FORWARD --logical-out br-client -o bat0 -d @next_node.mac@ -j DROP -rule OUTPUT --logical-out br-client -o bat0 -d @next_node.mac@ -j DROP -rule FORWARD --logical-out br-client -o bat0 -s @next_node.mac@ -j DROP -rule OUTPUT --logical-out br-client -o bat0 -s @next_node.mac@ -j DROP +rule 'FORWARD --logical-out br-client -o bat0 -d @next_node.mac@ -j DROP' +rule 'OUTPUT --logical-out br-client -o bat0 -d @next_node.mac@ -j DROP' +rule 'FORWARD --logical-out br-client -o bat0 -s @next_node.mac@ -j DROP' +rule 'OUTPUT --logical-out br-client -o bat0 -s @next_node.mac@ -j DROP' -rule FORWARD --logical-out br-client -o bat0 -p IPv4 --ip-destination @next_node.ip4@ -j DROP -rule OUTPUT --logical-out br-client -o bat0 -p IPv4 --ip-destination @next_node.ip4@ -j DROP -rule FORWARD --logical-out br-client -o bat0 -p IPv4 --ip-source @next_node.ip4@ -j DROP -rule OUTPUT --logical-out br-client -o bat0 -p IPv4 --ip-source @next_node.ip4@ -j DROP +rule 'FORWARD --logical-out br-client -o bat0 -p IPv4 --ip-destination @next_node.ip4@ -j DROP' +rule 'OUTPUT --logical-out br-client -o bat0 -p IPv4 --ip-destination @next_node.ip4@ -j DROP' +rule 'FORWARD --logical-out br-client -o bat0 -p IPv4 --ip-source @next_node.ip4@ -j DROP' +rule 'OUTPUT --logical-out br-client -o bat0 -p IPv4 --ip-source @next_node.ip4@ -j DROP' -rule FORWARD --logical-out br-client -o bat0 -p IPv6 --ip6-destination @next_node.ip6@ -j DROP -rule OUTPUT --logical-out br-client -o bat0 -p IPv6 --ip6-destination @next_node.ip6@ -j DROP -rule FORWARD --logical-out br-client -o bat0 -p IPv6 --ip6-source @next_node.ip6@ -j DROP -rule OUTPUT --logical-out br-client -o bat0 -p IPv6 --ip6-source @next_node.ip6@ -j DROP +rule 'FORWARD --logical-out br-client -o bat0 -p IPv6 --ip6-destination @next_node.ip6@ -j DROP' +rule 'OUTPUT --logical-out br-client -o bat0 -p IPv6 --ip6-destination @next_node.ip6@ -j DROP' +rule 'FORWARD --logical-out br-client -o bat0 -p IPv6 --ip6-source @next_node.ip6@ -j DROP' +rule 'OUTPUT --logical-out br-client -o bat0 -p IPv6 --ip6-source @next_node.ip6@ -j DROP' diff --git a/package/gluon-radvd/files/lib/gluon/ebtables/300-radv-input-output b/package/gluon-radvd/files/lib/gluon/ebtables/300-radv-input-output index 379e486a..377d11cd 100644 --- a/package/gluon-radvd/files/lib/gluon/ebtables/300-radv-input-output +++ b/package/gluon-radvd/files/lib/gluon/ebtables/300-radv-input-output @@ -1,2 +1,2 @@ -rule INPUT -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type router-solicitation -i bat0 -j DROP -rule OUTPUT -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type router-advertisement -o bat0 -j DROP +rule 'INPUT -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type router-solicitation -i bat0 -j DROP' +rule 'OUTPUT -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type router-advertisement -o bat0 -j DROP' From 9367c1ffe724dfd5032f15ca197d79e75892916f Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 14 May 2014 15:08:43 +0200 Subject: [PATCH 257/453] gluon-next-node: convert pregenerated ebtables rules to Lua code --- package/gluon-next-node/Makefile | 1 - .../files/lib/gluon/ebtables/250-next-node | 17 +++++++++++++++++ .../generate/lib/gluon/ebtables/250-next-node | 14 -------------- 3 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 package/gluon-next-node/files/lib/gluon/ebtables/250-next-node delete mode 100644 package/gluon-next-node/generate/lib/gluon/ebtables/250-next-node diff --git a/package/gluon-next-node/Makefile b/package/gluon-next-node/Makefile index 0edcec64..ee0e0920 100644 --- a/package/gluon-next-node/Makefile +++ b/package/gluon-next-node/Makefile @@ -30,7 +30,6 @@ endef define Package/gluon-next-node/install $(CP) ./files/* $(1)/ - $(GLUON_GENERATE) ./generate/* $(1)/ endef $(eval $(call BuildPackage,gluon-next-node)) diff --git a/package/gluon-next-node/files/lib/gluon/ebtables/250-next-node b/package/gluon-next-node/files/lib/gluon/ebtables/250-next-node new file mode 100644 index 00000000..6b9588f7 --- /dev/null +++ b/package/gluon-next-node/files/lib/gluon/ebtables/250-next-node @@ -0,0 +1,17 @@ +local site = require 'gluon.site_config' +local next_node = site.next_node + +rule('FORWARD --logical-out br-client -o bat0 -d ' .. next_node.mac .. ' -j DROP') +rule('OUTPUT --logical-out br-client -o bat0 -d ' .. next_node.mac .. ' -j DROP') +rule('FORWARD --logical-out br-client -o bat0 -s ' .. next_node.mac .. ' -j DROP') +rule('OUTPUT --logical-out br-client -o bat0 -s ' .. next_node.mac .. ' -j DROP') + +rule('FORWARD --logical-out br-client -o bat0 -p IPv4 --ip-destination ' .. next_node.ip4 .. ' -j DROP') +rule('OUTPUT --logical-out br-client -o bat0 -p IPv4 --ip-destination ' .. next_node.ip4 .. ' -j DROP') +rule('FORWARD --logical-out br-client -o bat0 -p IPv4 --ip-source ' .. next_node.ip4 .. ' -j DROP') +rule('OUTPUT --logical-out br-client -o bat0 -p IPv4 --ip-source ' .. next_node.ip4 .. ' -j DROP') + +rule('FORWARD --logical-out br-client -o bat0 -p IPv6 --ip6-destination ' .. next_node.ip6 .. ' -j DROP') +rule('OUTPUT --logical-out br-client -o bat0 -p IPv6 --ip6-destination ' .. next_node.ip6 .. ' -j DROP') +rule('FORWARD --logical-out br-client -o bat0 -p IPv6 --ip6-source ' .. next_node.ip6 .. ' -j DROP') +rule('OUTPUT --logical-out br-client -o bat0 -p IPv6 --ip6-source ' .. next_node.ip6 .. ' -j DROP') diff --git a/package/gluon-next-node/generate/lib/gluon/ebtables/250-next-node b/package/gluon-next-node/generate/lib/gluon/ebtables/250-next-node deleted file mode 100644 index 7595df29..00000000 --- a/package/gluon-next-node/generate/lib/gluon/ebtables/250-next-node +++ /dev/null @@ -1,14 +0,0 @@ -rule 'FORWARD --logical-out br-client -o bat0 -d @next_node.mac@ -j DROP' -rule 'OUTPUT --logical-out br-client -o bat0 -d @next_node.mac@ -j DROP' -rule 'FORWARD --logical-out br-client -o bat0 -s @next_node.mac@ -j DROP' -rule 'OUTPUT --logical-out br-client -o bat0 -s @next_node.mac@ -j DROP' - -rule 'FORWARD --logical-out br-client -o bat0 -p IPv4 --ip-destination @next_node.ip4@ -j DROP' -rule 'OUTPUT --logical-out br-client -o bat0 -p IPv4 --ip-destination @next_node.ip4@ -j DROP' -rule 'FORWARD --logical-out br-client -o bat0 -p IPv4 --ip-source @next_node.ip4@ -j DROP' -rule 'OUTPUT --logical-out br-client -o bat0 -p IPv4 --ip-source @next_node.ip4@ -j DROP' - -rule 'FORWARD --logical-out br-client -o bat0 -p IPv6 --ip6-destination @next_node.ip6@ -j DROP' -rule 'OUTPUT --logical-out br-client -o bat0 -p IPv6 --ip6-destination @next_node.ip6@ -j DROP' -rule 'FORWARD --logical-out br-client -o bat0 -p IPv6 --ip6-source @next_node.ip6@ -j DROP' -rule 'OUTPUT --logical-out br-client -o bat0 -p IPv6 --ip6-source @next_node.ip6@ -j DROP' From bf7a2c974eea980a7671d221ba1383f3cd29aede Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 14 May 2014 16:53:48 +0200 Subject: [PATCH 258/453] gluon-legacy: don't use generated scripts anymore --- package/gluon-legacy/Makefile | 3 +- .../files/lib/gluon/legacy/legacy-upgrade | 13 +++++++ .../lib/gluon/legacy/legacy-upgrade-late | 8 +++++ .../config-mode/legacy/010-migrate-configured | 20 +++++++++++ .../gluon/upgrade/core/legacy/001-sysconfig | 4 ++- .../upgrade/core/legacy/011-gluon-network | 0 .../gluon/upgrade/core/legacy/020-wireless | 24 +++++++++++++ .../lock-password/legacy/010-lock-password | 0 .../upgrade/mesh-batman-adv/legacy/010-mesh | 22 ++++++++++++ .../legacy/010-reset-fastd-config | 35 +++++++++++++++++++ .../upgrade/simple-tc/legacy/010-migrate-tc | 27 ++++++++++++++ .../generate/lib/gluon/legacy/legacy-upgrade | 12 ------- .../lib/gluon/legacy/legacy-upgrade-late | 3 -- .../config-mode/legacy/010-migrate-configured | 14 -------- .../gluon/upgrade/core/legacy/020-wireless | 19 ---------- .../upgrade/mesh-batman-adv/legacy/010-mesh | 17 --------- .../legacy/010-reset-fastd-config | 28 --------------- .../upgrade/simple-tc/legacy/010-migrate-tc | 19 ---------- 18 files changed, 153 insertions(+), 115 deletions(-) create mode 100755 package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade create mode 100755 package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade-late create mode 100755 package/gluon-legacy/files/lib/gluon/upgrade/config-mode/legacy/010-migrate-configured rename package/gluon-legacy/{generate => files}/lib/gluon/upgrade/core/legacy/001-sysconfig (82%) rename package/gluon-legacy/{generate => files}/lib/gluon/upgrade/core/legacy/011-gluon-network (100%) create mode 100755 package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/020-wireless rename package/gluon-legacy/{generate => files}/lib/gluon/upgrade/lock-password/legacy/010-lock-password (100%) create mode 100755 package/gluon-legacy/files/lib/gluon/upgrade/mesh-batman-adv/legacy/010-mesh create mode 100755 package/gluon-legacy/files/lib/gluon/upgrade/mesh-vpn-fastd/legacy/010-reset-fastd-config create mode 100755 package/gluon-legacy/files/lib/gluon/upgrade/simple-tc/legacy/010-migrate-tc delete mode 100755 package/gluon-legacy/generate/lib/gluon/legacy/legacy-upgrade delete mode 100755 package/gluon-legacy/generate/lib/gluon/legacy/legacy-upgrade-late delete mode 100755 package/gluon-legacy/generate/lib/gluon/upgrade/config-mode/legacy/010-migrate-configured delete mode 100755 package/gluon-legacy/generate/lib/gluon/upgrade/core/legacy/020-wireless delete mode 100755 package/gluon-legacy/generate/lib/gluon/upgrade/mesh-batman-adv/legacy/010-mesh delete mode 100755 package/gluon-legacy/generate/lib/gluon/upgrade/mesh-vpn-fastd/legacy/010-reset-fastd-config delete mode 100755 package/gluon-legacy/generate/lib/gluon/upgrade/simple-tc/legacy/010-migrate-tc diff --git a/package/gluon-legacy/Makefile b/package/gluon-legacy/Makefile index e0377bdb..d074f699 100644 --- a/package/gluon-legacy/Makefile +++ b/package/gluon-legacy/Makefile @@ -2,7 +2,6 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-legacy PKG_VERSION:=1 -PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) @@ -30,7 +29,7 @@ define Build/Compile endef define Package/gluon-legacy/install - $(GLUON_GENERATE) ./generate/* $(1)/ + $(CP) ./files/* $(1)/ endef $(eval $(call BuildPackage,gluon-legacy)) diff --git a/package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade b/package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade new file mode 100755 index 00000000..8ff8c495 --- /dev/null +++ b/package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade @@ -0,0 +1,13 @@ +#!/usr/bin/lua + +local site = require 'gluon.site_config' + +local ret = 1 + +for _, file in pairs(site.legacy.version_files) do + if os.remove(file) then + ret = 0 + end +end + +os.exit(ret) diff --git a/package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade-late b/package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade-late new file mode 100755 index 00000000..08763a09 --- /dev/null +++ b/package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade-late @@ -0,0 +1,8 @@ +#!/usr/bin/lua + +local site = require 'gluon.site_config' + + +for _, file in pairs(site.legacy.old_files) do + os.remove(file) +end diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/config-mode/legacy/010-migrate-configured b/package/gluon-legacy/files/lib/gluon/upgrade/config-mode/legacy/010-migrate-configured new file mode 100755 index 00000000..18bdaf19 --- /dev/null +++ b/package/gluon-legacy/files/lib/gluon/upgrade/config-mode/legacy/010-migrate-configured @@ -0,0 +1,20 @@ +#!/usr/bin/lua + +local site = require 'gluon.site_config' +local uci = require 'luci.model.uci' + +local c = uci.cursor() + + +for _, config in ipairs(site.legacy.config_mode_configs) do + local old = c:get_first(config, 'wizard', 'configured') + if old == '1' then + local wizard = c:get_first('gluon-config-mode', 'wizard') + c:set('gluon-config-mode', wizard, 'configured', '1') + + c:save('gluon-config-mode') + c:commit('gluon-config-mode') + + break + end +end diff --git a/package/gluon-legacy/generate/lib/gluon/upgrade/core/legacy/001-sysconfig b/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/001-sysconfig similarity index 82% rename from package/gluon-legacy/generate/lib/gluon/upgrade/core/legacy/001-sysconfig rename to package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/001-sysconfig index c1bba31b..4fb4a39a 100755 --- a/package/gluon-legacy/generate/lib/gluon/upgrade/core/legacy/001-sysconfig +++ b/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/001-sysconfig @@ -24,7 +24,9 @@ remove_bat0() { sed -r -e 's/(^| )bat0( |$)/ /g' -e 's/^ | $//g' } -mesh_ifname="$(uci get 'network.@legacy.mesh_ifname@.ifname' | remove_bat0)" + +mesh_section="$(lua -e 'print(require("gluon.site_config").legacy.mesh_ifname)')" +mesh_ifname="$(uci get "network.${mesh_section}.ifname" | remove_bat0)" wan_ifname="$(uci get network.wan.ifname)" if [ -n "$wan_ifname" ] && iface_exists "$wan_ifname"; then diff --git a/package/gluon-legacy/generate/lib/gluon/upgrade/core/legacy/011-gluon-network b/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/011-gluon-network similarity index 100% rename from package/gluon-legacy/generate/lib/gluon/upgrade/core/legacy/011-gluon-network rename to package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/011-gluon-network diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/020-wireless b/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/020-wireless new file mode 100755 index 00000000..f6f9335f --- /dev/null +++ b/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/020-wireless @@ -0,0 +1,24 @@ +#!/usr/bin/lua + + +local site = require 'gluon.site_config' +local uci = require 'luci.model.uci' + + +local c = uci.cursor() + + +function delete_legacy_iface(iface) + for _, wifi in pairs(site.legacy.wifi_names) do + if wifi == iface['.name'] then + return true + end + end + + return false +end + +c:delete_all('wireless', 'wifi-iface', delete_legacy_iface) + +c:save('wireless') +c:commit('wireless') diff --git a/package/gluon-legacy/generate/lib/gluon/upgrade/lock-password/legacy/010-lock-password b/package/gluon-legacy/files/lib/gluon/upgrade/lock-password/legacy/010-lock-password similarity index 100% rename from package/gluon-legacy/generate/lib/gluon/upgrade/lock-password/legacy/010-lock-password rename to package/gluon-legacy/files/lib/gluon/upgrade/lock-password/legacy/010-lock-password diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/mesh-batman-adv/legacy/010-mesh b/package/gluon-legacy/files/lib/gluon/upgrade/mesh-batman-adv/legacy/010-mesh new file mode 100755 index 00000000..45f27d94 --- /dev/null +++ b/package/gluon-legacy/files/lib/gluon/upgrade/mesh-batman-adv/legacy/010-mesh @@ -0,0 +1,22 @@ +#!/usr/bin/lua + + +local site = require 'gluon.site_config' +local uci = require 'luci.model.uci' + +local c = uci.cursor() + + +local s = c:get_all('network', site.legacy.mesh_ifname) +c:delete('network', site.legacy.mesh_ifname) + +s.auto = nil +s.accept_ra = nil +s.defaultroute = nil +s.proto = 'dhcpv6' +s.reqprefix = 'no' + +c:section('network', 'interface', 'client', s) + +c:save('network') +c:commit('network') diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/mesh-vpn-fastd/legacy/010-reset-fastd-config b/package/gluon-legacy/files/lib/gluon/upgrade/mesh-vpn-fastd/legacy/010-reset-fastd-config new file mode 100755 index 00000000..730feea0 --- /dev/null +++ b/package/gluon-legacy/files/lib/gluon/upgrade/mesh-vpn-fastd/legacy/010-reset-fastd-config @@ -0,0 +1,35 @@ +#!/usr/bin/lua + +local site = require 'gluon.site_config' +local uci = require 'luci.model.uci' + +local c = uci.cursor() + + +local secret +local enabled + + +for _, config in ipairs(site.legacy.fastd_configs) do + if not secret then + local s = c:get_all('fastd', config) + if s then + secret = s.secret + enabled = s.enabled + end + end + + c:delete('fastd', config) +end + +if secret then + c:section('fastd', 'fastd', 'mesh_vpn', + { + secret = secret, + enabled = enabled, + } + ) +end + +c:save('fastd') +c:commit('fastd') diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/simple-tc/legacy/010-migrate-tc b/package/gluon-legacy/files/lib/gluon/upgrade/simple-tc/legacy/010-migrate-tc new file mode 100755 index 00000000..39dd5f5d --- /dev/null +++ b/package/gluon-legacy/files/lib/gluon/upgrade/simple-tc/legacy/010-migrate-tc @@ -0,0 +1,27 @@ +#!/usr/bin/lua + +local site = require 'gluon.site_config' +local uci = require 'luci.model.uci' + +local c = uci.cursor() + + +for _, config in ipairs(site.legacy.tc_configs) do + local s = c:get_first(config, 'bandwidth') + if s then + old = c:get_all(config, s) + c:section('gluon-simple-tc', 'interface', 'mesh_vpn', + { + ifname = 'mesh-vpn', + enabled = old.enabled, + limit_ingress = old.downstream, + limit_egress = old.upstream, + } + ) + + c:save('gluon-simple-tc') + c:commit('gluon-simple-tc') + + break + end +end diff --git a/package/gluon-legacy/generate/lib/gluon/legacy/legacy-upgrade b/package/gluon-legacy/generate/lib/gluon/legacy/legacy-upgrade deleted file mode 100755 index 9f8ec1fb..00000000 --- a/package/gluon-legacy/generate/lib/gluon/legacy/legacy-upgrade +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -RET=1 - -for file in @legacy.version_files@; do - if [ -e "$file" ]; then - rm "$file" - RET=0 - fi -done - -exit $RET diff --git a/package/gluon-legacy/generate/lib/gluon/legacy/legacy-upgrade-late b/package/gluon-legacy/generate/lib/gluon/legacy/legacy-upgrade-late deleted file mode 100755 index 54419cb4..00000000 --- a/package/gluon-legacy/generate/lib/gluon/legacy/legacy-upgrade-late +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -rm -f @legacy.old_files@ diff --git a/package/gluon-legacy/generate/lib/gluon/upgrade/config-mode/legacy/010-migrate-configured b/package/gluon-legacy/generate/lib/gluon/upgrade/config-mode/legacy/010-migrate-configured deleted file mode 100755 index 23c81fe0..00000000 --- a/package/gluon-legacy/generate/lib/gluon/upgrade/config-mode/legacy/010-migrate-configured +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - - -. /lib/functions.sh - - -for config in @legacy.config_mode_configs@; do - if [ "$(uci -q get "$config".configured)" = '1' ]; then - uci_set gluon-config-mode '@wizard[0]' 'configured' '1' - uci_commit gluon-config-mode - - break - fi -done diff --git a/package/gluon-legacy/generate/lib/gluon/upgrade/core/legacy/020-wireless b/package/gluon-legacy/generate/lib/gluon/upgrade/core/legacy/020-wireless deleted file mode 100755 index 8fe97308..00000000 --- a/package/gluon-legacy/generate/lib/gluon/upgrade/core/legacy/020-wireless +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -. /lib/functions.sh - -config_load wireless - -delete_legacy_iface() { - local iface="$1" - - for wifi in @legacy.wifi_names@; do - if [ "$wifi" = "$iface" ]; then - uci_remove wireless "$iface" - break - fi - done -} - -config_foreach delete_legacy_iface 'wifi-iface' -uci_commit wireless diff --git a/package/gluon-legacy/generate/lib/gluon/upgrade/mesh-batman-adv/legacy/010-mesh b/package/gluon-legacy/generate/lib/gluon/upgrade/mesh-batman-adv/legacy/010-mesh deleted file mode 100755 index 7a6995d5..00000000 --- a/package/gluon-legacy/generate/lib/gluon/upgrade/mesh-batman-adv/legacy/010-mesh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - - -. /lib/functions.sh -. /lib/gluon/functions/sysconfig.sh - - -uci_rename network '@legacy.mesh_ifname@' 'client' - -uci_remove network client auto -uci_remove network client accept_ra -uci_remove network client defaultroute - -uci_set network client proto 'dhcpv6' -uci_set network client reqprefix 'no' - -uci_commit network diff --git a/package/gluon-legacy/generate/lib/gluon/upgrade/mesh-vpn-fastd/legacy/010-reset-fastd-config b/package/gluon-legacy/generate/lib/gluon/upgrade/mesh-vpn-fastd/legacy/010-reset-fastd-config deleted file mode 100755 index 01818ec7..00000000 --- a/package/gluon-legacy/generate/lib/gluon/upgrade/mesh-vpn-fastd/legacy/010-reset-fastd-config +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -. /lib/functions.sh - - -SECRET= -ENABLED= - - -for config in @legacy.fastd_configs@; do - if [ -z "$SECRET" ]; then - SECRET="$(uci_get fastd "$config" secret)" - ENABLED="$(uci_get fastd "$config" enabled)" - fi - - uci_remove fastd "$config" -done - -if [ -n "$SECRET" ]; then - uci_add fastd fastd 'mesh_vpn' - uci_set fastd 'mesh_vpn' 'secret' "$SECRET" - - if [ "$ENABLED" = 1 ]; then - uci_set fastd 'mesh_vpn' 'enabled' '1' - fi -fi - -uci_commit fastd diff --git a/package/gluon-legacy/generate/lib/gluon/upgrade/simple-tc/legacy/010-migrate-tc b/package/gluon-legacy/generate/lib/gluon/upgrade/simple-tc/legacy/010-migrate-tc deleted file mode 100755 index d75060e7..00000000 --- a/package/gluon-legacy/generate/lib/gluon/upgrade/simple-tc/legacy/010-migrate-tc +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -. /lib/functions.sh - - -for config in @legacy.tc_configs@; do - if uci -q get "$config" >/dev/null; then - uci_add gluon-simple-tc interface 'mesh_vpn' - uci_set gluon-simple-tc 'mesh_vpn' ifname 'mesh-vpn' - - uci_set gluon-simple-tc 'mesh_vpn' enabled "$(uci get "$config".enabled)" - uci_set gluon-simple-tc 'mesh_vpn' limit_ingress "$(uci get "$config".downstream)" - uci_set gluon-simple-tc 'mesh_vpn' limit_egress "$(uci get "$config".upstream)" - - uci_commit gluon-simple-tc - - break - fi -done From ee307ec1de116035b04c0e0e876334faa7640246 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 14 May 2014 17:24:57 +0200 Subject: [PATCH 259/453] gluon-core: make Lua files proper modules --- .../files/usr/lib/lua/gluon/site_config.lua | 14 +++++++++++++- .../files/usr/lib/lua/gluon/sysconfig.lua | 18 +++++++++++------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/package/gluon-core/files/usr/lib/lua/gluon/site_config.lua b/package/gluon-core/files/usr/lib/lua/gluon/site_config.lua index 0735cd01..cf151483 100644 --- a/package/gluon-core/files/usr/lib/lua/gluon/site_config.lua +++ b/package/gluon-core/files/usr/lib/lua/gluon/site_config.lua @@ -6,4 +6,16 @@ local function loader() end -- setfenv doesn't work with Lua 5.2 anymore, but we're using 5.1 -return setfenv(assert(load(coroutine.wrap(loader), 'site.conf')), {})() +local site_config = setfenv(assert(load(coroutine.wrap(loader), 'site.conf')), {})() + +local setmetatable = setmetatable + +module 'gluon.site_config' + +setmetatable(_M, + { + __index = site_config, + } +) + +return _M diff --git a/package/gluon-core/files/usr/lib/lua/gluon/sysconfig.lua b/package/gluon-core/files/usr/lib/lua/gluon/sysconfig.lua index 70882491..35c5062c 100644 --- a/package/gluon-core/files/usr/lib/lua/gluon/sysconfig.lua +++ b/package/gluon-core/files/usr/lib/lua/gluon/sysconfig.lua @@ -17,11 +17,15 @@ local function set(_, name, val) f:close() end -local sysconfig = {} -local mt = { - __index = get, - __newindex = set, -} +local setmetatable = setmetatable -setmetatable(sysconfig, mt) -return sysconfig +module 'gluon.sysconfig' + +setmetatable(_M, + { + __index = get, + __newindex = set, + } +) + +return _M From 156813b34f9484c9ed22e9cfcffb381b944fd05f Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 14 May 2014 18:51:32 +0200 Subject: [PATCH 260/453] gluon-simple-tc: replace config script generator with Lua script --- package/gluon-simple-tc/Makefile | 7 +------ .../simple-tc/invariant/010-site-defaults | 16 ++++++++++++++++ package/gluon-simple-tc/invariant.pl | 18 ------------------ 3 files changed, 17 insertions(+), 24 deletions(-) create mode 100755 package/gluon-simple-tc/files/lib/gluon/upgrade/simple-tc/invariant/010-site-defaults delete mode 100644 package/gluon-simple-tc/invariant.pl diff --git a/package/gluon-simple-tc/Makefile b/package/gluon-simple-tc/Makefile index 1c8ae9b1..1c9fd147 100644 --- a/package/gluon-simple-tc/Makefile +++ b/package/gluon-simple-tc/Makefile @@ -1,8 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-simple-tc -PKG_VERSION:=1 -PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) +PKG_VERSION:=2 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) @@ -31,10 +30,6 @@ endef define Package/gluon-simple-tc/install $(CP) ./files/* $(1)/ - - $(INSTALL_DIR) $(1)/lib/gluon/upgrade/simple-tc/invariant - $(GLUON_CONFIGURE) invariant.pl > $(1)/lib/gluon/upgrade/simple-tc/invariant/010-site-defaults - chmod +x $(1)/lib/gluon/upgrade/simple-tc/invariant/010-site-defaults endef $(eval $(call BuildPackage,gluon-simple-tc)) diff --git a/package/gluon-simple-tc/files/lib/gluon/upgrade/simple-tc/invariant/010-site-defaults b/package/gluon-simple-tc/files/lib/gluon/upgrade/simple-tc/invariant/010-site-defaults new file mode 100755 index 00000000..d99a51ba --- /dev/null +++ b/package/gluon-simple-tc/files/lib/gluon/upgrade/simple-tc/invariant/010-site-defaults @@ -0,0 +1,16 @@ +#!/usr/bin/lua + +local site = require 'gluon.site_config' +local uci = require 'luci.model.uci' + +local c = uci.cursor() + + +for name, config in pairs(site.simple_tc) do + if not c:get('gluon-simple-tc', name) then + c:section('gluon-simple-tc', 'interface', name, config) + end +end + +c:save('gluon-simple-tc') +c:commit('gluon-simple-tc') diff --git a/package/gluon-simple-tc/invariant.pl b/package/gluon-simple-tc/invariant.pl deleted file mode 100644 index 6b91a951..00000000 --- a/package/gluon-simple-tc/invariant.pl +++ /dev/null @@ -1,18 +0,0 @@ -my $cfg = $CONFIG->{simple_tc}; - -print "#/bin/sh\n\n"; - -foreach my $name (sort keys %{$cfg}) { - my $interface = $cfg->{$name}; - - print "uci -q get gluon-simple-tc.$name >/dev/null || uci -q batch <{$_}\n"; - } - - print "EOF\n\n"; -} - -print "uci commit gluon-simple-tc\n"; From 4d9df6d253c14e52204778e0a6c4993d84800d23 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 14 May 2014 20:05:13 +0200 Subject: [PATCH 261/453] gluon-mesh-vpn-fastd: replace config script generator with Lua script --- package/gluon-mesh-vpn-fastd/Makefile | 7 +- package/gluon-mesh-vpn-fastd/fastd.pl | 77 ------------------- .../invariant/010-mesh-vpn-fastd | 68 ++++++++++++++++ 3 files changed, 69 insertions(+), 83 deletions(-) delete mode 100644 package/gluon-mesh-vpn-fastd/fastd.pl create mode 100755 package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd diff --git a/package/gluon-mesh-vpn-fastd/Makefile b/package/gluon-mesh-vpn-fastd/Makefile index 27342ded..3531b3b1 100644 --- a/package/gluon-mesh-vpn-fastd/Makefile +++ b/package/gluon-mesh-vpn-fastd/Makefile @@ -1,8 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-mesh-vpn-fastd -PKG_VERSION:=1 -PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) +PKG_VERSION:=2 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) @@ -31,10 +30,6 @@ endef define Package/gluon-mesh-vpn-fastd/install $(CP) ./files/* $(1)/ - - $(INSTALL_DIR) $(1)/lib/gluon/upgrade/mesh-vpn-fastd/invariant - $(GLUON_CONFIGURE) fastd.pl > $(1)/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd - chmod +x $(1)/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd endef $(eval $(call BuildPackage,gluon-mesh-vpn-fastd)) diff --git a/package/gluon-mesh-vpn-fastd/fastd.pl b/package/gluon-mesh-vpn-fastd/fastd.pl deleted file mode 100644 index cc79f0a7..00000000 --- a/package/gluon-mesh-vpn-fastd/fastd.pl +++ /dev/null @@ -1,77 +0,0 @@ -my $cfg = $CONFIG->{fastd_mesh_vpn}; -my $backbone = $cfg->{backbone}; - -my $add_methods = ''; -for (@{$cfg->{methods}}) { - $add_methods .= "uci add_list fastd.mesh_vpn.method='$_'\n"; -} - -my $set_peer_limit; -if ($backbone->{limit}) { - $set_peer_limit = "uci_set fastd mesh_vpn_backbone peer_limit '$backbone->{limit}'\n"; -} -else { - $set_peer_limit = "uci_remove fastd mesh_vpn_backbone peer_limit\n"; -} - -print <{mtu}' -uci_set fastd mesh_vpn secure_handshakes '1' - -uci_remove fastd mesh_vpn method -$add_methods - -uci_remove fastd mesh_vpn_backbone -uci_add fastd peer_group mesh_vpn_backbone -uci_set fastd mesh_vpn_backbone enabled '1' -uci_set fastd mesh_vpn_backbone net 'mesh_vpn' -$set_peer_limit -END - -foreach my $name (sort keys %{$backbone->{peers}}) { - my $peer = $backbone->{peers}->{$name}; - print <{key}' -EOF - - for (@{$peer->{remotes}}) { - print "uci add_list fastd.mesh_vpn_backbone_peer_$name.remote='$_'\n"; - } -} - -print <<'END'; - -uci_add network interface mesh_vpn -uci_set network mesh_vpn ifname 'mesh-vpn' -uci_set network mesh_vpn proto 'batadv' -uci_set network mesh_vpn mesh 'bat0' -uci_set network mesh_vpn mesh_no_rebroadcast '1' - -mainaddr=$(sysconfig primary_mac) -oIFS="$IFS"; IFS=":"; set -- $mainaddr; IFS="$oIFS" -b2mask=0x02 -vpnaddr=$(printf "%02x:%s:%s:%02x:%s:%s" $(( 0x$1 | $b2mask )) $2 $3 $(( (0x$4 + 1) % 0x100 )) $5 $6) -uci_set network mesh_vpn macaddr "$vpnaddr" - -uci_commit fastd -uci_commit network -END diff --git a/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd new file mode 100755 index 00000000..1d6d5811 --- /dev/null +++ b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd @@ -0,0 +1,68 @@ +#!/usr/bin/lua + +local site = require 'gluon.site_config' +local sysconfig = require 'gluon.sysconfig' +local nixio = require 'nixio' +local uci = require 'luci.model.uci' + +local c = uci.cursor() + + +os.execute('. /lib/gluon/functions/users.sh && add_user gluon-fastd 800') + + +c:section('fastd', 'fastd', 'mesh_vpn', + { + user = 'gluon-fastd', + syslog_level = 'verbose', + interface = 'mesh-vpn', + mode = 'tap', + mtu = site.fastd_mesh_vpn.mtu, + secure_handshakes = '1', + method = site.fastd_mesh_vpn.methods, + } +) + +c:delete('fastd', 'mesh_vpn_backbone') +c:section('fastd', 'peer_group', 'mesh_vpn_backbone', + { + enabled = 1, + net = 'mesh_vpn', + peer_limit = site.fastd_mesh_vpn.backbone.limit, + } +) + +for name, config in pairs(site.fastd_mesh_vpn.backbone.peers) do + c:delete('fastd', 'mesh_vpn_backbone_peer_' .. name) + c:section('fastd', 'peer', 'mesh_vpn_backbone_peer_' .. name, + { + enabled = 1, + net = 'mesh_vpn', + group = 'mesh_vpn_backbone', + key = config.key, + remote = config.remotes, + } + ) +end + +c:save('fastd') +c:commit('fastd') + + +local m1, m2, m3, m4, m5, m6 = string.match(sysconfig.primary_mac, '(%x%x):(%x%x):(%x%x):(%x%x):(%x%x):(%x%x)') +m1 = nixio.bit.bor(tonumber(m1, 16), 0x02) +m4 = (tonumber(m4, 16)+1) % 0x100 +local vpnaddr = string.format('%02x:%s:%s:%02x:%s:%s', m1, m2, m3, m4, m5, m6) + +c:section('network', 'interface', 'mesh_vpn', + { + ifname = 'mesh-vpn', + proto = 'batadv', + mesh = 'bat0', + mesh_no_rebroadcast = 1, + macaddr = vpnaddr, + } +) + +c:save('network') +c:commit('network') From a3ed0dde1fe936fdcccb67e26b7027b39fb81de9 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 14 May 2014 20:46:31 +0200 Subject: [PATCH 262/453] gluon-autoupdater: replace config script generator with Lua script --- package/gluon-autoupdater/Makefile | 11 +++-- .../autoupdater/invariant/010-autoupdater | 42 +++++++++++++++++ package/gluon-autoupdater/invariant.pl | 46 ------------------- 3 files changed, 48 insertions(+), 51 deletions(-) create mode 100755 package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/invariant/010-autoupdater delete mode 100644 package/gluon-autoupdater/invariant.pl diff --git a/package/gluon-autoupdater/Makefile b/package/gluon-autoupdater/Makefile index ee977d67..a93f83f5 100644 --- a/package/gluon-autoupdater/Makefile +++ b/package/gluon-autoupdater/Makefile @@ -1,8 +1,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-autoupdater -PKG_VERSION:=0.1 -PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION)$(if $(GLUON_BRANCH),.$(GLUON_BRANCH)) +PKG_VERSION:=2 +PKG_RELEASE:=$(GLUON_BRANCH) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) @@ -28,9 +28,10 @@ endef define Package/gluon-autoupdater/install $(CP) ./files/* $(1)/ - $(INSTALL_DIR) $(1)/lib/gluon/upgrade/autoupdater/invariant - GLUON_BRANCH='$(GLUON_BRANCH)' $(GLUON_CONFIGURE) invariant.pl > $(1)/lib/gluon/upgrade/autoupdater/invariant/010-autoupdater - chmod +x $(1)/lib/gluon/upgrade/autoupdater/invariant/010-autoupdater + if [ '$(GLUON_BRANCH)' ]; then \ + $(INSTALL_DIR) $(1)/lib/gluon/autoupdater; \ + echo '$(GLUON_BRANCH)' > $(1)/lib/gluon/autoupdater/default_branch; \ + fi endef $(eval $(call BuildPackage,gluon-autoupdater)) diff --git a/package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/invariant/010-autoupdater b/package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/invariant/010-autoupdater new file mode 100755 index 00000000..29cef882 --- /dev/null +++ b/package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/invariant/010-autoupdater @@ -0,0 +1,42 @@ +#!/usr/bin/lua + +local site = require 'gluon.site_config' +local uci = require 'luci.model.uci' + +local c = uci.cursor() + + +for name, config in pairs(site.autoupdater.branches) do + c:delete('autoupdater', name) + c:section('autoupdater', 'branch', name, + { + name = config.name, + mirror = config.mirrors, + probability = config.probability, + good_signatures = config.good_signatures, + pubkey = config.pubkeys, + } + ) +end + +if not c:get('autoupdater', 'settings') then + local enabled = 0 + local branch = site.autoupdater.branch + + local f = io.open('/lib/gluon/autoupdater/default_branch') + if f then + enabled = 1 + branch = f:read('*line') + f:close() + end + + c:section('autoupdater', 'autoupdater', 'settings', + { + enabled = enabled, + branch = branch, + } + ) +end + +c:save('autoupdater') +c:commit('autoupdater') diff --git a/package/gluon-autoupdater/invariant.pl b/package/gluon-autoupdater/invariant.pl deleted file mode 100644 index 7c5a0a5c..00000000 --- a/package/gluon-autoupdater/invariant.pl +++ /dev/null @@ -1,46 +0,0 @@ -my $cfg = $CONFIG->{autoupdater}; - -my $branch = $ENV{GLUON_BRANCH} || $cfg->{branch}; -my $enabled = $ENV{GLUON_BRANCH} ? 1 : 0; - -print <{branches}) { - my $branch = $cfg->{branches}->{$name}; - - print <{$_}\n"; - } - - for (@{$branch->{mirrors}}) { - print "add_list autoupdater.$name.mirror=$_\n"; - } - - for (@{$branch->{pubkeys}}) { - print "add_list autoupdater.$name.pubkey=$_\n"; - } -} - -print < Date: Fri, 16 May 2014 12:36:01 +0200 Subject: [PATCH 263/453] gluon-config-mode: allow using templates for texts again --- .../usr/lib/lua/luci/controller/gluon-config-mode/index.lua | 2 +- .../usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm | 4 +++- .../usr/lib/lua/luci/view/gluon-config-mode/reboot.htm | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua index 8803dde6..731ed73b 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua @@ -64,7 +64,7 @@ function action_reboot() if nixio.fork() ~= 0 then luci.template.render("gluon-config-mode/reboot", - {pubkey=pubkey, hostname=hostname, site=site}) + {luci=luci, pubkey=pubkey, hostname=hostname, site=site}) else debug.setfenv(io.stdout, debug.getfenv(io.open '/dev/null')) io.stdout:close() diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm b/package/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm index db5fe8b0..cadfb006 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm @@ -1,10 +1,12 @@ <%- local site = require 'gluon.site_config' + local sysconfig = require 'gluon.sysconfig' + local template = require 'luci.template' -%>

Willkommen!

- <%= site.config_mode.msg_welcome %> + <%= template.render_string(site.config_mode.msg_welcome, {hostname=hostname, sysconfig=sysconfig}) %>

<% if not self.embedded then %> diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm b/package/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm index 238da275..db9cbc23 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm @@ -13,17 +13,17 @@ <% if pubkey then %>

- <%= site.config_mode.msg_pubkey %> + <%= luci.template.render_string(site.config_mode.msg_pubkey) %>

- # Hostname: <%= hostname %> + # <%= hostname %>
<%= pubkey %>
<% end %>
- <%= site.config_mode.msg_reboot %> + <%= luci.template.render_string(site.config_mode.msg_reboot) %>
From acd60a22b195f5bb11308bf1449155259d0d5a4a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 19 May 2014 00:09:14 +0200 Subject: [PATCH 264/453] gluon-config: add /lib/gluon/release /lib/gluon/release had been lost during the conversion to the new site config format. --- package/gluon-config/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/gluon-config/Makefile b/package/gluon-config/Makefile index ccaf57c3..988fb867 100644 --- a/package/gluon-config/Makefile +++ b/package/gluon-config/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-config PKG_VERSION:=$(GLUON_SITE_CODE) -PKG_RELEASE:=$(shell $(MD5SUM) $(GLUON_SITEDIR)/site.conf) +PKG_RELEASE:=$(GLUON_RELEASE).$(shell $(MD5SUM) $(GLUON_SITEDIR)/site.conf) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) @@ -31,6 +31,7 @@ endef define Package/gluon-config/install $(INSTALL_DIR) $(1)/lib/gluon $(CP) $(GLUON_SITEDIR)/site.conf $(1)/lib/gluon/site.conf + echo "$(GLUON_RELEASE)" > $(1)/lib/gluon/release endef $(eval $(call BuildPackage,gluon-config)) From aba0a3bc0cc1626bf66df4ff2c3255d1fba7babc Mon Sep 17 00:00:00 2001 From: Daniel Ehlers Date: Tue, 6 May 2014 21:24:04 +0200 Subject: [PATCH 265/453] gluon-mesh-batman-adv: Do not ACCEPT incoming packets. For security reasons we should not accept incoming packets per default and instead allow specific services on specific interfaces. --- .../lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh index d48bb684..6bbf63f6 100755 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh @@ -29,13 +29,6 @@ uci_set firewall client input 'ACCEPT' uci_set firewall client output 'ACCEPT' uci_set firewall client forward 'REJECT' -config_load firewall -accept_input_on_wan() { - config_get name "$1" name - [ "$name" = 'wan' ] && uci_set firewall "$1" input 'ACCEPT' -} -config_foreach accept_input_on_wan 'zone' - uci_commit firewall uci_set dhcp '@dnsmasq[0]' boguspriv '0' From 68149f25fd68f96386bc74562e1efb64cf5a1e24 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 6 Jun 2014 12:59:32 +0200 Subject: [PATCH 266/453] Add gluon-firewall package to mitigate open resolver issue Original patch by Daniel Ehlers --- package/gluon-firewall/Makefile | 37 +++++++++++++++++++ .../firewall/invariant/011-wan-firewall | 29 +++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 package/gluon-firewall/Makefile create mode 100755 package/gluon-firewall/files/lib/gluon/upgrade/firewall/invariant/011-wan-firewall diff --git a/package/gluon-firewall/Makefile b/package/gluon-firewall/Makefile new file mode 100644 index 00000000..ceb4820c --- /dev/null +++ b/package/gluon-firewall/Makefile @@ -0,0 +1,37 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-firewall +PKG_VERSION:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-firewall + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Restrictive firewall rules + DEPENDS:=+gluon-core +firewall +endef + +define Package/gluon-firewall/description + Gluon community wifi mesh firmware framework: + Firewall rules which try to ensure a node can't be abused + (e.g. for DNS amplification attacks) +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-firewall/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-firewall)) diff --git a/package/gluon-firewall/files/lib/gluon/upgrade/firewall/invariant/011-wan-firewall b/package/gluon-firewall/files/lib/gluon/upgrade/firewall/invariant/011-wan-firewall new file mode 100755 index 00000000..b63f5193 --- /dev/null +++ b/package/gluon-firewall/files/lib/gluon/upgrade/firewall/invariant/011-wan-firewall @@ -0,0 +1,29 @@ +#!/usr/bin/lua + +local site = require 'gluon.site_config' +local uci = require 'luci.model.uci' + +local c = uci.cursor() + + +local function reject_input_on_wan(zone) + if zone.name == 'wan' then + c:set('firewall', zone['.name'], 'input', 'REJECT') + end + + return true +end +c:foreach('firewall', 'zone', reject_input_on_wan) + +c:section('firewall', 'rule', 'wan_ssh', + { + name = 'wan_ssh', + src = 'wan', + dest_port = '22', + proto = 'tcp', + target = 'ACCEPT', + } +) + +c:save('firewall') +c:commit('firewall') From b89a0162ebe85699a0e1060f8ac94338d4402315 Mon Sep 17 00:00:00 2001 From: ohrensessel Date: Sat, 7 Jun 2014 13:43:31 +0200 Subject: [PATCH 267/453] Allow sysconfig variable to be used on reboot page --- .../usr/lib/lua/luci/controller/gluon-config-mode/index.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua index 731ed73b..d8b21b88 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua @@ -52,6 +52,7 @@ function action_reboot() local pubkey local uci = luci.model.uci.cursor() local meshvpn_enabled = uci:get("fastd", meshvpn_name, "enabled", "0") + local sysconfig = require 'gluon.sysconfig' if meshvpn_enabled == "1" then pubkey = configmode.get_fastd_pubkey(meshvpn_name) end @@ -64,7 +65,7 @@ function action_reboot() if nixio.fork() ~= 0 then luci.template.render("gluon-config-mode/reboot", - {luci=luci, pubkey=pubkey, hostname=hostname, site=site}) + {luci=luci, pubkey=pubkey, hostname=hostname, site=site, sysconfig=sysconfig}) else debug.setfenv(io.stdout, debug.getfenv(io.open '/dev/null')) io.stdout:close() From e317bdc2308720506c87bde1dbf46a9e7d89b4de Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 9 Jun 2014 17:40:25 +0200 Subject: [PATCH 268/453] gluon-core: add gluon.model lua module --- .../files/usr/lib/lua/gluon/model.lua | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 package/gluon-core/files/usr/lib/lua/gluon/model.lua diff --git a/package/gluon-core/files/usr/lib/lua/gluon/model.lua b/package/gluon-core/files/usr/lib/lua/gluon/model.lua new file mode 100644 index 00000000..a09c0672 --- /dev/null +++ b/package/gluon-core/files/usr/lib/lua/gluon/model.lua @@ -0,0 +1,21 @@ +local util = require 'luci.util' + + +module 'gluon.model' + + +-- This must be generalized as soon as we support other OpenWrt archs +local board_name, model = util.exec('. /lib/functions.sh; . /lib/ar71xx.sh; ar71xx_board_detect; echo "$AR71XX_BOARD_NAME"; echo "$AR71XX_MODEL"'):match('([^\n]+)\n([^\n]+)') + + +function get_arch() + return 'ar71xx' +end + +function get_board_name() + return board_name +end + +function get_model() + return model +end From 48ea4b711f7666ac288ef5939451eb56d1b32698 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 9 Jun 2014 18:48:15 +0200 Subject: [PATCH 269/453] gluon-alfred: split announce.lua into several files and move parts into the appropriate packages This also fixes the type of a few fields which were strings instead of numbers. --- package/gluon-alfred/Makefile | 2 +- .../gluon/alfred/announce.d/hardware/model | 1 + .../lib/gluon/alfred/announce.d/hostname | 1 + .../lib/gluon/alfred/announce.d/network/mac | 1 + .../gluon/alfred/announce.d/software/firmware | 4 + .../alfred/announce.d/statistics/loadavg | 1 + .../gluon/alfred/announce.d/statistics/uptime | 1 + .../files/lib/gluon/alfred/announce.lua | 139 +++++------------- .../alfred/invariant/010-enable-alfred | 25 ++-- .../alfred/announce.d/software/autoupdater | 7 + .../gluon/alfred/announce.d/network/addresses | 8 + .../gluon/alfred/announce.d/network/gateway | 5 + .../alfred/announce.d/statistics/traffic | 17 +++ .../gluon/alfred/announce.d/software/fastd | 4 + .../lib/gluon/alfred/announce.d/location | 6 + .../files/lib/gluon/alfred/announce.d/owner | 4 + 16 files changed, 109 insertions(+), 117 deletions(-) create mode 100644 package/gluon-alfred/files/lib/gluon/alfred/announce.d/hardware/model create mode 100644 package/gluon-alfred/files/lib/gluon/alfred/announce.d/hostname create mode 100644 package/gluon-alfred/files/lib/gluon/alfred/announce.d/network/mac create mode 100644 package/gluon-alfred/files/lib/gluon/alfred/announce.d/software/firmware create mode 100644 package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/loadavg create mode 100644 package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/uptime create mode 100644 package/gluon-autoupdater/files/lib/gluon/alfred/announce.d/software/autoupdater create mode 100644 package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/network/addresses create mode 100644 package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/network/gateway create mode 100644 package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/statistics/traffic create mode 100644 package/gluon-mesh-vpn-fastd/files/lib/gluon/alfred/announce.d/software/fastd create mode 100644 package/gluon-node-info/files/lib/gluon/alfred/announce.d/location create mode 100644 package/gluon-node-info/files/lib/gluon/alfred/announce.d/owner diff --git a/package/gluon-alfred/Makefile b/package/gluon-alfred/Makefile index 53bf2640..394edbd4 100644 --- a/package/gluon-alfred/Makefile +++ b/package/gluon-alfred/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/package.mk define Package/gluon-alfred SECTION:=gluon CATEGORY:=Gluon - DEPENDS:=+gluon-core +gluon-node-info +gluon-cron +alfred +ethtool +luci-lib-json +luci-lib-core + DEPENDS:=+gluon-core +gluon-cron +alfred +ethtool +luci-lib-json +luci-lib-core TITLE:=Configure alfred endef diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/hardware/model b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/hardware/model new file mode 100644 index 00000000..242f72cc --- /dev/null +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/hardware/model @@ -0,0 +1 @@ +return require('gluon.model').get_model() diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/hostname b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/hostname new file mode 100644 index 00000000..7d4f0521 --- /dev/null +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/hostname @@ -0,0 +1 @@ +return uci:get_first('system', 'system', 'hostname') diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/network/mac b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/network/mac new file mode 100644 index 00000000..049eea58 --- /dev/null +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/network/mac @@ -0,0 +1 @@ +return require('gluon.sysconfig').primary_mac diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/software/firmware b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/software/firmware new file mode 100644 index 00000000..0a1ec310 --- /dev/null +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/software/firmware @@ -0,0 +1,4 @@ +return + { base = 'gluon-' .. util.trim(fs.readfile('/lib/gluon/gluon-version')) + , release = util.trim(fs.readfile('/lib/gluon/release')) + } diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/loadavg b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/loadavg new file mode 100644 index 00000000..dce5d440 --- /dev/null +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/loadavg @@ -0,0 +1 @@ +return tonumber(util.trim(util.exec("cut -d' ' -f1 /proc/loadavg"))) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/uptime b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/uptime new file mode 100644 index 00000000..2fd6e301 --- /dev/null +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/uptime @@ -0,0 +1 @@ +return tonumber(util.trim(util.exec("cut -d' ' -f1 /proc/uptime"))) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.lua b/package/gluon-alfred/files/lib/gluon/alfred/announce.lua index d0884261..e222949c 100755 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.lua +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.lua @@ -1,117 +1,44 @@ #!/usr/bin/lua -local json = require "luci.json" -local ltn12 = require "luci.ltn12" -local util = require "luci.util" +local alfred_data_type = 158 +local announce_dir = '/lib/gluon/alfred/announce.d' -require "luci.model.uci" -local uci = luci.model.uci.cursor() -local alfred_data_type = tonumber(os.getenv("ALFRED_DATA_TYPE")) or 158 -local net_if = os.getenv("NET_IF") or "br-client" +fs = require 'luci.fs' +uci = require('luci.model.uci').cursor() +util = require 'luci.util' -function readAll(file) - local f = io.open(file, "rb") - local content = f:read("*all") - f:close() - return content + +local json = require 'luci.json' +local ltn12 = require 'luci.ltn12' + + +local function collect_entry(entry) + if fs.isdirectory(entry) then + return collect_dir(entry) + else + return dofile(entry) + end end -function chomp(s) - return (s:gsub("^(.-)\n?$", "%1")) +function collect_dir(dir) + local ret = {} + + for _, entry in ipairs(fs.dir(dir)) do + if entry:sub(1, 1) ~= '.' then + err, val = pcall(collect_entry, dir .. '/' .. entry) + if err then + ret[entry] = val + else + io.stderr:write(val, '\n') + end + end + end + + return ret end -function trim(s) - return (s:gsub("^%s*(.-)%s*$", "%1")) -end -output = {} - -output["hostname"] = uci:get_first("system", "system", "hostname") - -if uci:get_first("gluon-node-info", "location", "share_location", false) then - output["location"] = - { latitude = tonumber(uci:get_first("gluon-node-info", "location", "latitude")) - , longitude = tonumber(uci:get_first("gluon-node-info", "location", "longitude")) - } -end - -local contact = uci:get_first("gluon-node-info", "owner", "contact", "") -if contact ~= "" then - output["owner"] = { contact = contact } -end - -output["software"] = - { firmware = { base = "gluon-" .. chomp(readAll("/lib/gluon/gluon-version")) - , release = chomp(readAll("/lib/gluon/release")) - } - } - -local autoupdater = uci:get_all("autoupdater", "settings") -if autoupdater then - output["software"]["autoupdater"] = - { branch = autoupdater["branch"] - , enabled = uci:get_bool("autoupdater", "settings", "enabled") - } -end - -local fastd = uci:get_all("fastd", "mesh_vpn") -if fastd then - output["software"]["fastd"] = - { enabled = uci:get_bool("fastd", "mesh_vpn", "enabled") - , version = chomp(util.exec("fastd -v | cut -d' ' -f2")) - } -end - -output["hardware"] = - { model = chomp(util.exec(". /lib/gluon/functions/model.sh; get_model")) } - - -local addresses = {} -local tmp = util.exec("ip -o -6 addr show dev \"" .. net_if .. "\" | " - .. "grep -oE 'inet6 [0-9a-fA-F:]+' | cut -d' ' -f2") - -for address in tmp:gmatch("[^\n]+") do - table.insert(addresses, address) -end - -output["network"] = - { mac = chomp(util.exec(". /lib/gluon/functions/sysconfig.sh; sysconfig primary_mac")) - , addresses = addresses - } - -local gateway = - chomp(util.exec("batctl -m bat0 gateways | awk '/^=>/ { print $2 }'")) - -if gateway ~= "" then - output["network"]["gateway"] = gateway -end - -local traffic = {} -local ethtool = util.exec("ethtool -S bat0") -for k, v in ethtool:gmatch("([%a_]+): ([0-9]+)") do - traffic[k] = v -end - -for _,class in ipairs({"rx", "tx", "forward", "mgmt_rx", "mgmt_tx"}) do - traffic[class] = - { bytes = traffic[class .. "_bytes"] - , packets = traffic[class] - } - - if class == "tx" then - traffic[class]["dropped"] = traffic[class .. "_dropped"] - end -end - -output["statistics"] = - { uptime = chomp(util.exec("cut -d' ' -f1 /proc/uptime")) - , loadavg = chomp(util.exec("cut -d' ' -f1 /proc/loadavg")) - , traffic = traffic - } - -encoder = json.Encoder(output) -alfred = io.popen("alfred -s " .. tostring(alfred_data_type), "w") +encoder = json.Encoder(collect_dir(announce_dir)) +alfred = io.popen('alfred -s ' .. tostring(alfred_data_type), 'w') ltn12.pump.all(encoder:source(), ltn12.sink.file(alfred)) - - diff --git a/package/gluon-alfred/files/lib/gluon/upgrade/alfred/invariant/010-enable-alfred b/package/gluon-alfred/files/lib/gluon/upgrade/alfred/invariant/010-enable-alfred index fb75e8e1..8c52d8a6 100755 --- a/package/gluon-alfred/files/lib/gluon/upgrade/alfred/invariant/010-enable-alfred +++ b/package/gluon-alfred/files/lib/gluon/upgrade/alfred/invariant/010-enable-alfred @@ -1,14 +1,19 @@ -#!/bin/sh +#!/usr/bin/lua -. /lib/functions.sh +local uci = require 'luci.model.uci' +local c = uci.cursor() -uci_remove alfred alfred -uci_add alfred alfred alfred -uci_set alfred alfred interface 'br-client' -uci_set alfred alfred mode 'slave' -uci_set alfred alfred batmanif 'bat0' -uci_set alfred alfred start_vis '1' -uci_set alfred alfred run_facters '0' +c:delete('alfred', 'alfred') +c:section('alfred', 'alfred', 'alfred', + { + interface = 'br-client', + mode = 'slave', + batmanif = 'bat0', + start_vis = '1', + run_facters = '0', + } +) -uci_commit alfred +c:save('alfred') +c:commit('alfred') diff --git a/package/gluon-autoupdater/files/lib/gluon/alfred/announce.d/software/autoupdater b/package/gluon-autoupdater/files/lib/gluon/alfred/announce.d/software/autoupdater new file mode 100644 index 00000000..7745d1a2 --- /dev/null +++ b/package/gluon-autoupdater/files/lib/gluon/alfred/announce.d/software/autoupdater @@ -0,0 +1,7 @@ +local autoupdater = uci:get_all('autoupdater', 'settings') +if autoupdater then + return + { branch = autoupdater['branch'] + , enabled = uci:get_bool('autoupdater', 'settings', 'enabled') + } +end diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/network/addresses b/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/network/addresses new file mode 100644 index 00000000..6df96876 --- /dev/null +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/network/addresses @@ -0,0 +1,8 @@ +local ip = util.exec('ip -o -6 addr show dev br-client') + +local addresses = {} +for _, line in ipairs(util.split(ip)) do + table.insert(addresses, line:match('inet6 ([%x:]+)/')) +end + +return addresses diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/network/gateway b/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/network/gateway new file mode 100644 index 00000000..a1be9ac0 --- /dev/null +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/network/gateway @@ -0,0 +1,5 @@ +local gateway = util.trim(util.exec("batctl -m bat0 gateways | awk '/^=>/ { print $2 }'")) + +if gateway ~= '' then + return gateway +end diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/statistics/traffic b/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/statistics/traffic new file mode 100644 index 00000000..7667e4f5 --- /dev/null +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/statistics/traffic @@ -0,0 +1,17 @@ +local ethtool = util.exec('ethtool -S bat0') + +local fields = {} +for k, v in ethtool:gmatch('([%a_]+): ([0-9]+)') do + fields[k] = tonumber(v) +end + +local traffic = {} +for _, class in ipairs({'rx', 'tx', 'forward', 'mgmt_rx', 'mgmt_tx'}) do + traffic[class] = + { bytes = fields[class .. '_bytes'] + , packets = fields[class] + } +end +traffic['tx']['dropped'] = fields['tx_dropped'] + +return traffic diff --git a/package/gluon-mesh-vpn-fastd/files/lib/gluon/alfred/announce.d/software/fastd b/package/gluon-mesh-vpn-fastd/files/lib/gluon/alfred/announce.d/software/fastd new file mode 100644 index 00000000..6abbbbc7 --- /dev/null +++ b/package/gluon-mesh-vpn-fastd/files/lib/gluon/alfred/announce.d/software/fastd @@ -0,0 +1,4 @@ +return + { enabled = uci:get_bool('fastd', 'mesh_vpn', 'enabled') + , version = util.trim(util.exec("fastd -v | cut -d' ' -f2")) + } diff --git a/package/gluon-node-info/files/lib/gluon/alfred/announce.d/location b/package/gluon-node-info/files/lib/gluon/alfred/announce.d/location new file mode 100644 index 00000000..3060210c --- /dev/null +++ b/package/gluon-node-info/files/lib/gluon/alfred/announce.d/location @@ -0,0 +1,6 @@ +if uci:get_first('gluon-node-info', 'location', 'share_location', false) then + return + { latitude = tonumber(uci:get_first('gluon-node-info', 'location', 'latitude')) + , longitude = tonumber(uci:get_first('gluon-node-info', 'location', 'longitude')) + } +end diff --git a/package/gluon-node-info/files/lib/gluon/alfred/announce.d/owner b/package/gluon-node-info/files/lib/gluon/alfred/announce.d/owner new file mode 100644 index 00000000..8a2a611d --- /dev/null +++ b/package/gluon-node-info/files/lib/gluon/alfred/announce.d/owner @@ -0,0 +1,4 @@ +local contact = uci:get_first('gluon-node-info', 'owner', 'contact', '') +if contact ~= '' then + return { contact = contact } +end From 7a3e8d163283e63b0a51f8b057cc8c9419d21d79 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 9 Jun 2014 19:29:13 +0200 Subject: [PATCH 270/453] gluon-mesh-batman-adv: add batman-adv version information to alfred --- .../files/lib/gluon/alfred/announce.d/software/batman-adv | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/software/batman-adv diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/software/batman-adv b/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/software/batman-adv new file mode 100644 index 00000000..4af75985 --- /dev/null +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/software/batman-adv @@ -0,0 +1,3 @@ +local version = util.exec('batctl -v'):match('%[batman%-adv: ([^%]]+)%]') + +return { version = version } From ea7774c0b63f7919b39d4c99e4ffd2f88cfcb3c4 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 9 Jun 2014 19:37:49 +0200 Subject: [PATCH 271/453] gluon-alfred: add fields idletime, memory and processes to statistics --- .../lib/gluon/alfred/announce.d/statistics/idletime | 1 + .../lib/gluon/alfred/announce.d/statistics/memory | 13 +++++++++++++ .../gluon/alfred/announce.d/statistics/processes | 3 +++ 3 files changed, 17 insertions(+) create mode 100644 package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/idletime create mode 100644 package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/memory create mode 100644 package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/processes diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/idletime b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/idletime new file mode 100644 index 00000000..93165f05 --- /dev/null +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/idletime @@ -0,0 +1 @@ +return tonumber(util.trim(util.exec("cut -d' ' -f2 /proc/uptime"))) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/memory b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/memory new file mode 100644 index 00000000..7b07a107 --- /dev/null +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/memory @@ -0,0 +1,13 @@ +local data = fs.readfile('/proc/meminfo') + +local fields = {} +for k, v in data:gmatch('([^\n:]+):%s*(%d+) kB') do + fields[k] = tonumber(v) +end + +return { + total = fields.MemTotal, + free = fields.MemFree, + buffers = fields.Buffers, + cached = fields.Cached, +} diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/processes b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/processes new file mode 100644 index 00000000..33ecff66 --- /dev/null +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/processes @@ -0,0 +1,3 @@ +local running, total = fs.readfile('/proc/loadavg'):match('^[^ ]+ [^ ]+ [^ ]+ (%d+)/(%d+)') + +return { running = tonumber(running), total = tonumber(total) } From bc54f80dfd7c25235b654eedae0a60e73b58fe54 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 10 Jun 2014 15:44:35 +0200 Subject: [PATCH 272/453] gluon-alfred: reduce usage of util.exec, improve table formatting --- .../files/lib/gluon/alfred/announce.d/software/firmware | 8 ++++---- .../files/lib/gluon/alfred/announce.d/statistics/idletime | 2 +- .../files/lib/gluon/alfred/announce.d/statistics/loadavg | 2 +- .../files/lib/gluon/alfred/announce.d/statistics/uptime | 2 +- .../lib/gluon/alfred/announce.d/software/autoupdater | 8 ++++---- .../files/lib/gluon/alfred/announce.d/software/batman-adv | 2 +- .../files/lib/gluon/alfred/announce.d/statistics/traffic | 8 ++++---- .../files/lib/gluon/alfred/announce.d/software/fastd | 8 ++++---- .../files/lib/gluon/alfred/announce.d/location | 8 ++++---- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/software/firmware b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/software/firmware index 0a1ec310..cf50f79f 100644 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/software/firmware +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/software/firmware @@ -1,4 +1,4 @@ -return - { base = 'gluon-' .. util.trim(fs.readfile('/lib/gluon/gluon-version')) - , release = util.trim(fs.readfile('/lib/gluon/release')) - } +return { + base = 'gluon-' .. util.trim(fs.readfile('/lib/gluon/gluon-version')), + release = util.trim(fs.readfile('/lib/gluon/release')), +} diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/idletime b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/idletime index 93165f05..845de268 100644 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/idletime +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/idletime @@ -1 +1 @@ -return tonumber(util.trim(util.exec("cut -d' ' -f2 /proc/uptime"))) +return tonumber(fs.readfile('/proc/uptime'):match('^[^ ]+ ([^ ]+)')) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/loadavg b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/loadavg index dce5d440..d79973aa 100644 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/loadavg +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/loadavg @@ -1 +1 @@ -return tonumber(util.trim(util.exec("cut -d' ' -f1 /proc/loadavg"))) +return tonumber(fs.readfile('/proc/loadavg'):match('^([^ ]+) ')) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/uptime b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/uptime index 2fd6e301..0bc45bea 100644 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/uptime +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/uptime @@ -1 +1 @@ -return tonumber(util.trim(util.exec("cut -d' ' -f1 /proc/uptime"))) +return tonumber(fs.readfile('/proc/uptime'):match('^([^ ]+) ')) diff --git a/package/gluon-autoupdater/files/lib/gluon/alfred/announce.d/software/autoupdater b/package/gluon-autoupdater/files/lib/gluon/alfred/announce.d/software/autoupdater index 7745d1a2..75a67578 100644 --- a/package/gluon-autoupdater/files/lib/gluon/alfred/announce.d/software/autoupdater +++ b/package/gluon-autoupdater/files/lib/gluon/alfred/announce.d/software/autoupdater @@ -1,7 +1,7 @@ local autoupdater = uci:get_all('autoupdater', 'settings') if autoupdater then - return - { branch = autoupdater['branch'] - , enabled = uci:get_bool('autoupdater', 'settings', 'enabled') - } + return { + branch = autoupdater['branch'], + enabled = uci:get_bool('autoupdater', 'settings', 'enabled'), + } end diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/software/batman-adv b/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/software/batman-adv index 4af75985..2c8390d6 100644 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/software/batman-adv +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/software/batman-adv @@ -1,3 +1,3 @@ -local version = util.exec('batctl -v'):match('%[batman%-adv: ([^%]]+)%]') +local version = util.trim(fs.readfile('/sys/module/batman_adv/version')) return { version = version } diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/statistics/traffic b/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/statistics/traffic index 7667e4f5..378125e5 100644 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/statistics/traffic +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/statistics/traffic @@ -7,10 +7,10 @@ end local traffic = {} for _, class in ipairs({'rx', 'tx', 'forward', 'mgmt_rx', 'mgmt_tx'}) do - traffic[class] = - { bytes = fields[class .. '_bytes'] - , packets = fields[class] - } + traffic[class] = { + bytes = fields[class .. '_bytes'], + packets = fields[class], + } end traffic['tx']['dropped'] = fields['tx_dropped'] diff --git a/package/gluon-mesh-vpn-fastd/files/lib/gluon/alfred/announce.d/software/fastd b/package/gluon-mesh-vpn-fastd/files/lib/gluon/alfred/announce.d/software/fastd index 6abbbbc7..bbfbda08 100644 --- a/package/gluon-mesh-vpn-fastd/files/lib/gluon/alfred/announce.d/software/fastd +++ b/package/gluon-mesh-vpn-fastd/files/lib/gluon/alfred/announce.d/software/fastd @@ -1,4 +1,4 @@ -return - { enabled = uci:get_bool('fastd', 'mesh_vpn', 'enabled') - , version = util.trim(util.exec("fastd -v | cut -d' ' -f2")) - } +return { + enabled = uci:get_bool('fastd', 'mesh_vpn', 'enabled'), + version = util.exec('fastd -v'):match('^[^%s]+%s+([^\n]+)'), +} diff --git a/package/gluon-node-info/files/lib/gluon/alfred/announce.d/location b/package/gluon-node-info/files/lib/gluon/alfred/announce.d/location index 3060210c..eb9b3a9a 100644 --- a/package/gluon-node-info/files/lib/gluon/alfred/announce.d/location +++ b/package/gluon-node-info/files/lib/gluon/alfred/announce.d/location @@ -1,6 +1,6 @@ if uci:get_first('gluon-node-info', 'location', 'share_location', false) then - return - { latitude = tonumber(uci:get_first('gluon-node-info', 'location', 'latitude')) - , longitude = tonumber(uci:get_first('gluon-node-info', 'location', 'longitude')) - } + return { + latitude = tonumber(uci:get_first('gluon-node-info', 'location', 'latitude')), + longitude = tonumber(uci:get_first('gluon-node-info', 'location', 'longitude')), + } end From d3d22a17d1900134d3cd0f7ac2a51829377c0797 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 10 Jun 2014 19:20:55 +0200 Subject: [PATCH 273/453] gluon-alfred: use gzip --- package/gluon-alfred/files/lib/gluon/alfred/announce.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.lua b/package/gluon-alfred/files/lib/gluon/alfred/announce.lua index e222949c..f93a7d1e 100755 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.lua +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.lua @@ -40,5 +40,5 @@ end encoder = json.Encoder(collect_dir(announce_dir)) -alfred = io.popen('alfred -s ' .. tostring(alfred_data_type), 'w') +alfred = io.popen('gzip | alfred -s ' .. tostring(alfred_data_type), 'w') ltn12.pump.all(encoder:source(), ltn12.sink.file(alfred)) From 14ea7980f614b59ac4e1ad453f9d39432200a64a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 13 Jun 2014 21:56:32 +0200 Subject: [PATCH 274/453] gluon-firewall: enable conntrack on WAN Otherwise, the state match doesn't work, not allowing replies to outgoing packets to get in. --- .../files/lib/gluon/upgrade/firewall/invariant/011-wan-firewall | 1 + 1 file changed, 1 insertion(+) diff --git a/package/gluon-firewall/files/lib/gluon/upgrade/firewall/invariant/011-wan-firewall b/package/gluon-firewall/files/lib/gluon/upgrade/firewall/invariant/011-wan-firewall index b63f5193..792e06a2 100755 --- a/package/gluon-firewall/files/lib/gluon/upgrade/firewall/invariant/011-wan-firewall +++ b/package/gluon-firewall/files/lib/gluon/upgrade/firewall/invariant/011-wan-firewall @@ -9,6 +9,7 @@ local c = uci.cursor() local function reject_input_on_wan(zone) if zone.name == 'wan' then c:set('firewall', zone['.name'], 'input', 'REJECT') + c:set('firewall', zone['.name'], 'conntrack', '1') end return true From 5d3ce91f759307c8288a31ab14aabf5a2d93f292 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 15 Jun 2014 13:22:39 +0200 Subject: [PATCH 275/453] gluon-status-page: fix neighbor view with current iw/mac80211 The whole status page should be rewritten ASAP, but this fix will at least make it work again for now... --- .../files/lib/gluon/status-page/www/cgi-bin/status | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status b/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status index 9cec1f22..636a7aa7 100755 --- a/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status +++ b/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status @@ -47,15 +47,15 @@ echo "" echo "

Neighbours

" -iw dev | grep IBSS -B 4 | grep Interface | cut -d' ' -f2 | while read if +iw dev | grep IBSS -B 5 | grep Interface | cut -d' ' -f2 | while read if do echo "

$if

" echo "
"
-  
+
   iw dev $if link | escape_html
 
-  echo 
-  
+  echo
+
   iw dev $if station dump | escape_html | linknodes
 
   echo "
" From 8600a2f2881c81593a131d66128338dcace7fa4a Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 17 Jun 2014 19:33:58 +0200 Subject: [PATCH 276/453] gluon-config-mode: down/upstream is kbit/s The bandwidth limit input fields were missing a unit confusing users as to which value should be entered. It's kbit/s for both. --- .../usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua index de5d42ec..a0698327 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua @@ -36,13 +36,13 @@ o:depends("_meshvpn", "1") o.default = uci:get_bool("gluon-simple-tc", meshvpn_name, "enabled") and o.enabled or o.disabled o.rmempty = false -o = s:option(Value, "_limit_ingress", "Downstream") +o = s:option(Value, "_limit_ingress", "Downstream (kbit/s)") o:depends("_limit_enabled", "1") o.value = uci:get("gluon-simple-tc", meshvpn_name, "limit_ingress") o.rmempty = false o.datatype = "integer" -o = s:option(Value, "_limit_egress", "Upstream") +o = s:option(Value, "_limit_egress", "Upstream (kbit/s)") o:depends("_limit_enabled", "1") o.value = uci:get("gluon-simple-tc", meshvpn_name, "limit_egress") o.rmempty = false From 040a68ee65d5a0d949d93a4311953d3563a81226 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 26 Jun 2014 17:57:15 +0200 Subject: [PATCH 277/453] gluon-alfred: some announce.lua cleanup --- package/gluon-alfred/files/lib/gluon/alfred/announce.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.lua b/package/gluon-alfred/files/lib/gluon/alfred/announce.lua index f93a7d1e..23b3cd2c 100755 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.lua +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.lua @@ -26,8 +26,8 @@ function collect_dir(dir) for _, entry in ipairs(fs.dir(dir)) do if entry:sub(1, 1) ~= '.' then - err, val = pcall(collect_entry, dir .. '/' .. entry) - if err then + local ok, val = pcall(collect_entry, dir .. '/' .. entry) + if ok then ret[entry] = val else io.stderr:write(val, '\n') From e5b2978a48f6b47228722779cc732a3b7a0edb5e Mon Sep 17 00:00:00 2001 From: Julian Kornberger Date: Tue, 24 Jun 2014 23:14:33 +0200 Subject: [PATCH 278/453] ubiquity-bullet-m does also work with picostation Closes #31 --- package/gluon-autoupdater/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-autoupdater/README.md b/package/gluon-autoupdater/README.md index 9cba91b5..896d1574 100644 --- a/package/gluon-autoupdater/README.md +++ b/package/gluon-autoupdater/README.md @@ -5,7 +5,7 @@ Ubiquity -------- ubiquity-nanostation-m (dual ethernet) -ubiquity-bullet-m (single ethernet: Bullet M, Nanostation loco M) +ubiquity-bullet-m (single ethernet: Bullet M, NanoStation Loco M, PicoStation M) TP-Link ------- From b7b374bd5685795ecc8510a910777e206f6b5211 Mon Sep 17 00:00:00 2001 From: ohrensessel Date: Tue, 1 Jul 2014 23:29:36 +0200 Subject: [PATCH 279/453] Improve explanation of the Mesh-VPN --- .../usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua index a0698327..ce7e549c 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua @@ -25,7 +25,8 @@ o.rmempty = false s = f:section(SimpleSection, nil, [[Falls du deinen Knoten über das Internet mit Freifunk verbinden möchtest, kannst du hier das Mesh-VPN aktivieren. Solltest du dich dafür entscheiden, hast du die Möglichkeit die dafür -genutzte Bandbreite zu beschränken.]]) +genutzte Bandbreite zu beschränken. Lässt du das Mesh-VPN deaktiviert, +verbindet sich dein Knoten nur per WLAN mit anderen Knoten in der Nähe.]]) o = s:option(Flag, "_meshvpn", "Mesh-VPN aktivieren") o.default = uci:get_bool("fastd", meshvpn_name, "enabled") and o.enabled or o.disabled From 10519660ea8b2beca018f15571ea2ff7b5fb80df Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 2 Jul 2014 16:24:08 +0200 Subject: [PATCH 280/453] gluon-luci-admin: change text "Expertmode" to "Expert Mode" --- .../files/usr/lib/lua/luci/controller/admin/index.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua index 3b04b37c..2ff5281c 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua @@ -29,8 +29,8 @@ function index() root.target = alias("admin") root.index = true end - - local page = entry({"admin"}, alias("admin", "index"), "Expertmode", 10) + + local page = entry({"admin"}, alias("admin", "index"), "Expert Mode", 10) page.sysauth = "root" if configmode then -- force root to be logged in when running in configmode @@ -39,7 +39,7 @@ function index() page.sysauth_authenticator = "htmlauth" end page.index = true - + entry({"admin", "index"}, cbi("admin/remote"), "Remotezugriff", 1).ignoreindex = true if not configmode then From 626056e6257342ab64bf820afaf1efdb4bfd2e9d Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 5 Jul 2014 01:12:04 +0200 Subject: [PATCH 281/453] gluon-legacy: fix order of version_files and old_files handling --- package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade | 2 +- package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade-late | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade b/package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade index 8ff8c495..27517604 100755 --- a/package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade +++ b/package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade @@ -4,7 +4,7 @@ local site = require 'gluon.site_config' local ret = 1 -for _, file in pairs(site.legacy.version_files) do +for _, file in ipairs(site.legacy.version_files) do if os.remove(file) then ret = 0 end diff --git a/package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade-late b/package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade-late index 08763a09..1e79d821 100755 --- a/package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade-late +++ b/package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade-late @@ -3,6 +3,6 @@ local site = require 'gluon.site_config' -for _, file in pairs(site.legacy.old_files) do +for _, file in ipairs(site.legacy.old_files) do os.remove(file) end From ffd86668fecf26728b41217156b0c1167b2e69e1 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 5 Jul 2014 02:48:56 +0200 Subject: [PATCH 282/453] Validate site.conf --- package/gluon-autoupdater/Makefile | 9 +++++++-- package/gluon-autoupdater/check_site.lua | 13 +++++++++++++ package/gluon-config-mode/Makefile | 9 +++++++-- package/gluon-config-mode/check_site.lua | 3 +++ package/gluon-core/Makefile | 9 +++++++-- package/gluon-core/check_site.lua | 10 ++++++++++ package/gluon-legacy/Makefile | 9 +++++++-- package/gluon-legacy/check_site.lua | 8 ++++++++ package/gluon-mesh-batman-adv/Makefile | 10 ++++++++-- package/gluon-mesh-batman-adv/check_site.lua | 10 ++++++++++ package/gluon-mesh-vpn-fastd/Makefile | 9 +++++++-- package/gluon-mesh-vpn-fastd/check_site.lua | 13 +++++++++++++ package/gluon-next-node/Makefile | 9 +++++++-- package/gluon-next-node/check_site.lua | 4 ++++ 14 files changed, 111 insertions(+), 14 deletions(-) create mode 100644 package/gluon-autoupdater/check_site.lua create mode 100644 package/gluon-config-mode/check_site.lua create mode 100644 package/gluon-core/check_site.lua create mode 100644 package/gluon-legacy/check_site.lua create mode 100644 package/gluon-mesh-batman-adv/check_site.lua create mode 100644 package/gluon-mesh-vpn-fastd/check_site.lua create mode 100644 package/gluon-next-node/check_site.lua diff --git a/package/gluon-autoupdater/Makefile b/package/gluon-autoupdater/Makefile index a93f83f5..a885a0d0 100644 --- a/package/gluon-autoupdater/Makefile +++ b/package/gluon-autoupdater/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-autoupdater -PKG_VERSION:=2 +PKG_VERSION:=3 PKG_RELEASE:=$(GLUON_BRANCH) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) -include $(INCLUDE_DIR)/package.mk +include $(GLUONDIR)/include/package.mk define Package/gluon-autoupdater SECTION:=gluon @@ -34,4 +34,9 @@ define Package/gluon-autoupdater/install fi endef +define Package/gluon-autoupdater/postinst +#!/bin/sh +$(call GluonCheckSite,check_site.lua) +endef + $(eval $(call BuildPackage,gluon-autoupdater)) diff --git a/package/gluon-autoupdater/check_site.lua b/package/gluon-autoupdater/check_site.lua new file mode 100644 index 00000000..4d6302cd --- /dev/null +++ b/package/gluon-autoupdater/check_site.lua @@ -0,0 +1,13 @@ +need_string 'autoupdater.branch' + +local function check_branch(k, _) + local prefix = string.format('autoupdater.branches[%q].', k) + + need_string(prefix .. 'name') + need_string_array(prefix .. 'mirrors') + need_number(prefix .. 'probability') + need_number(prefix .. 'good_signatures') + need_string_array(prefix .. 'pubkeys') +end + +need_table('autoupdater.branches', check_branch) diff --git a/package/gluon-config-mode/Makefile b/package/gluon-config-mode/Makefile index 9a28d027..2d045b17 100644 --- a/package/gluon-config-mode/Makefile +++ b/package/gluon-config-mode/Makefile @@ -4,11 +4,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-config-mode -PKG_VERSION:=2 +PKG_VERSION:=3 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) -include $(INCLUDE_DIR)/package.mk +include $(GLUONDIR)/include/package.mk define Package/gluon-config-mode SECTION:=gluon @@ -35,4 +35,9 @@ define Package/gluon-config-mode/install $(CP) ./files/* $(1)/ endef +define Package/gluon-config-mode/postinst +#!/bin/sh +$(call GluonCheckSite,check_site.lua) +endef + $(eval $(call BuildPackage,gluon-config-mode)) diff --git a/package/gluon-config-mode/check_site.lua b/package/gluon-config-mode/check_site.lua new file mode 100644 index 00000000..4892ceb3 --- /dev/null +++ b/package/gluon-config-mode/check_site.lua @@ -0,0 +1,3 @@ +need_string 'config_mode.msg_welcome' +need_string 'config_mode.msg_pubkey' +need_string 'config_mode.msg_reboot' diff --git a/package/gluon-core/Makefile b/package/gluon-core/Makefile index 1282de36..5dbaee00 100644 --- a/package/gluon-core/Makefile +++ b/package/gluon-core/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-core -PKG_VERSION:=2 +PKG_VERSION:=3 PKG_RELEASE:=$(GLUON_VERSION) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) -include $(INCLUDE_DIR)/package.mk +include $(GLUONDIR)/include/package.mk define Package/gluon-core SECTION:=gluon @@ -36,4 +36,9 @@ define Package/gluon-core/install echo "$(GLUON_VERSION)" > $(1)/lib/gluon/gluon-version endef +define Package/gluon-core/postinst +#!/bin/sh +$(call GluonCheckSite,check_site.lua) +endef + $(eval $(call BuildPackage,gluon-core)) diff --git a/package/gluon-core/check_site.lua b/package/gluon-core/check_site.lua new file mode 100644 index 00000000..67035c0e --- /dev/null +++ b/package/gluon-core/check_site.lua @@ -0,0 +1,10 @@ +need_string 'site_code' +need_string 'site_name' + +need_string 'hostname_prefix' +need_string 'timezone' + +need_string_array('ntp_servers', false) + +need_string_match('prefix4', '^%d+.%d+.%d+.%d+/%d+$') +need_string_match('prefix6', '^[%x:]+/%d+$') diff --git a/package/gluon-legacy/Makefile b/package/gluon-legacy/Makefile index d074f699..7320fba6 100644 --- a/package/gluon-legacy/Makefile +++ b/package/gluon-legacy/Makefile @@ -1,11 +1,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-legacy -PKG_VERSION:=1 +PKG_VERSION:=2 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) -include $(INCLUDE_DIR)/package.mk +include $(GLUONDIR)/include/package.mk define Package/gluon-legacy SECTION:=gluon @@ -32,4 +32,9 @@ define Package/gluon-legacy/install $(CP) ./files/* $(1)/ endef +define Package/gluon-legacy/postinst +#!/bin/sh +$(call GluonCheckSite,check_site.lua) +endef + $(eval $(call BuildPackage,gluon-legacy)) diff --git a/package/gluon-legacy/check_site.lua b/package/gluon-legacy/check_site.lua new file mode 100644 index 00000000..1ec26de0 --- /dev/null +++ b/package/gluon-legacy/check_site.lua @@ -0,0 +1,8 @@ +need_string_array 'legacy.version_files' +need_string_array 'legacy.old_files' + +need_string_array 'legacy.config_mode_configs' +need_string_array 'legacy.fastd_configs' +need_string 'legacy.mesh_ifname' +need_string_array 'legacy.tc_configs' +need_string_array 'legacy.wifi_names' diff --git a/package/gluon-mesh-batman-adv/Makefile b/package/gluon-mesh-batman-adv/Makefile index bc545baf..5daf5e52 100644 --- a/package/gluon-mesh-batman-adv/Makefile +++ b/package/gluon-mesh-batman-adv/Makefile @@ -1,11 +1,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-mesh-batman-adv -PKG_VERSION:=2 +PKG_VERSION:=3 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) -include $(INCLUDE_DIR)/package.mk +include $(GLUONDIR)/include/package.mk define Package/gluon-mesh-batman-adv SECTION:=gluon @@ -32,4 +32,10 @@ define Package/gluon-mesh-batman-adv/install $(CP) ./files/* $(1)/ endef +define Package/gluon-mesh-batman-adv/postinst +#!/bin/sh +$(call GluonCheckSite,check_site.lua) +endef + + $(eval $(call BuildPackage,gluon-mesh-batman-adv)) diff --git a/package/gluon-mesh-batman-adv/check_site.lua b/package/gluon-mesh-batman-adv/check_site.lua new file mode 100644 index 00000000..36619564 --- /dev/null +++ b/package/gluon-mesh-batman-adv/check_site.lua @@ -0,0 +1,10 @@ +need_string('regdom') + +for _, config in ipairs({'wifi24', 'wifi5'}) do + need_string(config .. '.ssid') + need_number(config .. '.channel') + need_string(config .. '.htmode') + need_string(config .. '.mesh_ssid') + need_string_match(config .. '.mesh_bssid', '^%x[02468aAcCeE]:%x%x:%x%x:%x%x:%x%x:%x%x$') + need_number(config .. '.mesh_mcast_rate') +end diff --git a/package/gluon-mesh-vpn-fastd/Makefile b/package/gluon-mesh-vpn-fastd/Makefile index 3531b3b1..9290b457 100644 --- a/package/gluon-mesh-vpn-fastd/Makefile +++ b/package/gluon-mesh-vpn-fastd/Makefile @@ -1,11 +1,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-mesh-vpn-fastd -PKG_VERSION:=2 +PKG_VERSION:=3 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) -include $(INCLUDE_DIR)/package.mk +include $(GLUONDIR)/include/package.mk define Package/gluon-mesh-vpn-fastd SECTION:=gluon @@ -32,4 +32,9 @@ define Package/gluon-mesh-vpn-fastd/install $(CP) ./files/* $(1)/ endef +define Package/gluon-mesh-vpn-fastd/postinst +#!/bin/sh +$(call GluonCheckSite,check_site.lua) +endef + $(eval $(call BuildPackage,gluon-mesh-vpn-fastd)) diff --git a/package/gluon-mesh-vpn-fastd/check_site.lua b/package/gluon-mesh-vpn-fastd/check_site.lua new file mode 100644 index 00000000..6c817137 --- /dev/null +++ b/package/gluon-mesh-vpn-fastd/check_site.lua @@ -0,0 +1,13 @@ +need_string_array 'fastd_mesh_vpn.methods' +need_number 'fastd_mesh_vpn.mtu' +need_number 'fastd_mesh_vpn.backbone.limit' + + +local function check_peer(k, _) + local prefix = string.format('fastd_mesh_vpn.backbone.peers[%q].', k) + + need_string(prefix .. 'key') + need_string_array(prefix .. 'remotes') +end + +need_table('fastd_mesh_vpn.backbone.peers', check_peer) diff --git a/package/gluon-next-node/Makefile b/package/gluon-next-node/Makefile index ee0e0920..f906bbd5 100644 --- a/package/gluon-next-node/Makefile +++ b/package/gluon-next-node/Makefile @@ -1,11 +1,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-next-node -PKG_VERSION:=2 +PKG_VERSION:=3 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) -include $(INCLUDE_DIR)/package.mk +include $(GLUONDIR)/include/package.mk define Package/gluon-next-node SECTION:=gluon @@ -32,4 +32,9 @@ define Package/gluon-next-node/install $(CP) ./files/* $(1)/ endef +define Package/gluon-next-node/postinst +#!/bin/sh +$(call GluonCheckSite,check_site.lua) +endef + $(eval $(call BuildPackage,gluon-next-node)) diff --git a/package/gluon-next-node/check_site.lua b/package/gluon-next-node/check_site.lua new file mode 100644 index 00000000..83889a8e --- /dev/null +++ b/package/gluon-next-node/check_site.lua @@ -0,0 +1,4 @@ +need_string_match('next_node.ip4', '^%d+.%d+.%d+.%d+$') +need_string_match('next_node.ip6', '^[%x:]+$') + +need_string_match('next_node.mac', '^%x[02468aAcCeE]:%x%x:%x%x:%x%x:%x%x:%x%x$') From f6a51c63e49d2ecde468f6d5b6dceb316efb36f2 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 5 Jul 2014 15:56:22 +0200 Subject: [PATCH 283/453] gluon-firewall: reject DNS queries from br-client (they should be accepted on local-node only) --- .../{011-wan-firewall => 011-firewall-rules} | 11 +++++++++++ 1 file changed, 11 insertions(+) rename package/gluon-firewall/files/lib/gluon/upgrade/firewall/invariant/{011-wan-firewall => 011-firewall-rules} (79%) diff --git a/package/gluon-firewall/files/lib/gluon/upgrade/firewall/invariant/011-wan-firewall b/package/gluon-firewall/files/lib/gluon/upgrade/firewall/invariant/011-firewall-rules similarity index 79% rename from package/gluon-firewall/files/lib/gluon/upgrade/firewall/invariant/011-wan-firewall rename to package/gluon-firewall/files/lib/gluon/upgrade/firewall/invariant/011-firewall-rules index 792e06a2..1a422ca3 100755 --- a/package/gluon-firewall/files/lib/gluon/upgrade/firewall/invariant/011-wan-firewall +++ b/package/gluon-firewall/files/lib/gluon/upgrade/firewall/invariant/011-firewall-rules @@ -26,5 +26,16 @@ c:section('firewall', 'rule', 'wan_ssh', } ) + +c:section('firewall', 'rule', 'client_dns', + { + name = 'client_dns', + src = 'client', + dest_port = '53', + target = 'REJECT', + } +) + + c:save('firewall') c:commit('firewall') From 2ec02a41c208f599a2bac0a523959588e11bdde3 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 5 Jul 2014 19:39:24 +0200 Subject: [PATCH 284/453] gluon-core: add functions to unset sysconfig settings --- .../gluon-core/files/lib/gluon/functions/sysconfig.sh | 4 ++++ .../gluon-core/files/usr/lib/lua/gluon/sysconfig.lua | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/package/gluon-core/files/lib/gluon/functions/sysconfig.sh b/package/gluon-core/files/lib/gluon/functions/sysconfig.sh index 67aa1061..60b410f2 100644 --- a/package/gluon-core/files/lib/gluon/functions/sysconfig.sh +++ b/package/gluon-core/files/lib/gluon/functions/sysconfig.sh @@ -12,3 +12,7 @@ sysconfig_isset() { sysconfig_set() { echo -n "$2" > "$SYSCONFIGDIR/$1" } + +sysconfig_unset() { + rm -f "$SYSCONFIGDIR/$1" +} diff --git a/package/gluon-core/files/usr/lib/lua/gluon/sysconfig.lua b/package/gluon-core/files/usr/lib/lua/gluon/sysconfig.lua index 35c5062c..3ba26e95 100644 --- a/package/gluon-core/files/usr/lib/lua/gluon/sysconfig.lua +++ b/package/gluon-core/files/usr/lib/lua/gluon/sysconfig.lua @@ -11,10 +11,13 @@ local function get(_, name) end local function set(_, name, val) - local ret = nil - local f = io.open(sysconfigdir .. name, 'w+') - f:write(val) - f:close() + if val then + local f = io.open(sysconfigdir .. name, 'w+') + f:write(val) + f:close() + else + os.remove(sysconfigdir .. name) + end end local setmetatable = setmetatable From f93e9b818fdcaaaf3f2aaba1bd4ab4503eea17dd Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 5 Jul 2014 20:11:41 +0200 Subject: [PATCH 285/453] Split gluon-setup-mode package out of gluon-config-mode gluon-config-mode retains the luci frontend, all setup scripts and config is moved to the new package. --- package/gluon-config-mode/Makefile | 6 +-- .../files/etc/config/gluon-config-mode | 3 -- .../etc/hotplug.d/button/50-gluon-config-mode | 29 -------------- .../config-mode/invariant/010-config-ifname | 17 --------- .../controller/gluon-config-mode/index.lua | 8 ++-- .../legacy/010-migrate-configured | 8 ++-- .../lib/lua/luci/controller/admin/index.lua | 12 +++--- package/gluon-setup-mode/Makefile | 38 +++++++++++++++++++ .../files/etc/config/gluon-setup-mode | 3 ++ .../etc/hotplug.d/button/50-gluon-setup-mode | 29 ++++++++++++++ .../files/etc/init.d/gluon-setup-mode} | 36 +++++++++--------- .../files/lib/gluon/setup-mode}/ash-login | 0 .../lib/gluon/setup-mode}/www/cgi-bin/luci | 0 .../lib/gluon/setup-mode}/www/index.html | 0 .../lib/gluon/setup-mode}/www/luci-static | 0 .../invariant/010-setup-mode-migrate | 18 +++++++++ .../setup-mode/invariant/011-setup-ifname | 20 ++++++++++ 17 files changed, 143 insertions(+), 84 deletions(-) delete mode 100644 package/gluon-config-mode/files/etc/config/gluon-config-mode delete mode 100755 package/gluon-config-mode/files/etc/hotplug.d/button/50-gluon-config-mode delete mode 100755 package/gluon-config-mode/files/lib/gluon/upgrade/config-mode/invariant/010-config-ifname rename package/gluon-legacy/files/lib/gluon/upgrade/{config-mode => setup-mode}/legacy/010-migrate-configured (59%) create mode 100644 package/gluon-setup-mode/Makefile create mode 100644 package/gluon-setup-mode/files/etc/config/gluon-setup-mode create mode 100755 package/gluon-setup-mode/files/etc/hotplug.d/button/50-gluon-setup-mode rename package/{gluon-config-mode/files/etc/init.d/gluon-config-mode => gluon-setup-mode/files/etc/init.d/gluon-setup-mode} (52%) rename package/{gluon-config-mode/files/lib/gluon/config-mode => gluon-setup-mode/files/lib/gluon/setup-mode}/ash-login (100%) rename package/{gluon-config-mode/files/lib/gluon/config-mode => gluon-setup-mode/files/lib/gluon/setup-mode}/www/cgi-bin/luci (100%) rename package/{gluon-config-mode/files/lib/gluon/config-mode => gluon-setup-mode/files/lib/gluon/setup-mode}/www/index.html (100%) rename package/{gluon-config-mode/files/lib/gluon/config-mode => gluon-setup-mode/files/lib/gluon/setup-mode}/www/luci-static (100%) create mode 100755 package/gluon-setup-mode/files/lib/gluon/upgrade/setup-mode/invariant/010-setup-mode-migrate create mode 100755 package/gluon-setup-mode/files/lib/gluon/upgrade/setup-mode/invariant/011-setup-ifname diff --git a/package/gluon-config-mode/Makefile b/package/gluon-config-mode/Makefile index 2d045b17..5a11faad 100644 --- a/package/gluon-config-mode/Makefile +++ b/package/gluon-config-mode/Makefile @@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-config-mode -PKG_VERSION:=3 +PKG_VERSION:=4 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) @@ -13,8 +13,8 @@ include $(GLUONDIR)/include/package.mk define Package/gluon-config-mode SECTION:=gluon CATEGORY:=Gluon - TITLE:=Luci based config mode for user friendly setup of new meshnodes - DEPENDS:=+gluon-luci-core +gluon-lock-password +gluon-node-info +gluon-simple-tc +uhttpd +dnsmasq +ip + TITLE:=Luci based config mode for user friendly setup of new mesh nodes + DEPENDS:=+gluon-luci-core +gluon-setup-mode +gluon-lock-password +gluon-node-info +gluon-simple-tc endef define Package/gluon-config-mode/description diff --git a/package/gluon-config-mode/files/etc/config/gluon-config-mode b/package/gluon-config-mode/files/etc/config/gluon-config-mode deleted file mode 100644 index c2d2be2f..00000000 --- a/package/gluon-config-mode/files/etc/config/gluon-config-mode +++ /dev/null @@ -1,3 +0,0 @@ -config wizard - option enabled '0' - option configured '0' diff --git a/package/gluon-config-mode/files/etc/hotplug.d/button/50-gluon-config-mode b/package/gluon-config-mode/files/etc/hotplug.d/button/50-gluon-config-mode deleted file mode 100755 index 7648cd69..00000000 --- a/package/gluon-config-mode/files/etc/hotplug.d/button/50-gluon-config-mode +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - - -wait=3 - - -wait_config_mode() { - sleep $wait - uci set 'gluon-config-mode.@wizard[0].enabled=1' - uci commit gluon-config-mode - reboot -} - - -if [ "$BUTTON" = wps -o "$BUTTON" = reset ]; then - case "$ACTION" in - pressed) - wait_config_mode & - PID=$! - echo $PID > /tmp/.wait_config_mode - ;; - released) - if [ -r /tmp/.wait_config_mode ]; then - kill $(cat /tmp/.wait_config_mode) - rm /tmp/.wait_config_mode - fi - ;; - esac -fi diff --git a/package/gluon-config-mode/files/lib/gluon/upgrade/config-mode/invariant/010-config-ifname b/package/gluon-config-mode/files/lib/gluon/upgrade/config-mode/invariant/010-config-ifname deleted file mode 100755 index ce54a9b3..00000000 --- a/package/gluon-config-mode/files/lib/gluon/upgrade/config-mode/invariant/010-config-ifname +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -. /lib/gluon/functions/sysconfig.sh -. /lib/ar71xx.sh - - -sysconfig_isset config_ifname && exit 0 - - -case "$(ar71xx_board_name)" in - nanostation-m) - sysconfig_set config_ifname "$(sysconfig wan_ifname || sysconfig lan_ifname)" - ;; - *) - sysconfig_set config_ifname "$(sysconfig lan_ifname || sysconfig wan_ifname)" - ;; -esac diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua index d8b21b88..def9d401 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua @@ -21,7 +21,7 @@ local meshvpn_name = "mesh_vpn" function index() local uci_state = luci.model.uci.cursor_state() - if uci_state:get_first("gluon-config-mode", "wizard", "running", "0") == "1" then + 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") @@ -57,9 +57,9 @@ function action_reboot() pubkey = configmode.get_fastd_pubkey(meshvpn_name) end - uci:set("gluon-config-mode", uci:get_first("gluon-config-mode", "wizard"), "configured", "1") - uci:save("gluon-config-mode") - uci:commit("gluon-config-mode") + 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") local hostname = uci:get_first("system", "system", "hostname") diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/config-mode/legacy/010-migrate-configured b/package/gluon-legacy/files/lib/gluon/upgrade/setup-mode/legacy/010-migrate-configured similarity index 59% rename from package/gluon-legacy/files/lib/gluon/upgrade/config-mode/legacy/010-migrate-configured rename to package/gluon-legacy/files/lib/gluon/upgrade/setup-mode/legacy/010-migrate-configured index 18bdaf19..f4a59570 100755 --- a/package/gluon-legacy/files/lib/gluon/upgrade/config-mode/legacy/010-migrate-configured +++ b/package/gluon-legacy/files/lib/gluon/upgrade/setup-mode/legacy/010-migrate-configured @@ -9,11 +9,11 @@ local c = uci.cursor() for _, config in ipairs(site.legacy.config_mode_configs) do local old = c:get_first(config, 'wizard', 'configured') if old == '1' then - local wizard = c:get_first('gluon-config-mode', 'wizard') - c:set('gluon-config-mode', wizard, 'configured', '1') + local setup_mode = c:get_first('gluon-setup-mode', 'setup_mode') + c:set('gluon-setup-mode', setup_mode, 'configured', '1') - c:save('gluon-config-mode') - c:commit('gluon-config-mode') + c:save('gluon-setup-mode') + c:commit('gluon-setup-mode') break end diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua index 2ff5281c..4d9883ca 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua @@ -17,10 +17,10 @@ module("luci.controller.admin.index", package.seeall) function index() local uci_state = luci.model.uci.cursor_state() - local configmode = uci_state:get_first("gluon-config-mode", "wizard", "running", "0") == "1" + local setup_mode = uci_state:get_first("gluon-setup-mode", "setup_mode", "running", "0") == "1" - -- Disable gluon-luci-admin when configmode is not enabled - if not configmode then + -- Disable gluon-luci-admin when setup mode is not enabled + if not setup_mode then return end @@ -32,8 +32,8 @@ function index() local page = entry({"admin"}, alias("admin", "index"), "Expert Mode", 10) page.sysauth = "root" - if configmode then - -- force root to be logged in when running in configmode + if setup_mode then + -- force root to be logged in when running in setup_mode page.sysauth_authenticator = function() return "root" end else page.sysauth_authenticator = "htmlauth" @@ -42,7 +42,7 @@ function index() entry({"admin", "index"}, cbi("admin/remote"), "Remotezugriff", 1).ignoreindex = true - if not configmode then + if not setup_mode then entry({"admin", "logout"}, call("action_logout"), "Logout") end end diff --git a/package/gluon-setup-mode/Makefile b/package/gluon-setup-mode/Makefile new file mode 100644 index 00000000..e8d4fe52 --- /dev/null +++ b/package/gluon-setup-mode/Makefile @@ -0,0 +1,38 @@ +# Copyright (C) 2012 Nils Schneider +# This is free software, licensed under the Apache 2.0 license. + +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-setup-mode +PKG_VERSION:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(GLUONDIR)/include/package.mk + +define Package/gluon-setup-mode + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Setup mode + DEPENDS:=+uhttpd +dnsmasq +ip +endef + +define Package/gluon-setup-mode/description + Offline mode to perform basic setup in a secure manner. +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-setup-mode/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-setup-mode)) diff --git a/package/gluon-setup-mode/files/etc/config/gluon-setup-mode b/package/gluon-setup-mode/files/etc/config/gluon-setup-mode new file mode 100644 index 00000000..c652728f --- /dev/null +++ b/package/gluon-setup-mode/files/etc/config/gluon-setup-mode @@ -0,0 +1,3 @@ +config setup_mode + option enabled '0' + option configured '0' diff --git a/package/gluon-setup-mode/files/etc/hotplug.d/button/50-gluon-setup-mode b/package/gluon-setup-mode/files/etc/hotplug.d/button/50-gluon-setup-mode new file mode 100755 index 00000000..9a1ccf2f --- /dev/null +++ b/package/gluon-setup-mode/files/etc/hotplug.d/button/50-gluon-setup-mode @@ -0,0 +1,29 @@ +#!/bin/sh + + +wait=3 + + +wait_setup_mode() { + sleep $wait + uci set 'gluon-setup-mode.@setup_mode[0].enabled=1' + uci commit gluon-setup-mode + reboot +} + + +if [ "$BUTTON" = wps -o "$BUTTON" = reset ]; then + case "$ACTION" in + pressed) + wait_setup_mode & + PID=$! + echo $PID > /tmp/.wait_setup_mode + ;; + released) + if [ -r /tmp/.wait_setup_mode ]; then + kill $(cat /tmp/.wait_setup_mode) + rm /tmp/.wait_setup_mode + fi + ;; + esac +fi diff --git a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode b/package/gluon-setup-mode/files/etc/init.d/gluon-setup-mode similarity index 52% rename from package/gluon-config-mode/files/etc/init.d/gluon-config-mode rename to package/gluon-setup-mode/files/etc/init.d/gluon-setup-mode index e613f7b1..6abff8eb 100755 --- a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode +++ b/package/gluon-setup-mode/files/etc/init.d/gluon-setup-mode @@ -3,10 +3,10 @@ START=12 -CONFIG_MODE_ADDR=192.168.1.1 -CONFIG_MODE_NETMASK=255.255.255.0 +SETUP_MODE_ADDR=192.168.1.1 +SETUP_MODE_NETMASK=255.255.255.0 -CONFIG_MODE_DHCP_RANGE=192.168.1.2,192.168.1.254 +SETUP_MODE_DHCP_RANGE=192.168.1.2,192.168.1.254 delete_interface() { @@ -25,7 +25,7 @@ check_enable() { setup_network() { ( - export UCI_CONFIG_DIR=/var/gluon/config-mode/config + export UCI_CONFIG_DIR=/var/gluon/setup-mode/config mkdir -p "$UCI_CONFIG_DIR" @@ -34,12 +34,12 @@ setup_network() { config_load network config_foreach delete_interface interface - uci_add network interface config - uci_set network config ifname "$(sysconfig config_ifname)" - uci_set network config type 'bridge' - uci_set network config proto 'static' - uci_set network config ipaddr "$CONFIG_MODE_ADDR" - uci_set network config netmask "$CONFIG_MODE_NETMASK" + uci_add network interface setup + uci_set network setup ifname "$(sysconfig setup_ifname)" + uci_set network setup type 'bridge' + uci_set network setup proto 'static' + uci_set network setup ipaddr "$SETUP_MODE_ADDR" + uci_set network setup netmask "$SETUP_MODE_NETMASK" uci_commit network @@ -58,22 +58,22 @@ start() { . /lib/gluon/functions/sysconfig.sh enable=0 - config_load gluon-config-mode - config_foreach check_enable wizard + config_load gluon-setup-mode + config_foreach check_enable setup_mode if [ "$enable" = '1' ]; then - lua -luci -e 'require "luci.model.uci"; uci_state=luci.model.uci.cursor_state(); uci_state:section("gluon-config-mode", "wizard", nil, { running = "1" }); uci_state:save("gluon-config-mode")' - uci set 'gluon-config-mode.@wizard[0].enabled=0' - uci commit gluon-config-mode + lua -luci -e 'require "luci.model.uci"; uci_state=luci.model.uci.cursor_state(); uci_state:section("gluon-setup-mode", "setup_mode", nil, { running = "1" }); uci_state:save("gluon-setup-mode")' + uci set 'gluon-setup-mode.@setup_mode[0].enabled=0' + uci commit gluon-setup-mode setup_network - /usr/sbin/telnetd -l /lib/gluon/config-mode/ash-login + /usr/sbin/telnetd -l /lib/gluon/setup-mode/ash-login /etc/init.d/dropbear start - /usr/sbin/uhttpd -h /lib/gluon/config-mode/www -x /cgi-bin -A 1 -R -p 0.0.0.0:80 + /usr/sbin/uhttpd -h /lib/gluon/setup-mode/www -x /cgi-bin -A 1 -R -p 0.0.0.0:80 - /usr/sbin/dnsmasq -p 0 -F $CONFIG_MODE_DHCP_RANGE -l /tmp/dhcp.leases -O option:router + /usr/sbin/dnsmasq -p 0 -F $SETUP_MODE_DHCP_RANGE -l /tmp/dhcp.leases -O option:router /etc/init.d/led start diff --git a/package/gluon-config-mode/files/lib/gluon/config-mode/ash-login b/package/gluon-setup-mode/files/lib/gluon/setup-mode/ash-login similarity index 100% rename from package/gluon-config-mode/files/lib/gluon/config-mode/ash-login rename to package/gluon-setup-mode/files/lib/gluon/setup-mode/ash-login diff --git a/package/gluon-config-mode/files/lib/gluon/config-mode/www/cgi-bin/luci b/package/gluon-setup-mode/files/lib/gluon/setup-mode/www/cgi-bin/luci similarity index 100% rename from package/gluon-config-mode/files/lib/gluon/config-mode/www/cgi-bin/luci rename to package/gluon-setup-mode/files/lib/gluon/setup-mode/www/cgi-bin/luci diff --git a/package/gluon-config-mode/files/lib/gluon/config-mode/www/index.html b/package/gluon-setup-mode/files/lib/gluon/setup-mode/www/index.html similarity index 100% rename from package/gluon-config-mode/files/lib/gluon/config-mode/www/index.html rename to package/gluon-setup-mode/files/lib/gluon/setup-mode/www/index.html diff --git a/package/gluon-config-mode/files/lib/gluon/config-mode/www/luci-static b/package/gluon-setup-mode/files/lib/gluon/setup-mode/www/luci-static similarity index 100% rename from package/gluon-config-mode/files/lib/gluon/config-mode/www/luci-static rename to package/gluon-setup-mode/files/lib/gluon/setup-mode/www/luci-static diff --git a/package/gluon-setup-mode/files/lib/gluon/upgrade/setup-mode/invariant/010-setup-mode-migrate b/package/gluon-setup-mode/files/lib/gluon/upgrade/setup-mode/invariant/010-setup-mode-migrate new file mode 100755 index 00000000..9d3b9b0a --- /dev/null +++ b/package/gluon-setup-mode/files/lib/gluon/upgrade/setup-mode/invariant/010-setup-mode-migrate @@ -0,0 +1,18 @@ +#!/usr/bin/lua + +local site = require 'gluon.site_config' +local uci = require 'luci.model.uci' + +local c = uci.cursor() + + +local old = c:get_first('gluon-config-mode', 'wizard', 'configured') +if old == '1' then + local setup_mode = c:get_first('gluon-setup-mode', 'setup_mode') + c:set('gluon-setup-mode', setup_mode, 'configured', '1') + + c:save('gluon-setup-mode') + c:commit('gluon-setup-mode') +end + +os.remove('/etc/config/gluon-config-mode') diff --git a/package/gluon-setup-mode/files/lib/gluon/upgrade/setup-mode/invariant/011-setup-ifname b/package/gluon-setup-mode/files/lib/gluon/upgrade/setup-mode/invariant/011-setup-ifname new file mode 100755 index 00000000..f9f33a70 --- /dev/null +++ b/package/gluon-setup-mode/files/lib/gluon/upgrade/setup-mode/invariant/011-setup-ifname @@ -0,0 +1,20 @@ +#!/bin/sh + +. /lib/gluon/functions/sysconfig.sh +. /lib/gluon/functions/model.sh + + +sysconfig_isset setup_ifname && exit 0 + + +case "$(get_board_name)" in + nanostation-m) + sysconfig_set setup_ifname "$(sysconfig config_ifname || sysconfig wan_ifname || sysconfig lan_ifname)" + ;; + *) + sysconfig_set setup_ifname "$(sysconfig config_ifname || sysconfig lan_ifname || sysconfig wan_ifname)" + ;; +esac + +# Remove the old sysconfig setting +sysconfig_unset config_ifname From 1c0429ce8fea7a1033fb663ccff6a12a6a66bb09 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 7 Jul 2014 19:12:42 +0200 Subject: [PATCH 286/453] gluon-core: extend user management library and convert it to Lua --- .../files/lib/gluon/functions/users.sh | 12 ----- .../files/usr/lib/lua/gluon/users.lua | 33 ++++++++++++ .../files/usr/lib/lua/gluon/util.lua | 52 +++++++++++++++++++ .../invariant/010-mesh-vpn-fastd | 4 +- .../upgrade/radvd/invariant/10-radvd-user | 6 +-- 5 files changed, 91 insertions(+), 16 deletions(-) delete mode 100644 package/gluon-core/files/lib/gluon/functions/users.sh create mode 100644 package/gluon-core/files/usr/lib/lua/gluon/users.lua create mode 100644 package/gluon-core/files/usr/lib/lua/gluon/util.lua diff --git a/package/gluon-core/files/lib/gluon/functions/users.sh b/package/gluon-core/files/lib/gluon/functions/users.sh deleted file mode 100644 index d0579858..00000000 --- a/package/gluon-core/files/lib/gluon/functions/users.sh +++ /dev/null @@ -1,12 +0,0 @@ -add_user() { - local username="$1" - local id="$2" - - [ "$username" -a "$id" ] || return 1 - - sed -i "/^$username:/d" /etc/passwd - sed -i "/^$username:/d" /etc/shadow - - echo "$username:*:$id:100:$username:/var:/bin/false" >> /etc/passwd - echo "$username:*:0:0:99999:7:::" >> /etc/shadow -} diff --git a/package/gluon-core/files/usr/lib/lua/gluon/users.lua b/package/gluon-core/files/usr/lib/lua/gluon/users.lua new file mode 100644 index 00000000..8e618d88 --- /dev/null +++ b/package/gluon-core/files/usr/lib/lua/gluon/users.lua @@ -0,0 +1,33 @@ +local util = require 'gluon.util' + +local os = os +local string = string + + +module 'gluon.users' + +function add_user(username, uid, gid) + util.lock('/var/lock/passwd') + util.replace_prefix('/etc/passwd', username .. ':', string.format('%s:*:%u:%u::/var:/bin/false\n', username, uid, gid)) + util.replace_prefix('/etc/shadow', username .. ':', string.format('%s:*:0:0:99999:7:::\n', username)) + util.unlock('/var/lock/passwd') +end + +function remove_user(username) + util.lock('/var/lock/passwd') + util.replace_prefix('/etc/passwd', username .. ':') + util.replace_prefix('/etc/shadow', username .. ':') + util.unlock('/var/lock/passwd') +end + +function add_group(groupname, gid) + util.lock('/var/lock/group') + util.replace_prefix('/etc/group', groupname .. ':', string.format('%s:x:%u:\n', groupname, gid)) + util.unlock('/var/lock/group') +end + +function remove_group(groupname) + util.lock('/var/lock/group') + util.replace_prefix('/etc/group', groupname .. ':') + util.unlock('/var/lock/group') +end diff --git a/package/gluon-core/files/usr/lib/lua/gluon/util.lua b/package/gluon-core/files/usr/lib/lua/gluon/util.lua new file mode 100644 index 00000000..8bfc8cdf --- /dev/null +++ b/package/gluon-core/files/usr/lib/lua/gluon/util.lua @@ -0,0 +1,52 @@ +-- Writes all lines from the file input to the file output except those starting with prefix +-- Doesn't close the output file, but returns the file object +local function do_filter_prefix(input, output, prefix) + local f = io.open(output, 'w+') + local l = prefix:len() + + for line in io.lines(input) do + if line:sub(1, l) ~= prefix then + f:write(line, '\n') + end + end + + return f +end + + +local function escape_args(ret, arg0, ...) + if not arg0 then + return ret + end + + return escape_args(ret .. "'" .. string.gsub(arg0, "'", "'\\''") .. "' ", ...) +end + + +local os = os +local string = string + +module 'gluon.util' + +function exec(...) + return os.execute(escape_args('', ...)) +end + +-- Removes all lines starting with a prefix from a file, optionally adding a new one +function replace_prefix(file, prefix, add) + local tmp = file .. '.tmp' + local f = do_filter_prefix(file, tmp, prefix) + if add then + f:write(add) + end + f:close() + os.rename(tmp, file) +end + +function lock(file) + exec('lock', file) +end + +function unlock(file) + exec('lock', '-u', file) +end diff --git a/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd index 1d6d5811..ebce54f6 100755 --- a/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd +++ b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd @@ -2,13 +2,15 @@ local site = require 'gluon.site_config' local sysconfig = require 'gluon.sysconfig' +local users = require 'gluon.users' + local nixio = require 'nixio' local uci = require 'luci.model.uci' local c = uci.cursor() -os.execute('. /lib/gluon/functions/users.sh && add_user gluon-fastd 800') +users.add_user('gluon-fastd', 800, 100) c:section('fastd', 'fastd', 'mesh_vpn', diff --git a/package/gluon-radvd/files/lib/gluon/upgrade/radvd/invariant/10-radvd-user b/package/gluon-radvd/files/lib/gluon/upgrade/radvd/invariant/10-radvd-user index baa0c9d2..d2be86ae 100755 --- a/package/gluon-radvd/files/lib/gluon/upgrade/radvd/invariant/10-radvd-user +++ b/package/gluon-radvd/files/lib/gluon/upgrade/radvd/invariant/10-radvd-user @@ -1,5 +1,5 @@ -#!/bin/sh +#!/usr/bin/lua -. /lib/gluon/functions/users.sh +local users = require 'gluon.users' -add_user gluon-radvd 801 +users.add_user('gluon-radvd', 801, 100) From 0fd7ac17686988ce5bef9ffff388623283c0472a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 7 Jul 2014 20:47:09 +0200 Subject: [PATCH 287/453] gluon-core: add and use a sysctl Lua module --- .../lib/gluon/upgrade/core/invariant/013-reboot-on-oom | 6 +++--- package/gluon-core/files/usr/lib/lua/gluon/sysctl.lua | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 package/gluon-core/files/usr/lib/lua/gluon/sysctl.lua diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/invariant/013-reboot-on-oom b/package/gluon-core/files/lib/gluon/upgrade/core/invariant/013-reboot-on-oom index a457a9c3..48cfc5a8 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/invariant/013-reboot-on-oom +++ b/package/gluon-core/files/lib/gluon/upgrade/core/invariant/013-reboot-on-oom @@ -1,5 +1,5 @@ -#!/bin/sh +#!/usr/bin/lua -. /lib/gluon/functions/sysctl.sh +local sysctl = require 'gluon.sysctl' -sysctl_set vm.panic_on_oom 1 +sysctl.set('vm.panic_on_oom', 1) diff --git a/package/gluon-core/files/usr/lib/lua/gluon/sysctl.lua b/package/gluon-core/files/usr/lib/lua/gluon/sysctl.lua new file mode 100644 index 00000000..44b0c217 --- /dev/null +++ b/package/gluon-core/files/usr/lib/lua/gluon/sysctl.lua @@ -0,0 +1,8 @@ +local util = require 'gluon.util' + + +module 'gluon.sysctl' + +function set(name, value) + util.replace_prefix('/etc/sysctl.conf', name .. '=', name .. '=' .. value .. '\n') +end From 3dddafea21f84ebd0e3214b5daad7b46b6ae6a32 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 5 Jul 2014 21:25:14 +0200 Subject: [PATCH 288/453] gluon-core: convert network config script to lua --- .../gluon/upgrade/core/invariant/011-network | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/invariant/011-network b/package/gluon-core/files/lib/gluon/upgrade/core/invariant/011-network index be9d265e..10b16181 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/invariant/011-network +++ b/package/gluon-core/files/lib/gluon/upgrade/core/invariant/011-network @@ -1,11 +1,14 @@ -#!/bin/sh +#!/usr/bin/lua -. /lib/functions.sh -. /lib/gluon/functions/sysctl.sh +local uci = require('luci.model.uci').cursor() +local sysctl = require 'gluon.sysctl' -uci_set network wan peerdns '0' -uci_commit network +uci:set('network', 'wan', 'peerdns', '0') -sysctl_set net.ipv6.conf.all.accept_ra 0 -sysctl_set net.ipv6.conf.default.accept_ra 0 +uci:save('network') +uci:commit('network') + + +sysctl.set('net.ipv6.conf.all.accept_ra', 0) +sysctl.set('net.ipv6.conf.default.accept_ra', 0) From f82850fc374a4360c84cc51439de97d16f5845df Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 7 Jul 2014 22:22:48 +0200 Subject: [PATCH 289/453] gluon-mesh-batman-adv: convert mesh config upgrade script to Lua --- .../mesh-batman-adv/invariant/011-mesh | 99 +++++++++++-------- 1 file changed, 59 insertions(+), 40 deletions(-) diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh index 6bbf63f6..565505d2 100755 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/invariant/011-mesh @@ -1,45 +1,64 @@ -#!/bin/sh +#!/usr/bin/lua -. /lib/functions.sh -. /lib/gluon/functions/sysconfig.sh -. /lib/gluon/functions/sysctl.sh +local sysconfig = require 'gluon.sysconfig' +local sysctl = require 'gluon.sysctl' +local uci = require('luci.model.uci').cursor() -uci_remove batman-adv bat0 -uci_add batman-adv mesh bat0 -uci_set batman-adv bat0 orig_interval '5000' -uci_set batman-adv bat0 gw_mode 'client' -uci_commit batman-adv - -uci_set network client macaddr "$(sysconfig primary_mac)" -uci_set network client peerdns '1' - -uci_remove network bat0 -uci_add network interface bat0 -uci_set network bat0 ifname 'bat0' -uci_set network bat0 proto 'none' -uci_set network bat0 macaddr "$(sysconfig primary_mac)" -uci_commit network - -uci_remove firewall client -uci_add firewall zone client -uci_set firewall client name 'client' -uci add_list firewall.client.network='client' -uci_set firewall client input 'ACCEPT' -uci_set firewall client output 'ACCEPT' -uci_set firewall client forward 'REJECT' - -uci_commit firewall - -uci_set dhcp '@dnsmasq[0]' boguspriv '0' -uci_set dhcp '@dnsmasq[0]' localise_queries '0' -uci_set dhcp '@dnsmasq[0]' rebind_protection '0' - -uci_remove dhcp client -uci_add dhcp dhcp client -uci_set dhcp client interface 'client' -uci_set dhcp client ignore '1' -uci_commit dhcp +uci:delete('batman-adv', 'bat0') +uci:section('batman-adv', 'mesh', 'bat0', + { + orig_interval = 5000, + gw_mode = 'client', + } +) +uci:save('batman-adv') +uci:commit('batman-adv') -sysctl_set net.ipv6.conf.br-client.forwarding 0 +uci:set('network', 'client', 'macaddr', sysconfig.primary_mac) +uci:set('network', 'client', 'peerdns', 1) + +uci:delete('network', 'bat0') +uci:section('network', 'interface', 'bat0', + { + ifname = 'bat0', + proto = 'none', + macaddr = sysconfig.primary_mac, + } +) + +uci:save('network') +uci:commit('network') + +uci:delete('firewall', 'client') +uci:section('firewall', 'zone', 'client', + { + name = 'client', + network = {'client'}, + input = 'ACCEPT', + output = 'ACCEPT', + forward = 'REJECT', + } +) +uci:save('firewall') +uci:commit('firewall') + +local dnsmasq = uci:get_first('dhcp', 'dnsmasq') +uci:set('dhcp', dnsmasq, 'boguspriv', 0) +uci:set('dhcp', dnsmasq, 'localise_queries', 0) +uci:set('dhcp', dnsmasq, 'rebind_protection', 0) + +uci:delete('dhcp', 'client') +uci:section('dhcp', 'dhcp', 'client', + { + interface = 'client', + ignore = 1, + } +) + +uci:save('dhcp') +uci:commit('dhcp') + + +sysctl.set('net.ipv6.conf.br-client.forwarding', 0) From 81dc4f44e2c679be14d6ff8f486904ebf78079a4 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 7 Jul 2014 22:23:56 +0200 Subject: [PATCH 290/453] gluon-core: remove now unused sysctl.sh --- package/gluon-core/files/lib/gluon/functions/sysctl.sh | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 package/gluon-core/files/lib/gluon/functions/sysctl.sh diff --git a/package/gluon-core/files/lib/gluon/functions/sysctl.sh b/package/gluon-core/files/lib/gluon/functions/sysctl.sh deleted file mode 100644 index df1ea217..00000000 --- a/package/gluon-core/files/lib/gluon/functions/sysctl.sh +++ /dev/null @@ -1,4 +0,0 @@ -sysctl_set() { - sed -i "/^${1//./\.}=/d" /etc/sysctl.conf - echo "${1}=$2" >> /etc/sysctl.conf -} From 49febb43e7acdd84084b89153a79bffc5d262ac2 Mon Sep 17 00:00:00 2001 From: Daniel Ehlers Date: Fri, 4 Jul 2014 00:15:41 +0200 Subject: [PATCH 291/453] gluon-ath9k-workaround: Workaround for the ath9k wifi bug. Cron script which restarts wifi iff queues are marked stopped. This script also outputs some debug information to nail down the problem. --- package/gluon-ath9k-workaround/Makefile | 35 +++++++++++ .../files/lib/gluon/cron/ath9k-workaround | 1 + .../files/usr/sbin/ath9k-workaround | 61 +++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 package/gluon-ath9k-workaround/Makefile create mode 100644 package/gluon-ath9k-workaround/files/lib/gluon/cron/ath9k-workaround create mode 100755 package/gluon-ath9k-workaround/files/usr/sbin/ath9k-workaround diff --git a/package/gluon-ath9k-workaround/Makefile b/package/gluon-ath9k-workaround/Makefile new file mode 100644 index 00000000..bc809df8 --- /dev/null +++ b/package/gluon-ath9k-workaround/Makefile @@ -0,0 +1,35 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-ath9k-workaround +PKG_VERSION:=1 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-ath9k-workaround + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=ATH9K Workaround + DEPENDS:=+gluon-cron +endef + +define Package/gluon-ath9k-workaround/description + Gluon community wifi mesh firmware framework: ath9k wifi bug workaround +endef + +define Build/Prepare +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-ath9k-workaround/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-ath9k-workaround)) diff --git a/package/gluon-ath9k-workaround/files/lib/gluon/cron/ath9k-workaround b/package/gluon-ath9k-workaround/files/lib/gluon/cron/ath9k-workaround new file mode 100644 index 00000000..73552f9b --- /dev/null +++ b/package/gluon-ath9k-workaround/files/lib/gluon/cron/ath9k-workaround @@ -0,0 +1 @@ +* * * * * /usr/sbin/ath9k-workaround diff --git a/package/gluon-ath9k-workaround/files/usr/sbin/ath9k-workaround b/package/gluon-ath9k-workaround/files/usr/sbin/ath9k-workaround new file mode 100755 index 00000000..fccd218f --- /dev/null +++ b/package/gluon-ath9k-workaround/files/usr/sbin/ath9k-workaround @@ -0,0 +1,61 @@ +#!/bin/sh + +check_stopped_queue(){ + local device=$1 + grep -q -E 'stopped: 1$' "${device}/queues" +} + +get_tx_pkts() { + local device=$1 + grep 'TX-Pkts-All' "${device}/xmit" \ + | sed -e 's/^TX-Pkts-All: *\([0-9]*\) .*$/\1/' +} + +inc_fatal() { + local qs=$(cat /tmp/ath9k_workaround_trigger 2>/dev/null || echo 0) + expr ${qs} + 1 > /tmp/ath9k_workaround_trigger +} + +check_ath9k_bug() { + local device=$1 + check_stopped_queue $device && { + local tx_first=$(get_tx_pkts $device) + sleep 5 + check_stopped_queue $device && { + local tx_second=$(get_tx_pkts $device) + test $tx_first == $tx_second && { + local hostname=$(uci get -q system.@system[0].hostname) + echo "Hostname: ${hostname}" + echo "------------ Trigger workaround: ${tx_first} -> ${tx_second} ----------------" + echo "Model:" + cat /tmp/sysinfo/model + echo "Release:" + cat /lib/gluon/release + echo "Uptime:" + uptime + echo "Batctl Neighbours:" + batctl o | grep wlan0-1 + echo "Queues:" + cat $device/queues + echo "Reset:" + cat $device/reset + echo "------------ Interupts #1 ---------------------------------------------------" + cat $device/interrupt + sleep 10 + echo "------------ Interupts #2 ---------------------------------------------------" + cat $device/interrupt + echo "Batctl Neighbours:" + batctl o | grep wlan0-1 + + #BE queue hangs + inc_fatal + wifi + exit 1; + } + } + } +} + +for device in /sys/kernel/debug/ieee80211/phy*/ath9k ; do + check_ath9k_bug $device +done From bb699204cae2e73900e801aaa59ead03be20923a Mon Sep 17 00:00:00 2001 From: Daniel Ehlers Date: Mon, 7 Jul 2014 01:36:31 +0200 Subject: [PATCH 292/453] gluon-ath9k-workaround: bug reporting support If the `monitor` attribute in the site.conf is defined, the cron script is modifed to send debug informations, generated on bug detection, to given remote host and port, e.g.: "fda1:384a:74de:4242::2 8090" --- .../upgrade/ath9k-workaround/invariant/010-monitor | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 package/gluon-ath9k-workaround/files/lib/gluon/upgrade/ath9k-workaround/invariant/010-monitor diff --git a/package/gluon-ath9k-workaround/files/lib/gluon/upgrade/ath9k-workaround/invariant/010-monitor b/package/gluon-ath9k-workaround/files/lib/gluon/upgrade/ath9k-workaround/invariant/010-monitor new file mode 100755 index 00000000..ac696247 --- /dev/null +++ b/package/gluon-ath9k-workaround/files/lib/gluon/upgrade/ath9k-workaround/invariant/010-monitor @@ -0,0 +1,12 @@ +#!/usr/bin/lua + +local site = require 'gluon.site_config' +local uci = require 'luci.model.uci' + +local c = uci.cursor() + +local f = io.open('/lib/gluon/cron/ath9k-workaround','w') +if f and site.monitor ~= nil then + f:write('* * * * * /usr/sbin/ath9k-workaround | nc ' .. site.monitor) + f:close() +end From 941e39857233cfe444a4ecd6cf82ffbfafffd386 Mon Sep 17 00:00:00 2001 From: Daniel Ehlers Date: Tue, 8 Jul 2014 12:40:04 +0200 Subject: [PATCH 293/453] gluon-ath9k-workaround: Announce how often the workaround has been triggered. --- .../alfred/announce.d/network/ath9k_workaround_trigger | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 package/gluon-ath9k-workaround/files/lib/gluon/alfred/announce.d/network/ath9k_workaround_trigger diff --git a/package/gluon-ath9k-workaround/files/lib/gluon/alfred/announce.d/network/ath9k_workaround_trigger b/package/gluon-ath9k-workaround/files/lib/gluon/alfred/announce.d/network/ath9k_workaround_trigger new file mode 100644 index 00000000..a6ef7746 --- /dev/null +++ b/package/gluon-ath9k-workaround/files/lib/gluon/alfred/announce.d/network/ath9k_workaround_trigger @@ -0,0 +1,10 @@ +function trigger_count () + return tonumber(fs.readfile('/tmp/ath9k_workaround_trigger')) +end + +local ok, value = pcall(trigger_count) +if ok then + return value +else + return 0 +end From 7dd8d3ee1e858cf9d906d0a216e5867c3e666ce0 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Sun, 25 May 2014 11:21:49 +0200 Subject: [PATCH 294/453] gluon-luci-admin: fix wording --- .../files/usr/lib/lua/luci/view/admin/upgrade.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm index ad0901f9..8c9ea4f5 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm @@ -96,7 +96,7 @@ $Id$ <% elseif step == 3 then %>

Die Firmware wird jetzt aktualisiert. - UNTERBRECHE AUF KEINEN FALL DIE STROMVERSORGUNG! + UNTERBRICH AUF KEINEN FALL DIE STROMVERSORGUNG! Dieser Vorgang wird einige Minuten dauern. Anschließend startet das Gerät automatisch neu.

From 9a892e794864e2097d42cd985509416284c31222 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 9 Jul 2014 19:51:31 +0200 Subject: [PATCH 295/453] gluon-alfred: use lua-platform-info --- .../files/lib/gluon/alfred/announce.d/hardware/model | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/hardware/model b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/hardware/model index 242f72cc..aee3cd81 100644 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/hardware/model +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/hardware/model @@ -1 +1 @@ -return require('gluon.model').get_model() +return require('platform_info').get_model() From 9c53b705d5d7f8308e9c5a1e3b307f4b3ed753b4 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 9 Jul 2014 20:10:21 +0200 Subject: [PATCH 296/453] Remove all uses of gluon.model and model.sh --- package/gluon-autoupdater/Makefile | 2 +- .../files/usr/sbin/autoupdater | 3 +- package/gluon-setup-mode/Makefile | 2 +- .../setup-mode/invariant/011-setup-ifname | 28 +++++++++---------- package/gluon-status-page/Makefile | 2 +- .../lib/gluon/status-page/www/cgi-bin/status | 4 +-- 6 files changed, 19 insertions(+), 22 deletions(-) diff --git a/package/gluon-autoupdater/Makefile b/package/gluon-autoupdater/Makefile index a885a0d0..3e555a0b 100644 --- a/package/gluon-autoupdater/Makefile +++ b/package/gluon-autoupdater/Makefile @@ -11,7 +11,7 @@ include $(GLUONDIR)/include/package.mk define Package/gluon-autoupdater SECTION:=gluon CATEGORY:=Gluon - DEPENDS:=+gluon-core +gluon-cron +opkg +ecdsautils +!BUSYBOX_CONFIG_SHA512SUM:coreutils-sha512sum + DEPENDS:=+gluon-core +gluon-cron +lua-platform-info +opkg +ecdsautils +!BUSYBOX_CONFIG_SHA512SUM:coreutils-sha512sum TITLE:=Automatically update firmware endef diff --git a/package/gluon-autoupdater/files/usr/sbin/autoupdater b/package/gluon-autoupdater/files/usr/sbin/autoupdater index cd61eb49..0919f5ff 100755 --- a/package/gluon-autoupdater/files/usr/sbin/autoupdater +++ b/package/gluon-autoupdater/files/usr/sbin/autoupdater @@ -165,8 +165,7 @@ autoupdate() { trap 'echo Signal ignored.' INT TERM PIPE -. /lib/gluon/functions/model.sh -my_model="$(get_model | tr '[A-Z]' '[a-z]' | sed -r 's/[^a-z0-9]+/-/g;s/-$//')" +my_model="$(lua -e 'print(require("platform_info").get_image_name())')" if [ ! -f "$VERSION_FILE" ]; then echo "Couldn't determine firmware version!" >&2 diff --git a/package/gluon-setup-mode/Makefile b/package/gluon-setup-mode/Makefile index e8d4fe52..9fda3d9a 100644 --- a/package/gluon-setup-mode/Makefile +++ b/package/gluon-setup-mode/Makefile @@ -14,7 +14,7 @@ define Package/gluon-setup-mode SECTION:=gluon CATEGORY:=Gluon TITLE:=Setup mode - DEPENDS:=+uhttpd +dnsmasq +ip + DEPENDS:=+gluon-core +lua-platform-info +uhttpd +dnsmasq +ip endef define Package/gluon-setup-mode/description diff --git a/package/gluon-setup-mode/files/lib/gluon/upgrade/setup-mode/invariant/011-setup-ifname b/package/gluon-setup-mode/files/lib/gluon/upgrade/setup-mode/invariant/011-setup-ifname index f9f33a70..29757cdd 100755 --- a/package/gluon-setup-mode/files/lib/gluon/upgrade/setup-mode/invariant/011-setup-ifname +++ b/package/gluon-setup-mode/files/lib/gluon/upgrade/setup-mode/invariant/011-setup-ifname @@ -1,20 +1,18 @@ -#!/bin/sh +#!/usr/bin/lua -. /lib/gluon/functions/sysconfig.sh -. /lib/gluon/functions/model.sh +local platform_info = require 'platform_info' +local sysconfig = require 'gluon.sysconfig' -sysconfig_isset setup_ifname && exit 0 +if sysconfig.setup_ifname then + os.exit(0) +end +if platform_info.get_board_name() == 'nanostation-m' then + sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.wan_ifname or sysconfig.lan_ifname +else + sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.lan_ifname or sysconfig.wan_ifname +end -case "$(get_board_name)" in - nanostation-m) - sysconfig_set setup_ifname "$(sysconfig config_ifname || sysconfig wan_ifname || sysconfig lan_ifname)" - ;; - *) - sysconfig_set setup_ifname "$(sysconfig config_ifname || sysconfig lan_ifname || sysconfig wan_ifname)" - ;; -esac - -# Remove the old sysconfig setting -sysconfig_unset config_ifname +-- Remove the old sysconfig setting +sysconfig.config_ifname = nil diff --git a/package/gluon-status-page/Makefile b/package/gluon-status-page/Makefile index d0e9d488..db7cc7bd 100644 --- a/package/gluon-status-page/Makefile +++ b/package/gluon-status-page/Makefile @@ -12,7 +12,7 @@ define Package/gluon-status-page SECTION:=gluon CATEGORY:=Gluon TITLE:=Adds a status page showing information about the node. - DEPENDS:=+gluon-core +uhttpd + DEPENDS:=+gluon-core +lua-platform-info +uhttpd endef define Package/gluon-status-page/description diff --git a/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status b/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status index 636a7aa7..e25d460f 100755 --- a/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status +++ b/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status @@ -1,6 +1,6 @@ #!/bin/sh -. /lib/gluon/functions/model.sh +model="$(lua -e 'print(require("platform_info").get_model())')" escape_html() { sed 's/&/\&/g; s//\>/g; s/"/\"/g; s/'"'"'/\'/g' @@ -27,7 +27,7 @@ echo "

$(cat /proc/sys/kernel/hostname)

" echo "
"
 
-echo "Model: $(get_model | escape_html)"
+echo "Model: $model" | escape_html
 echo "Firmware release: $(cat /lib/gluon/release | escape_html)"
 echo
 

From 7773afdc18910386608d30686dc5e54d77a04398 Mon Sep 17 00:00:00 2001
From: Matthias Schiffer 
Date: Wed, 9 Jul 2014 20:12:27 +0200
Subject: [PATCH 297/453] gluon-core: remove model.sh and model.lua

---
 .../files/lib/gluon/functions/model.sh        | 22 -------------------
 .../files/usr/lib/lua/gluon/model.lua         | 21 ------------------
 2 files changed, 43 deletions(-)
 delete mode 100644 package/gluon-core/files/lib/gluon/functions/model.sh
 delete mode 100644 package/gluon-core/files/usr/lib/lua/gluon/model.lua

diff --git a/package/gluon-core/files/lib/gluon/functions/model.sh b/package/gluon-core/files/lib/gluon/functions/model.sh
deleted file mode 100644
index 2d2f99ce..00000000
--- a/package/gluon-core/files/lib/gluon/functions/model.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-. /lib/functions.sh
-
-# This must be generalized as soon as we support other OpenWRT archs
-. /lib/ar71xx.sh
-
-
-ar71xx_board_detect
-
-local board_name="$AR71XX_BOARD_NAME"
-local model="$AR71XX_MODEL"
-
-get_arch() {
-	echo 'ar71xx'
-}
-
-get_board_name() {
-	echo "$board_name"
-}
-
-get_model() {
-	echo "$model"
-}
diff --git a/package/gluon-core/files/usr/lib/lua/gluon/model.lua b/package/gluon-core/files/usr/lib/lua/gluon/model.lua
deleted file mode 100644
index a09c0672..00000000
--- a/package/gluon-core/files/usr/lib/lua/gluon/model.lua
+++ /dev/null
@@ -1,21 +0,0 @@
-local util = require 'luci.util'
-
-
-module 'gluon.model'
-
-
--- This must be generalized as soon as we support other OpenWrt archs
-local board_name, model = util.exec('. /lib/functions.sh; . /lib/ar71xx.sh; ar71xx_board_detect; echo "$AR71XX_BOARD_NAME"; echo "$AR71XX_MODEL"'):match('([^\n]+)\n([^\n]+)')
-
-
-function get_arch()
-	return 'ar71xx'
-end
-
-function get_board_name()
-	return board_name
-end
-
-function get_model()
-	return model
-end

From f73d727ae6d5bc6503a0d6cf7a7c5105af47299c Mon Sep 17 00:00:00 2001
From: Matthias Schiffer 
Date: Thu, 10 Jul 2014 23:44:06 +0200
Subject: [PATCH 298/453] Remove all remaining uses of sysconfig.sh

---
 package/gluon-autoupdater/Makefile            |  2 +-
 package/gluon-core/Makefile                   |  2 +-
 .../gluon/upgrade/core/initial/001-sysconfig  | 70 +++++++++----------
 .../upgrade/core/initial/011-gluon-network    | 56 ++++++++-------
 .../gluon/upgrade/core/legacy/001-sysconfig   | 67 +++++++++---------
 .../upgrade/core/legacy/011-gluon-network     | 38 +++++-----
 .../upgrade/mesh-batman-adv/initial/010-mesh  | 32 +++++----
 package/gluon-setup-mode/Makefile             |  2 +-
 .../files/etc/init.d/gluon-setup-mode         |  4 +-
 package/gluon-status-page/Makefile            |  2 +-
 10 files changed, 145 insertions(+), 130 deletions(-)

diff --git a/package/gluon-autoupdater/Makefile b/package/gluon-autoupdater/Makefile
index 3e555a0b..a885a0d0 100644
--- a/package/gluon-autoupdater/Makefile
+++ b/package/gluon-autoupdater/Makefile
@@ -11,7 +11,7 @@ include $(GLUONDIR)/include/package.mk
 define Package/gluon-autoupdater
   SECTION:=gluon
   CATEGORY:=Gluon
-  DEPENDS:=+gluon-core +gluon-cron +lua-platform-info +opkg +ecdsautils +!BUSYBOX_CONFIG_SHA512SUM:coreutils-sha512sum
+  DEPENDS:=+gluon-core +gluon-cron +opkg +ecdsautils +!BUSYBOX_CONFIG_SHA512SUM:coreutils-sha512sum
   TITLE:=Automatically update firmware
 endef
 
diff --git a/package/gluon-core/Makefile b/package/gluon-core/Makefile
index 5dbaee00..27babd75 100644
--- a/package/gluon-core/Makefile
+++ b/package/gluon-core/Makefile
@@ -12,7 +12,7 @@ define Package/gluon-core
   SECTION:=gluon
   CATEGORY:=Gluon
   TITLE:=Base files of Gluon
-  DEPENDS:=+gluon-config +luci-lib-core +odhcp6c
+  DEPENDS:=+gluon-config +lua-platform-info +luci-lib-core +odhcp6c
 endef
 
 define Package/gluon-core/description
diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig b/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig
index afabb2df..1e6c56d8 100755
--- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig
+++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig
@@ -1,42 +1,42 @@
-#!/bin/sh
+#!/usr/bin/lua
 
-. /lib/gluon/functions/sysconfig.sh
-. /lib/ar71xx.sh
+local sysconfig = require 'gluon.sysconfig'
+local gluon_util = require 'gluon.util'
+
+local fs = require 'luci.fs'
+local uci = require('luci.model.uci').cursor()
+local util = require 'luci.util'
+
+local platform_info = require 'platform_info'
 
 
-get_primary_mac() {
-	case "$(ar71xx_board_name)" in
-		tl-wdr3600|tl-wdr4300)
-			cat /sys/class/ieee80211/phy1/macaddress
-			;;
-		*)
-			cat /sys/class/ieee80211/phy0/macaddress
-			;;
-	esac
-}
+local board_name = platform_info.get_board_name()
 
-iface_exists() {
-	local name="$1"
-	ip link show dev "${name//.*/}" >/dev/null 2>&1
-}
 
-case "$(ar71xx_board_name)" in
-	nanostation-m)
-		# It's more convenient to swap the ports for these devices so WAN is the PoE port
-		lan_ifname="$(uci get network.wan.ifname)"
-		wan_ifname="$(uci get network.lan.ifname)"
-		;;
-	*)
-		lan_ifname="$(uci get network.lan.ifname)"
-		wan_ifname="$(uci get network.wan.ifname)"
-		;;
-esac
-
-if [ -n "$wan_ifname" ] && iface_exists "$wan_ifname"; then
-	[ -z "$lan_ifname" ] || sysconfig_set lan_ifname "$lan_ifname"
-	sysconfig_set wan_ifname "$wan_ifname"
+if board_name == 'tl-wdr3600' or board_name == 'tl-wdr4300' then
+   sysconfig.primary_mac = util.trim(fs.readfile('/sys/class/ieee80211/phy1/macaddress'))
 else
-	sysconfig_set wan_ifname "$lan_ifname"
-fi
+   sysconfig.primary_mac = util.trim(fs.readfile('/sys/class/ieee80211/phy0/macaddress'))
+end
 
-sysconfig_set primary_mac "$(get_primary_mac)"
+
+local function iface_exists(name)
+   return (gluon_util.exec('ip', 'link', 'show', 'dev', (name:gsub('%..*$', ''))) == 0)
+end
+
+
+local lan_ifname = uci:get('network', 'lan', 'ifname')
+local wan_ifname = uci:get('network', 'wan', 'ifname')
+
+
+if board_name == 'nanostation-m' then
+   lan_ifname, wan_ifname = wan_ifname, lan_ifname
+end
+
+
+if wan_ifname and iface_exists(wan_ifname) then
+   sysconfig.wan_ifname = wan_ifname
+   sysconfig.lan_ifname = lan_ifname
+else
+   sysconfig.wan_ifname = lan_ifname
+end
diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network
index 17ca50ee..1bc3514f 100755
--- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network
+++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network
@@ -1,32 +1,36 @@
-#!/bin/sh
+#!/usr/bin/lua
+
+local sysconfig = require 'gluon.sysconfig'
+
+local uci = require('luci.model.uci').cursor()
+local util = require 'luci.util'
+
+local nixio = require 'nixio'
+local platform_info = require 'platform_info'
 
 
-. /lib/functions.sh
-. /lib/gluon/functions/sysconfig.sh
-. /lib/ar71xx.sh
+uci:delete('network', 'lan')
+uci:delete('network', 'wan')
+
+uci:section('network', 'interface', 'wan',
+	    {
+	       ifname = sysconfig.wan_ifname,
+	       type = 'bridge',
+	       proto = 'dhcp',
+	    }
+)
 
 
-uci_remove network lan
-uci_remove network wan
+if util.contains({'tl-wr1043nd', 'tl-wdr3600', 'tl-wdr4300'}, platform_info.get_board_name()) then
+   -- fix up duplicate mac addresses
+   local m1, m2, m3, m4, m5, m6 = string.match(sysconfig.primary_mac, '(%x%x):(%x%x):(%x%x):(%x%x):(%x%x):(%x%x)')
+   m1 = nixio.bit.bor(tonumber(m1, 16), 0x02)
+   m4 = (tonumber(m4, 16)+1) % 0x100
+   m6 = (tonumber(m6, 16)+1) % 0x100
+   local wanaddr = string.format('%02x:%s:%s:%02x:%s:%02x', m1, m2, m3, m4, m5, m6)
 
-uci_add network interface wan
-uci_set network wan ifname "$(sysconfig wan_ifname)"
-uci_set network wan type 'bridge'
-uci_set network wan proto 'dhcp'
+   uci:set('network', 'wan', 'macaddr', wanaddr)
+end
 
-
-case "$(ar71xx_board_name)" in
-tl-wr1043nd|\
-tl-wdr3600|\
-tl-wdr4300) # fix up duplicate mac addresses
-	local mainaddr=$(sysconfig primary_mac)
-	local oIFS="$IFS"; IFS=":"; set -- $mainaddr; IFS="$oIFS"
-	local b2mask=0x02
-
-	local wanaddr=$(printf "%02x:%s:%s:%02x:%s:%02x" $(( 0x$1 | $b2mask )) $2 $3 $(( (0x$4 + 1) % 0x100 )) $5 $(( (0x$6 + 1) % 0x100 )) )
-
-	uci_set network wan macaddr "$wanaddr"
-	;;
-esac
-
-uci_commit network
+uci:save('network')
+uci:commit('network')
diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/001-sysconfig b/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/001-sysconfig
index 4fb4a39a..52e91a3b 100755
--- a/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/001-sysconfig
+++ b/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/001-sysconfig
@@ -1,39 +1,42 @@
-#!/bin/sh
+#!/usr/bin/lua
 
-. /lib/gluon/functions/sysconfig.sh
-. /lib/ar71xx.sh
+local sysconfig = require 'gluon.sysconfig'
+local gluon_util = require 'gluon.util'
+local site = require 'gluon.site_config'
+
+local fs = require 'luci.fs'
+local uci = require('luci.model.uci').cursor()
+local util = require 'luci.util'
+
+local platform_info = require 'platform_info'
 
 
-get_primary_mac() {
-    case "$(ar71xx_board_name)" in
-	tl-wdr3600|tl-wdr4300)
-	    cat /sys/class/ieee80211/phy1/macaddress
-	    ;;
-	*)
-	    cat /sys/class/ieee80211/phy0/macaddress
-	    ;;
-    esac
-}
-
-iface_exists() {
-	local name="$1"
-	ip link show dev "${name//.*/}" >/dev/null 2>&1
-}
-
-remove_bat0() {
-	sed -r -e 's/(^| )bat0( |$)/ /g' -e 's/^ | $//g'
-}
+local board_name = platform_info.get_board_name()
 
 
-mesh_section="$(lua -e 'print(require("gluon.site_config").legacy.mesh_ifname)')"
-mesh_ifname="$(uci get "network.${mesh_section}.ifname" | remove_bat0)"
-wan_ifname="$(uci get network.wan.ifname)"
-
-if [ -n "$wan_ifname" ] && iface_exists "$wan_ifname"; then
-	[ -z "$mesh_ifname" ] || sysconfig_set lan_ifname "$mesh_ifname"
-	sysconfig_set wan_ifname "$wan_ifname"
+if board_name == 'tl-wdr3600' or board_name == 'tl-wdr4300' then
+   sysconfig.primary_mac = util.trim(fs.readfile('/sys/class/ieee80211/phy1/macaddress'))
 else
-	sysconfig_set wan_ifname "$mesh_ifname"
-fi
+   sysconfig.primary_mac = util.trim(fs.readfile('/sys/class/ieee80211/phy0/macaddress'))
+end
 
-sysconfig_set primary_mac "$(get_primary_mac)"
+
+local function iface_exists(name)
+   return (gluon_util.exec('ip', 'link', 'show', 'dev', (name:gsub('%..*$', ''))) == 0)
+end
+
+local function remove_bat0(iface)
+   return util.trim(string.gsub(' ' .. iface .. ' ', ' bat0 ', ' '))
+end
+
+
+local lan_ifname = remove_bat0(uci:get('network', site.legacy.mesh_ifname, 'ifname'))
+local wan_ifname = uci:get('network', 'wan', 'ifname')
+
+
+if wan_ifname and iface_exists(wan_ifname) then
+   sysconfig.wan_ifname = wan_ifname
+   sysconfig.lan_ifname = lan_ifname
+else
+   sysconfig.wan_ifname = lan_ifname
+end
diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/011-gluon-network b/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/011-gluon-network
index dd9c6ca5..79b63996 100755
--- a/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/011-gluon-network
+++ b/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/011-gluon-network
@@ -1,22 +1,24 @@
-#!/bin/sh
+#!/usr/bin/lua
+
+local sysconfig = require 'gluon.sysconfig'
+
+local uci = require('luci.model.uci').cursor()
+local util = require 'luci.util'
+
+local nixio = require 'nixio'
+local platform_info = require 'platform_info'
 
 
-. /lib/functions.sh
-. /lib/gluon/functions/sysconfig.sh
+if util.contains({'tl-wr1043nd', 'tl-wdr3600', 'tl-wdr4300'}, platform_info.get_board_name()) then
+   -- fix up duplicate mac addresses
+   local m1, m2, m3, m4, m5, m6 = string.match(sysconfig.primary_mac, '(%x%x):(%x%x):(%x%x):(%x%x):(%x%x):(%x%x)')
+   m1 = nixio.bit.bor(tonumber(m1, 16), 0x02)
+   m4 = (tonumber(m4, 16)+1) % 0x100
+   m6 = (tonumber(m6, 16)+1) % 0x100
+   local wanaddr = string.format('%02x:%s:%s:%02x:%s:%02x', m1, m2, m3, m4, m5, m6)
 
+   uci:set('network', 'wan', 'macaddr', wanaddr)
+end
 
-case "$(ar71xx_board_name)" in
-tl-wr1043nd|\
-tl-wdr3600|\
-tl-wdr4300) # fix up duplicate mac addresses
-	local mainaddr=$(sysconfig primary_mac)
-	local oIFS="$IFS"; IFS=":"; set -- $mainaddr; IFS="$oIFS"
-	local b2mask=0x02
-
-	local wanaddr=$(printf "%02x:%s:%s:%02x:%s:%02x" $(( 0x$1 | $b2mask )) $2 $3 $(( (0x$4 + 1) % 0x100 )) $5 $(( (0x$6 + 1) % 0x100 )) )
-
-	uci_set network wan macaddr "$wanaddr"
-	;;
-esac
-
-uci_commit network
+uci:save('network')
+uci:commit('network')
diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh
index 42206d00..5b275099 100755
--- a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh
+++ b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh
@@ -1,18 +1,26 @@
-#!/bin/sh
+#!/usr/bin/lua
 
-. /lib/functions.sh
-. /lib/gluon/functions/sysconfig.sh
+local sysconfig = require 'gluon.sysconfig'
+local uci = require('luci.model.uci').cursor()
 
-lan_ifname="$(sysconfig lan_ifname)"
 
-uci_add network interface client
+local ifname
 
-if [ -n "$lan_ifname" ]; then
-	uci_set network client ifname "$lan_ifname bat0"
+if sysconfig.lan_ifname then
+   ifname = sysconfig.lan_ifname .. ' bat0'
 else
-	uci_set network client ifname "bat0"
-fi
+   ifname = 'bat0'
+end
 
-uci_set network client type 'bridge'
-uci_set network client proto 'dhcpv6'
-uci_set network client reqprefix 'no'
+
+uci:section('network', 'interface', 'client',
+	    {
+	       ifname = ifname,
+	       type = 'bridge',
+	       proto = 'dhcpv6',
+	       reqprefix = 'no',
+	    }
+)
+
+uci:save('network')
+uci:commit('network')
diff --git a/package/gluon-setup-mode/Makefile b/package/gluon-setup-mode/Makefile
index 9fda3d9a..39952ddd 100644
--- a/package/gluon-setup-mode/Makefile
+++ b/package/gluon-setup-mode/Makefile
@@ -14,7 +14,7 @@ define Package/gluon-setup-mode
   SECTION:=gluon
   CATEGORY:=Gluon
   TITLE:=Setup mode
-  DEPENDS:=+gluon-core +lua-platform-info +uhttpd +dnsmasq +ip
+  DEPENDS:=+gluon-core +uhttpd +dnsmasq +ip
 endef
 
 define Package/gluon-setup-mode/description
diff --git a/package/gluon-setup-mode/files/etc/init.d/gluon-setup-mode b/package/gluon-setup-mode/files/etc/init.d/gluon-setup-mode
index 6abff8eb..53f18360 100755
--- a/package/gluon-setup-mode/files/etc/init.d/gluon-setup-mode
+++ b/package/gluon-setup-mode/files/etc/init.d/gluon-setup-mode
@@ -35,7 +35,7 @@ setup_network() {
 		config_foreach delete_interface interface
 
 		uci_add network interface setup
-		uci_set network setup ifname "$(sysconfig setup_ifname)"
+		uci_set network setup ifname "$(lua -e 'print(require("gluon.sysconfig").setup_ifname)')"
 		uci_set network setup type 'bridge'
 		uci_set network setup proto 'static'
 		uci_set network setup ipaddr "$SETUP_MODE_ADDR"
@@ -55,8 +55,6 @@ setup_network() {
 }
 
 start() {
-	. /lib/gluon/functions/sysconfig.sh
-
 	enable=0
 	config_load gluon-setup-mode
 	config_foreach check_enable setup_mode
diff --git a/package/gluon-status-page/Makefile b/package/gluon-status-page/Makefile
index db7cc7bd..d0e9d488 100644
--- a/package/gluon-status-page/Makefile
+++ b/package/gluon-status-page/Makefile
@@ -12,7 +12,7 @@ define Package/gluon-status-page
   SECTION:=gluon
   CATEGORY:=Gluon
   TITLE:=Adds a status page showing information about the node.
-  DEPENDS:=+gluon-core +lua-platform-info +uhttpd
+  DEPENDS:=+gluon-core +uhttpd
 endef
 
 define Package/gluon-status-page/description

From 1a52c6bdf207bd31e4a76c330ed919c514111cb8 Mon Sep 17 00:00:00 2001
From: Matthias Schiffer 
Date: Thu, 10 Jul 2014 23:45:03 +0200
Subject: [PATCH 299/453] gluon-core: remove sysconfig.sh

---
 .../files/lib/gluon/functions/sysconfig.sh     | 18 ------------------
 1 file changed, 18 deletions(-)
 delete mode 100644 package/gluon-core/files/lib/gluon/functions/sysconfig.sh

diff --git a/package/gluon-core/files/lib/gluon/functions/sysconfig.sh b/package/gluon-core/files/lib/gluon/functions/sysconfig.sh
deleted file mode 100644
index 60b410f2..00000000
--- a/package/gluon-core/files/lib/gluon/functions/sysconfig.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-SYSCONFIGDIR=/lib/gluon/core/sysconfig
-
-
-sysconfig() {
-	cat "$SYSCONFIGDIR/$1" 2>/dev/null
-}
-
-sysconfig_isset() {
-	test -e "$SYSCONFIGDIR/$1"
-}
-
-sysconfig_set() {
-	echo -n "$2" > "$SYSCONFIGDIR/$1"
-}
-
-sysconfig_unset() {
-	rm -f "$SYSCONFIGDIR/$1"
-}

From 6f1777b07236c42e2303eae00382c05e4399bc2f Mon Sep 17 00:00:00 2001
From: Matthias Schiffer 
Date: Fri, 11 Jul 2014 11:36:53 +0200
Subject: [PATCH 300/453] gluon-core: add platform utility module

---
 .../files/usr/lib/lua/gluon/platform.lua      | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 package/gluon-core/files/usr/lib/lua/gluon/platform.lua

diff --git a/package/gluon-core/files/usr/lib/lua/gluon/platform.lua b/package/gluon-core/files/usr/lib/lua/gluon/platform.lua
new file mode 100644
index 00000000..3d56f081
--- /dev/null
+++ b/package/gluon-core/files/usr/lib/lua/gluon/platform.lua
@@ -0,0 +1,31 @@
+local platform_info = require 'platform_info'
+local util = require 'luci.util'
+
+local setmetatable = setmetatable
+
+
+module 'gluon.platform'
+
+setmetatable(_M,
+	     {
+		__index = platform_info,
+	     }
+)
+
+function match(target, subtarget, boards)
+   if get_target() ~= target then
+      return false
+   end
+
+   if get_subtarget() ~= subtarget then
+      return false
+   end
+
+   if not util.contains(boards, get_board_name()) then
+      return false
+   end
+
+   return true
+end
+
+

From 58ced87261ab0eaa7211d8404bbb2d97e6c6fa38 Mon Sep 17 00:00:00 2001
From: Matthias Schiffer 
Date: Fri, 11 Jul 2014 12:11:47 +0200
Subject: [PATCH 301/453] Use nicer platform match

---
 .../files/lib/gluon/upgrade/core/initial/001-sysconfig | 10 +++-------
 .../lib/gluon/upgrade/core/initial/011-gluon-network   |  4 ++--
 .../files/lib/gluon/upgrade/core/legacy/001-sysconfig  |  9 ++-------
 .../lib/gluon/upgrade/core/legacy/011-gluon-network    |  4 ++--
 .../upgrade/setup-mode/invariant/011-setup-ifname      |  4 ++--
 5 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig b/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig
index 1e6c56d8..ea5ef0e2 100755
--- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig
+++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig
@@ -2,18 +2,14 @@
 
 local sysconfig = require 'gluon.sysconfig'
 local gluon_util = require 'gluon.util'
+local platform = require 'gluon.platform'
 
 local fs = require 'luci.fs'
 local uci = require('luci.model.uci').cursor()
 local util = require 'luci.util'
 
-local platform_info = require 'platform_info'
 
-
-local board_name = platform_info.get_board_name()
-
-
-if board_name == 'tl-wdr3600' or board_name == 'tl-wdr4300' then
+if platform.match('ar71xx', 'generic', {'tl-wdr3600', 'tl-wdr4300'}) then
    sysconfig.primary_mac = util.trim(fs.readfile('/sys/class/ieee80211/phy1/macaddress'))
 else
    sysconfig.primary_mac = util.trim(fs.readfile('/sys/class/ieee80211/phy0/macaddress'))
@@ -29,7 +25,7 @@ local lan_ifname = uci:get('network', 'lan', 'ifname')
 local wan_ifname = uci:get('network', 'wan', 'ifname')
 
 
-if board_name == 'nanostation-m' then
+if platform.match('ar71xx', 'generic', {'nanostation-m'}) then
    lan_ifname, wan_ifname = wan_ifname, lan_ifname
 end
 
diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network
index 1bc3514f..851a8dc4 100755
--- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network
+++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network
@@ -1,12 +1,12 @@
 #!/usr/bin/lua
 
 local sysconfig = require 'gluon.sysconfig'
+local platform = require 'gluon.platform'
 
 local uci = require('luci.model.uci').cursor()
 local util = require 'luci.util'
 
 local nixio = require 'nixio'
-local platform_info = require 'platform_info'
 
 
 uci:delete('network', 'lan')
@@ -21,7 +21,7 @@ uci:section('network', 'interface', 'wan',
 )
 
 
-if util.contains({'tl-wr1043nd', 'tl-wdr3600', 'tl-wdr4300'}, platform_info.get_board_name()) then
+if platform.match('ar71xx', 'generic', {'tl-wr1043nd', 'tl-wdr3600', 'tl-wdr4300'}) then
    -- fix up duplicate mac addresses
    local m1, m2, m3, m4, m5, m6 = string.match(sysconfig.primary_mac, '(%x%x):(%x%x):(%x%x):(%x%x):(%x%x):(%x%x)')
    m1 = nixio.bit.bor(tonumber(m1, 16), 0x02)
diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/001-sysconfig b/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/001-sysconfig
index 52e91a3b..769309fb 100755
--- a/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/001-sysconfig
+++ b/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/001-sysconfig
@@ -2,19 +2,14 @@
 
 local sysconfig = require 'gluon.sysconfig'
 local gluon_util = require 'gluon.util'
-local site = require 'gluon.site_config'
+local platform = require 'gluon.platform'
 
 local fs = require 'luci.fs'
 local uci = require('luci.model.uci').cursor()
 local util = require 'luci.util'
 
-local platform_info = require 'platform_info'
 
-
-local board_name = platform_info.get_board_name()
-
-
-if board_name == 'tl-wdr3600' or board_name == 'tl-wdr4300' then
+if platform.match('ar71xx', 'generic', {'tl-wdr3600', 'tl-wdr4300'}) then
    sysconfig.primary_mac = util.trim(fs.readfile('/sys/class/ieee80211/phy1/macaddress'))
 else
    sysconfig.primary_mac = util.trim(fs.readfile('/sys/class/ieee80211/phy0/macaddress'))
diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/011-gluon-network b/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/011-gluon-network
index 79b63996..b6294371 100755
--- a/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/011-gluon-network
+++ b/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/011-gluon-network
@@ -1,15 +1,15 @@
 #!/usr/bin/lua
 
 local sysconfig = require 'gluon.sysconfig'
+local platform = require 'gluon.platform'
 
 local uci = require('luci.model.uci').cursor()
 local util = require 'luci.util'
 
 local nixio = require 'nixio'
-local platform_info = require 'platform_info'
 
 
-if util.contains({'tl-wr1043nd', 'tl-wdr3600', 'tl-wdr4300'}, platform_info.get_board_name()) then
+if platform.match('ar71xx', 'generic', {'tl-wr1043nd', 'tl-wdr3600', 'tl-wdr4300'}) then
    -- fix up duplicate mac addresses
    local m1, m2, m3, m4, m5, m6 = string.match(sysconfig.primary_mac, '(%x%x):(%x%x):(%x%x):(%x%x):(%x%x):(%x%x)')
    m1 = nixio.bit.bor(tonumber(m1, 16), 0x02)
diff --git a/package/gluon-setup-mode/files/lib/gluon/upgrade/setup-mode/invariant/011-setup-ifname b/package/gluon-setup-mode/files/lib/gluon/upgrade/setup-mode/invariant/011-setup-ifname
index 29757cdd..f1fef490 100755
--- a/package/gluon-setup-mode/files/lib/gluon/upgrade/setup-mode/invariant/011-setup-ifname
+++ b/package/gluon-setup-mode/files/lib/gluon/upgrade/setup-mode/invariant/011-setup-ifname
@@ -1,6 +1,6 @@
 #!/usr/bin/lua
 
-local platform_info = require 'platform_info'
+local platform = require 'gluon.platform'
 local sysconfig = require 'gluon.sysconfig'
 
 
@@ -8,7 +8,7 @@ if sysconfig.setup_ifname then
    os.exit(0)
 end
 
-if platform_info.get_board_name() == 'nanostation-m' then
+if platform.match('ar71xx', 'generic', {'nanostation-m'}) then
    sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.wan_ifname or sysconfig.lan_ifname
 else
    sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.lan_ifname or sysconfig.wan_ifname

From 4d80b7a62d427609eab79e2b8c050780f590788b Mon Sep 17 00:00:00 2001
From: Matthias Schiffer 
Date: Fri, 11 Jul 2014 14:06:42 +0200
Subject: [PATCH 302/453] Split parts not Gluon-specific out of
 gluon-autoupdater

---
 package/gluon-autoupdater/Makefile            |   4 +-
 package/gluon-autoupdater/README.md           |  35 ----
 .../files/etc/config/autoupdater              |  24 ---
 .../files/usr/sbin/autoupdater                | 186 ------------------
 package/gluon-autoupdater/manifest.sample     |   8 -
 5 files changed, 2 insertions(+), 255 deletions(-)
 delete mode 100644 package/gluon-autoupdater/README.md
 delete mode 100644 package/gluon-autoupdater/files/etc/config/autoupdater
 delete mode 100755 package/gluon-autoupdater/files/usr/sbin/autoupdater
 delete mode 100644 package/gluon-autoupdater/manifest.sample

diff --git a/package/gluon-autoupdater/Makefile b/package/gluon-autoupdater/Makefile
index a885a0d0..b33bada9 100644
--- a/package/gluon-autoupdater/Makefile
+++ b/package/gluon-autoupdater/Makefile
@@ -1,7 +1,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=gluon-autoupdater
-PKG_VERSION:=3
+PKG_VERSION:=4
 PKG_RELEASE:=$(GLUON_BRANCH)
 
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
@@ -11,7 +11,7 @@ include $(GLUONDIR)/include/package.mk
 define Package/gluon-autoupdater
   SECTION:=gluon
   CATEGORY:=Gluon
-  DEPENDS:=+gluon-core +gluon-cron +opkg +ecdsautils +!BUSYBOX_CONFIG_SHA512SUM:coreutils-sha512sum
+  DEPENDS:=+gluon-core +gluon-cron +autoupdater
   TITLE:=Automatically update firmware
 endef
 
diff --git a/package/gluon-autoupdater/README.md b/package/gluon-autoupdater/README.md
deleted file mode 100644
index 896d1574..00000000
--- a/package/gluon-autoupdater/README.md
+++ /dev/null
@@ -1,35 +0,0 @@
-Models
-======
-
-Ubiquity
---------
-
-ubiquity-nanostation-m (dual ethernet)
-ubiquity-bullet-m (single ethernet: Bullet M, NanoStation Loco M, PicoStation M)
-
-TP-Link
--------
-
-tp-link-tl-mr3020
-tp-link-tl-mr3040
-tp-link-tl-mr3220
-tp-link-tl-mr3420
-tp-link-tl-wdr3600-v1
-tp-link-tl-wdr4300-v1
-tp-link-tl-wdr4310-v1
-tp-link-tl-wr740n-nd-v1
-tp-link-tl-wr740n-nd-v3
-tp-link-tl-wr740n-nd-v4
-tp-link-tl-wr741n-nd-v1
-tp-link-tl-wr741n-nd-v2
-tp-link-tl-wr741n-nd-v4
-tp-link-tl-wr841n-nd-v8
-tp-link-tl-wr841n-nd-v1.5
-tp-link-tl-wr841n-nd-v3
-tp-link-tl-wr841n-nd-v5
-tp-link-tl-wr841n-nd-v7
-tp-link-tl-wr842n-nd-v1
-tp-link-tl-wr941n-nd-v2
-tp-link-tl-wr941n-nd-v3
-tp-link-tl-wr941n-nd-v4
-tp-link-tl-wr1043n-nd-v1
diff --git a/package/gluon-autoupdater/files/etc/config/autoupdater b/package/gluon-autoupdater/files/etc/config/autoupdater
deleted file mode 100644
index b07cf7fc..00000000
--- a/package/gluon-autoupdater/files/etc/config/autoupdater
+++ /dev/null
@@ -1,24 +0,0 @@
-#config autoupdater settings
-#	option enabled 1
-#	option branch "stable"
-
-#config branch stable
-	# The branch name given in the manifest
-#	option name 'stable'
-
-#	list mirror 'http://[fdef:ffc0:3dd7::8]/~freifunk/firmware/autoupdate'
-
-	# The updater will run once per hour and perform an update with a certain
-	# probability.
-	# 1.0 - perform an update every hour
-	# 0.5 - on average, perform an update every two hours
-	# 0.0 - inhibit any automatic updates
-#	option probability 0.5
-
-	# Minimum valid signatures required to perform the update
-#	option good_signatures 2
-
-	# List of public keys
-#	list pubkey 'beea7da92ed0c19563b6c259162b4cb471aa2fdf9d3939d05fea2cf498ea7642'
-#	list pubkey 'c75c9390cf5d7cc49a388d35f831ca379060cf7bca8c6e3d2d1ea31604597c42'
-#	list pubkey '03e9514f137f0467c0f0ac108892c0da2b71f1039b30f863331cbd5701abd042'
diff --git a/package/gluon-autoupdater/files/usr/sbin/autoupdater b/package/gluon-autoupdater/files/usr/sbin/autoupdater
deleted file mode 100755
index 0919f5ff..00000000
--- a/package/gluon-autoupdater/files/usr/sbin/autoupdater
+++ /dev/null
@@ -1,186 +0,0 @@
-#!/bin/sh
-
-
-BRANCH=$(uci get autoupdater.settings.branch)
-
-PROBABILITY=$(uci get autoupdater.${BRANCH}.probability)
-
-if test "a$1" != "a-f"; then
-  if test $(uci get autoupdater.settings.enabled) != 1; then
-    echo "autoupdater is disabled"
-    exit 0
-  fi
-  # get one random byte from /dev/urandom, convert it to decimal and check
-  # against update_probability*255
-  hexdump -n1 -e '/1 "%d"' /dev/urandom | awk "{exit \$1 > $PROBABILITY * 255}"
-  if test $? -ne 0; then
-    echo "No autoupdate this time. Use -f to override"
-    exit 0
-  fi
-fi
-
-BRANCH_NAME=$(uci get autoupdater.${BRANCH}.name)
-MIRRORS=$(for mirror in $(uci get autoupdater.${BRANCH}.mirror); do \
-            hexdump -n1 -e '/1 "%d '"$mirror"'\n"' /dev/urandom; \
-          done | sort -n | cut -d' ' -f2)
-PUBKEYS=$(uci get autoupdater.${BRANCH}.pubkey)
-GOOD_SIGNATURES=$(uci get autoupdater.${BRANCH}.good_signatures)
-
-VERSION_FILE=/lib/gluon/release
-
-# returns 0 when $1 is a higher version number than $2
-newer_than() {
-	# negate the return value as opkg returns 1 when the proposition is true
-	! opkg compare-versions "$1" '>>' "$2"
-}
-
-fetch_manifest() {
-  local MIRROR=$1
-  local manifest=$2
-
-  wget -O$manifest "$MIRROR"/manifest
-
-  if test $? -ne 0; then
-    echo "Couldn't fetch manifest from $MIRROR" >&2
-    return 1
-  fi
-
-  return 0
-}
-
-verify_manifest() {
-  local manifest=$1
-  local manifest_upper=$2
-  local manifest_lower=$(mktemp)
-  awk "BEGIN    { sep=0 }
-     /^---\$/ { sep=1; next }
-              { if(sep==0) print > \"$manifest_upper\";
-                else       print > \"$manifest_lower\"}" \
-    $manifest
-
-  local signatures=""
-  while read sig; do
-    echo "$sig" | grep -q "^[0-9a-f]\{128\}$"
-    if test $? -ne 0; then
-      continue
-    fi
-    signatures="$signatures -s $sig"
-  done < $manifest_lower
-
-  local pubkeys=""
-  for key in $PUBKEYS; do
-    pubkeys="$pubkeys -p $key"
-  done
-
-  rm -f $manifest_lower
-
-  ecdsaverify -n $GOOD_SIGNATURES $pubkeys $signatures $manifest_upper
-
-  if test $? -ne 0; then
-    echo "Not enough valid signatures!" >&2
-    return 1
-  fi
-
-  return 0
-}
-
-analyse_manifest() {
-  local manifest_upper=$1
-
-  grep -q "^BRANCH=${BRANCH_NAME}$" $manifest_upper
-
-  if test $? -ne 0; then
-    echo "Wrong branch. We are on ${BRANCH_NAME}" >&2
-    return 1
-  fi
-
-  local my_firmware
-  my_firmware=$(grep "^${my_model} " $manifest_upper)
-
-  if test $? -ne 0; then
-    echo "No matching firmware found (model ${my_model})" >&2
-    return 1
-  fi
-
-  fw_version=$(echo "${my_firmware}"|cut -d' ' -f2)
-  fw_checksum=$(echo "${my_firmware}"|cut -d' ' -f3)
-  fw_file=$(echo "${my_firmware}"|cut -d' ' -f4)
-
-  return 0
-}
-
-fetch_firmware() {
-  local MIRROR=$1
-  local fw_image=$2
-
-  wget -O$fw_image "${MIRROR}/${fw_file}"
-
-  if test $? -ne 0; then
-    echo "Error downloading image from $MIRROR" >&2
-    return 1
-  fi
-
-  return 0
-}
-
-autoupdate() {
-  local MIRROR=$1
-
-  local manifest=$(mktemp)
-  fetch_manifest $MIRROR $manifest || { rm -f $manifest; return 1; }
-
-  local manifest_upper=$(mktemp)
-  verify_manifest $manifest $manifest_upper || { rm -f $manifest $manifest_upper; return 1; }
-  rm -f $manifest
-
-  analyse_manifest $manifest_upper || { rm -f $manifest_upper; return 1; }
-  rm -f $manifest_upper
-
-  if newer_than "$fw_version" "$my_version"; then
-    echo "New version available"
-
-    # drop caches to make room for firmware image
-    sync
-    sysctl -w vm.drop_caches=3
-
-    local fw_image=$(mktemp)
-    fetch_firmware $MIRROR $fw_image || { rm -f $fw_image; return 1; }
-
-    image_sha512=$(sha512sum "$fw_image" | awk '{print $1}')
-    image_md5=$(md5sum "$fw_image" | awk '{print $1}')
-    if [ "$image_sha512" != "$fw_checksum" -a "$image_md5" != "$fw_checksum" ]; then
-      echo "Invalid image checksum" >&2
-      rm -f $fw_image
-      return 1
-    fi
-    echo "Upgrading firmware."
-
-    sysupgrade "${fw_image}"
-  else
-    echo "No new firmware available"
-  fi
-
-  return 0
-}
-
-trap 'echo Signal ignored.' INT TERM PIPE
-
-my_model="$(lua -e 'print(require("platform_info").get_image_name())')"
-
-if [ ! -f "$VERSION_FILE" ]; then
-  echo "Couldn't determine firmware version!" >&2
-  exit 1
-fi
-
-my_version="$(cat "$VERSION_FILE")"
-
-for mirror in $MIRRORS; do
-
-  autoupdate $mirror && exit 0
-
-  unset fw_version
-  unset fw_checksum
-  unset fw_file
-
-done
-
diff --git a/package/gluon-autoupdater/manifest.sample b/package/gluon-autoupdater/manifest.sample
deleted file mode 100644
index 7e9cbccb..00000000
--- a/package/gluon-autoupdater/manifest.sample
+++ /dev/null
@@ -1,8 +0,0 @@
-BRANCH=stable
-
-# model               ver sha512sum                                                                                                                        filename
-tp-link-tl-wdr4300-v1 0.4 c300c2b80a8863506cf3b19359873c596d87af3183c4826462dfb5aa69bec7ce65e3db23a9f6f779fd0f3cc50db5d57070c2b62942abf4fb0e08ae4cb48191a0 gluon-0.4-tp-link-tl-wdr4300-v1-sysupgrade.bin
-
-# after three dashes follow the ecdsa signatures of everything above the dashes
----
-49030b7b394e0bd204e0faf17f2d2b2756b503c9d682b135deea42b34a09010bff139cbf7513be3f9f8aae126b7f6ff3a7bfe862a798eae9b005d75abbba770a

From 318e9d1a1d1016a8c6c7c5480d219ba6fefd91eb Mon Sep 17 00:00:00 2001
From: Nils Schneider 
Date: Fri, 11 Jul 2014 13:49:13 +0200
Subject: [PATCH 303/453] gluon-announce: detach announce.d from alfred

All announce.d scripts have been moved to /lib/gluon/announce/announce.d
The script /lib/gluon/announce/announce.lua will collect all information
and output json.
---
 package/gluon-alfred/Makefile                 |  2 +-
 .../gluon-alfred/files/lib/gluon/cron/alfred  |  2 +-
 package/gluon-announce/Makefile               | 32 +++++++++++++++++++
 .../gluon/announce}/announce.d/hardware/model |  0
 .../lib/gluon/announce}/announce.d/hostname   |  0
 .../gluon/announce}/announce.d/network/mac    |  0
 .../announce}/announce.d/software/firmware    |  0
 .../announce}/announce.d/statistics/idletime  |  0
 .../announce}/announce.d/statistics/loadavg   |  0
 .../announce}/announce.d/statistics/memory    |  0
 .../announce}/announce.d/statistics/processes |  0
 .../announce}/announce.d/statistics/uptime    |  0
 .../files/lib/gluon/announce}/announce.lua    |  6 ++--
 .../announce.d/software/autoupdater           |  0
 .../announce.d/network/addresses              |  0
 .../announce.d/network/gateway                |  0
 .../announce.d/software/batman-adv            |  0
 .../announce.d/statistics/traffic             |  0
 .../announce.d/software/fastd                 |  0
 .../{alfred => announce}/announce.d/location  |  0
 .../{alfred => announce}/announce.d/owner     |  0
 21 files changed, 36 insertions(+), 6 deletions(-)
 create mode 100644 package/gluon-announce/Makefile
 rename package/{gluon-alfred/files/lib/gluon/alfred => gluon-announce/files/lib/gluon/announce}/announce.d/hardware/model (100%)
 rename package/{gluon-alfred/files/lib/gluon/alfred => gluon-announce/files/lib/gluon/announce}/announce.d/hostname (100%)
 rename package/{gluon-alfred/files/lib/gluon/alfred => gluon-announce/files/lib/gluon/announce}/announce.d/network/mac (100%)
 rename package/{gluon-alfred/files/lib/gluon/alfred => gluon-announce/files/lib/gluon/announce}/announce.d/software/firmware (100%)
 rename package/{gluon-alfred/files/lib/gluon/alfred => gluon-announce/files/lib/gluon/announce}/announce.d/statistics/idletime (100%)
 rename package/{gluon-alfred/files/lib/gluon/alfred => gluon-announce/files/lib/gluon/announce}/announce.d/statistics/loadavg (100%)
 rename package/{gluon-alfred/files/lib/gluon/alfred => gluon-announce/files/lib/gluon/announce}/announce.d/statistics/memory (100%)
 rename package/{gluon-alfred/files/lib/gluon/alfred => gluon-announce/files/lib/gluon/announce}/announce.d/statistics/processes (100%)
 rename package/{gluon-alfred/files/lib/gluon/alfred => gluon-announce/files/lib/gluon/announce}/announce.d/statistics/uptime (100%)
 rename package/{gluon-alfred/files/lib/gluon/alfred => gluon-announce/files/lib/gluon/announce}/announce.lua (75%)
 rename package/gluon-autoupdater/files/lib/gluon/{alfred => announce}/announce.d/software/autoupdater (100%)
 rename package/gluon-mesh-batman-adv/files/lib/gluon/{alfred => announce}/announce.d/network/addresses (100%)
 rename package/gluon-mesh-batman-adv/files/lib/gluon/{alfred => announce}/announce.d/network/gateway (100%)
 rename package/gluon-mesh-batman-adv/files/lib/gluon/{alfred => announce}/announce.d/software/batman-adv (100%)
 rename package/gluon-mesh-batman-adv/files/lib/gluon/{alfred => announce}/announce.d/statistics/traffic (100%)
 rename package/gluon-mesh-vpn-fastd/files/lib/gluon/{alfred => announce}/announce.d/software/fastd (100%)
 rename package/gluon-node-info/files/lib/gluon/{alfred => announce}/announce.d/location (100%)
 rename package/gluon-node-info/files/lib/gluon/{alfred => announce}/announce.d/owner (100%)

diff --git a/package/gluon-alfred/Makefile b/package/gluon-alfred/Makefile
index 394edbd4..bb6926a5 100644
--- a/package/gluon-alfred/Makefile
+++ b/package/gluon-alfred/Makefile
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/package.mk
 define Package/gluon-alfred
   SECTION:=gluon
   CATEGORY:=Gluon
-  DEPENDS:=+gluon-core +gluon-cron +alfred +ethtool +luci-lib-json +luci-lib-core
+  DEPENDS:=+gluon-core +gluon-announce +gluon-cron +alfred
   TITLE:=Configure alfred
 endef
 
diff --git a/package/gluon-alfred/files/lib/gluon/cron/alfred b/package/gluon-alfred/files/lib/gluon/cron/alfred
index 6ddfe744..2d931625 100644
--- a/package/gluon-alfred/files/lib/gluon/cron/alfred
+++ b/package/gluon-alfred/files/lib/gluon/cron/alfred
@@ -1 +1 @@
-* * * * * /lib/gluon/alfred/announce.lua
+* * * * * /lib/gluon/announce/announce.lua | gzip | alfred -s 158
diff --git a/package/gluon-announce/Makefile b/package/gluon-announce/Makefile
new file mode 100644
index 00000000..81c35dfc
--- /dev/null
+++ b/package/gluon-announce/Makefile
@@ -0,0 +1,32 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=gluon-announce
+PKG_VERSION:=1
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/gluon-announce
+  SECTION:=gluon
+  CATEGORY:=Gluon
+  DEPENDS:=+gluon-core +luci-lib-json +ethtool
+  TITLE:=Lua scripts announcing various information
+endef
+
+define Build/Prepare
+	mkdir -p $(PKG_BUILD_DIR)
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+define Package/gluon-announce/install
+	$(CP) ./files/* $(1)/
+endef
+
+$(eval $(call BuildPackage,gluon-announce))
diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/hardware/model b/package/gluon-announce/files/lib/gluon/announce/announce.d/hardware/model
similarity index 100%
rename from package/gluon-alfred/files/lib/gluon/alfred/announce.d/hardware/model
rename to package/gluon-announce/files/lib/gluon/announce/announce.d/hardware/model
diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/hostname b/package/gluon-announce/files/lib/gluon/announce/announce.d/hostname
similarity index 100%
rename from package/gluon-alfred/files/lib/gluon/alfred/announce.d/hostname
rename to package/gluon-announce/files/lib/gluon/announce/announce.d/hostname
diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/network/mac b/package/gluon-announce/files/lib/gluon/announce/announce.d/network/mac
similarity index 100%
rename from package/gluon-alfred/files/lib/gluon/alfred/announce.d/network/mac
rename to package/gluon-announce/files/lib/gluon/announce/announce.d/network/mac
diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/software/firmware b/package/gluon-announce/files/lib/gluon/announce/announce.d/software/firmware
similarity index 100%
rename from package/gluon-alfred/files/lib/gluon/alfred/announce.d/software/firmware
rename to package/gluon-announce/files/lib/gluon/announce/announce.d/software/firmware
diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/idletime b/package/gluon-announce/files/lib/gluon/announce/announce.d/statistics/idletime
similarity index 100%
rename from package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/idletime
rename to package/gluon-announce/files/lib/gluon/announce/announce.d/statistics/idletime
diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/loadavg b/package/gluon-announce/files/lib/gluon/announce/announce.d/statistics/loadavg
similarity index 100%
rename from package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/loadavg
rename to package/gluon-announce/files/lib/gluon/announce/announce.d/statistics/loadavg
diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/memory b/package/gluon-announce/files/lib/gluon/announce/announce.d/statistics/memory
similarity index 100%
rename from package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/memory
rename to package/gluon-announce/files/lib/gluon/announce/announce.d/statistics/memory
diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/processes b/package/gluon-announce/files/lib/gluon/announce/announce.d/statistics/processes
similarity index 100%
rename from package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/processes
rename to package/gluon-announce/files/lib/gluon/announce/announce.d/statistics/processes
diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/uptime b/package/gluon-announce/files/lib/gluon/announce/announce.d/statistics/uptime
similarity index 100%
rename from package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/uptime
rename to package/gluon-announce/files/lib/gluon/announce/announce.d/statistics/uptime
diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.lua b/package/gluon-announce/files/lib/gluon/announce/announce.lua
similarity index 75%
rename from package/gluon-alfred/files/lib/gluon/alfred/announce.lua
rename to package/gluon-announce/files/lib/gluon/announce/announce.lua
index 23b3cd2c..e51445f7 100755
--- a/package/gluon-alfred/files/lib/gluon/alfred/announce.lua
+++ b/package/gluon-announce/files/lib/gluon/announce/announce.lua
@@ -1,7 +1,6 @@
 #!/usr/bin/lua
 
-local alfred_data_type = 158
-local announce_dir = '/lib/gluon/alfred/announce.d'
+local announce_dir = '/lib/gluon/announce/announce.d'
 
 
 fs = require 'luci.fs'
@@ -40,5 +39,4 @@ end
 
 
 encoder = json.Encoder(collect_dir(announce_dir))
-alfred = io.popen('gzip | alfred -s ' .. tostring(alfred_data_type), 'w')
-ltn12.pump.all(encoder:source(), ltn12.sink.file(alfred))
+ltn12.pump.all(encoder:source(), ltn12.sink.file(io.stdout))
diff --git a/package/gluon-autoupdater/files/lib/gluon/alfred/announce.d/software/autoupdater b/package/gluon-autoupdater/files/lib/gluon/announce/announce.d/software/autoupdater
similarity index 100%
rename from package/gluon-autoupdater/files/lib/gluon/alfred/announce.d/software/autoupdater
rename to package/gluon-autoupdater/files/lib/gluon/announce/announce.d/software/autoupdater
diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/network/addresses b/package/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/network/addresses
similarity index 100%
rename from package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/network/addresses
rename to package/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/network/addresses
diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/network/gateway b/package/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/network/gateway
similarity index 100%
rename from package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/network/gateway
rename to package/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/network/gateway
diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/software/batman-adv b/package/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/software/batman-adv
similarity index 100%
rename from package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/software/batman-adv
rename to package/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/software/batman-adv
diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/statistics/traffic b/package/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/statistics/traffic
similarity index 100%
rename from package/gluon-mesh-batman-adv/files/lib/gluon/alfred/announce.d/statistics/traffic
rename to package/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/statistics/traffic
diff --git a/package/gluon-mesh-vpn-fastd/files/lib/gluon/alfred/announce.d/software/fastd b/package/gluon-mesh-vpn-fastd/files/lib/gluon/announce/announce.d/software/fastd
similarity index 100%
rename from package/gluon-mesh-vpn-fastd/files/lib/gluon/alfred/announce.d/software/fastd
rename to package/gluon-mesh-vpn-fastd/files/lib/gluon/announce/announce.d/software/fastd
diff --git a/package/gluon-node-info/files/lib/gluon/alfred/announce.d/location b/package/gluon-node-info/files/lib/gluon/announce/announce.d/location
similarity index 100%
rename from package/gluon-node-info/files/lib/gluon/alfred/announce.d/location
rename to package/gluon-node-info/files/lib/gluon/announce/announce.d/location
diff --git a/package/gluon-node-info/files/lib/gluon/alfred/announce.d/owner b/package/gluon-node-info/files/lib/gluon/announce/announce.d/owner
similarity index 100%
rename from package/gluon-node-info/files/lib/gluon/alfred/announce.d/owner
rename to package/gluon-node-info/files/lib/gluon/announce/announce.d/owner

From eae6c25de6d470606b140db53807835f08deac37 Mon Sep 17 00:00:00 2001
From: Matthias Schiffer 
Date: Fri, 11 Jul 2014 16:36:32 +0200
Subject: [PATCH 304/453] Add support for IPv6 mesh VPN connections

The support is still very limited (IPv6-only DNS on WAN doesn't work yet), and
we now need fastd running as root, but apart from that, is should work.
---
 .../gluon/upgrade/core/invariant/011-network  | 32 +++++++++++++++++++
 .../invariant/010-mesh-vpn-fastd              |  6 ++--
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/invariant/011-network b/package/gluon-core/files/lib/gluon/upgrade/core/invariant/011-network
index 10b16181..d3ca1671 100755
--- a/package/gluon-core/files/lib/gluon/upgrade/core/invariant/011-network
+++ b/package/gluon-core/files/lib/gluon/upgrade/core/invariant/011-network
@@ -4,8 +4,40 @@ local uci = require('luci.model.uci').cursor()
 local sysctl = require 'gluon.sysctl'
 
 
+if not uci:get('network', 'interface', 'wan6') then
+   uci:section('network', 'interface', 'wan6',
+	       {
+		  ifname = 'br-wan',
+		  proto = 'dhcpv6',
+	       }
+   )
+end
+
+
 uci:set('network', 'wan', 'peerdns', '0')
 
+uci:set('network', 'wan6', 'peerdns', '0')
+uci:set('network', 'wan6', 'ip6table', '1')
+
+
+uci:section('network', 'rule6', 'wan6_lookup',
+	    {
+	       mark = '0x01/0x01',
+	       lookup = 1,
+	    }
+)
+
+uci:section('network', 'route6', 'wan6_unreachable',
+	    {
+	       type = 'unreachable',
+	       interface = 'loopback',
+	       target = '::/0',
+	       gateway = '::',
+	       table = 1,
+	       metric = 65535,
+	    }
+)
+
 uci:save('network')
 uci:commit('network')
 
diff --git a/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd
index ebce54f6..da8b5e6a 100755
--- a/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd
+++ b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd
@@ -10,20 +10,22 @@ local uci = require 'luci.model.uci'
 local c = uci.cursor()
 
 
-users.add_user('gluon-fastd', 800, 100)
+-- The previously used user is removed, we need root privileges to use the packet_mark option
+users.remove_user('gluon-fastd')
 
 
 c:section('fastd', 'fastd', 'mesh_vpn',
 	  {
-		  user = 'gluon-fastd',
 		  syslog_level = 'verbose',
 		  interface = 'mesh-vpn',
 		  mode = 'tap',
 		  mtu = site.fastd_mesh_vpn.mtu,
 		  secure_handshakes = '1',
 		  method = site.fastd_mesh_vpn.methods,
+		  packet_mark = 1,
 	  }
 )
+c:delete('fastd', 'mesh_vpn', 'user')
 
 c:delete('fastd', 'mesh_vpn_backbone')
 c:section('fastd', 'peer_group', 'mesh_vpn_backbone',

From ae4c130c74cc70ea0a62d6b97e9c6ce7416223fd Mon Sep 17 00:00:00 2001
From: Nils Schneider 
Date: Sun, 13 Jul 2014 09:02:02 +0200
Subject: [PATCH 305/453] gluon-mesh-batman-adv: announce MAC of mesh ifaces

This will make a node announce all MACs of its interfaces participating
in the batman-adv mesh. This enables other nodes to associate the
announced object with both the data reported by batadv-vis as well as a
simple list of neighbours as output by `iw dev $IFACE station dump`.
---
 .../announce/announce.d/network/mesh_interfaces   | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 package/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/network/mesh_interfaces

diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/network/mesh_interfaces b/package/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/network/mesh_interfaces
new file mode 100644
index 00000000..d078fcb1
--- /dev/null
+++ b/package/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/network/mesh_interfaces
@@ -0,0 +1,15 @@
+require 'ubus'
+
+local conn = ubus.connect()
+local list = util.exec('batctl if')
+
+local interfaces = {}
+for _, line in ipairs(util.split(list)) do
+	local ifname = line:match('^(.-):')
+	if ifname ~= nil then
+		local status = conn:call("network.device", "status", { name = ifname })
+		table.insert(interfaces, status['macaddr'])
+	end
+end
+
+return interfaces

From 09e1de7dde9840e5cd5dbf13fd6294289ef88522 Mon Sep 17 00:00:00 2001
From: Nils Schneider 
Date: Fri, 11 Jul 2014 18:25:39 +0200
Subject: [PATCH 306/453] gluon-announced: send nodeinformation on request

This is a simple daemon that will respond to multicast UDP packets
containing the keyword "nodeinfo" with all the information we
currently distribute using alfred.

The daemon will listen on all mesh interface, that is the hard
interfaces batman-adv uses.
---
 package/gluon-announced/Makefile              |  40 +++
 .../etc/hotplug.d/iface/10-gluon-announced    |  45 ++++
 package/gluon-announced/src/Makefile          |   6 +
 package/gluon-announced/src/gluon-announced.c | 229 ++++++++++++++++++
 4 files changed, 320 insertions(+)
 create mode 100644 package/gluon-announced/Makefile
 create mode 100644 package/gluon-announced/files/etc/hotplug.d/iface/10-gluon-announced
 create mode 100644 package/gluon-announced/src/Makefile
 create mode 100644 package/gluon-announced/src/gluon-announced.c

diff --git a/package/gluon-announced/Makefile b/package/gluon-announced/Makefile
new file mode 100644
index 00000000..4fc31f6a
--- /dev/null
+++ b/package/gluon-announced/Makefile
@@ -0,0 +1,40 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=gluon-announced
+PKG_VERSION:=1
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/gluon-announced
+  SECTION:=gluon
+  CATEGORY:=Gluon
+  TITLE:=announced support
+  DEPENDS:=
+endef
+
+define Package/gluon-announced/description
+	Gluon community wifi mesh firmware framework: announced support
+endef
+
+define Build/Prepare
+	mkdir -p $(PKG_BUILD_DIR)
+	$(CP) ./src/* $(PKG_BUILD_DIR)/
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+	CFLAGS="$(TARGET_CFLAGS)" CPPFLAGS="$(TARGET_CPPFLAGS)" $(MAKE) -C $(PKG_BUILD_DIR) $(TARGET_CONFIGURE_OPTS)
+endef
+
+define Package/gluon-announced/install
+	$(CP) ./files/* $(1)/
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/gluon-announced $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,gluon-announced))
diff --git a/package/gluon-announced/files/etc/hotplug.d/iface/10-gluon-announced b/package/gluon-announced/files/etc/hotplug.d/iface/10-gluon-announced
new file mode 100644
index 00000000..b5546ff0
--- /dev/null
+++ b/package/gluon-announced/files/etc/hotplug.d/iface/10-gluon-announced
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+. /usr/share/libubox/jshn.sh
+. /lib/functions/service.sh
+
+DEVLIST=/var/run/gluon-announce.devs
+DAEMON=/usr/bin/gluon-announced
+
+ifname_to_dev () {
+	json_load "$(ubus call network.interface.$1 status)"
+	json_get_var dev device
+
+	echo "$dev"
+}
+
+restart_announced () {
+	SERVICE_USE_PID=1
+	SERVICE_WRITE_PID=1
+	SERVICE_DAEMONIZE=1
+
+	DEVS=$(cat $DEVLIST | while read dev iface;do echo -n " -i $dev";done)
+
+	service_stop $DAEMON
+	service_start $DAEMON -g ff02:0:0:0:0:0:2:1001 -p 1001 -s /lib/gluon/announce/announce.lua $DEVS
+}
+
+case "$ACTION" in
+	ifdown)
+		sed -i "/$INTERFACE/d" $DEVLIST
+		;;
+	ifup)
+		DEVICE=$(ifname_to_dev $INTERFACE)
+		MESH=$(cat /sys/class/net/$DEVICE/batman_adv/mesh_iface)
+
+		[ $MESH = "bat0" ] || exit 0
+
+		DEVS="$(cat $DEVLIST; echo $DEVICE $INTERFACE)"
+
+		echo "$DEVS" | sort | uniq > $DEVLIST
+
+		restart_announced
+
+		;;
+esac
+
diff --git a/package/gluon-announced/src/Makefile b/package/gluon-announced/src/Makefile
new file mode 100644
index 00000000..73e7a9e2
--- /dev/null
+++ b/package/gluon-announced/src/Makefile
@@ -0,0 +1,6 @@
+all: gluon-announced
+
+gluon-announced: gluon-announced.c
+
+clean:
+	rm gluon-announced
diff --git a/package/gluon-announced/src/gluon-announced.c b/package/gluon-announced/src/gluon-announced.c
new file mode 100644
index 00000000..8b4ef58a
--- /dev/null
+++ b/package/gluon-announced/src/gluon-announced.c
@@ -0,0 +1,229 @@
+/*
+   Copyright (c) 2014, Nils Schneider 
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   1. Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+   DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+   CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+   */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+void usage() {
+  puts("Usage: gluon-announced [-h] -m  -p  -i  [-i  ..] -s 
-<%+footer%>

From 60e0a5601cd6b9d4cbff9ddc864c9ff6582bda58 Mon Sep 17 00:00:00 2001
From: Julian Kornberger 
Date: Wed, 6 Aug 2014 23:18:31 +0200
Subject: [PATCH 346/453] gluon-luci-private-wifi: fix package naming

previously it was gluon-luci-privatewifi
---
 .../Makefile                                              | 8 ++++----
 .../usr/lib/lua/luci/controller/admin/privatewifi.lua     | 0
 .../usr/lib/lua/luci/model/cbi/admin/privatewifi.lua      | 0
 3 files changed, 4 insertions(+), 4 deletions(-)
 rename package/{gluon-luci-privatewifi => gluon-luci-private-wifi}/Makefile (69%)
 rename package/{gluon-luci-privatewifi => gluon-luci-private-wifi}/files/usr/lib/lua/luci/controller/admin/privatewifi.lua (100%)
 rename package/{gluon-luci-privatewifi => gluon-luci-private-wifi}/files/usr/lib/lua/luci/model/cbi/admin/privatewifi.lua (100%)

diff --git a/package/gluon-luci-privatewifi/Makefile b/package/gluon-luci-private-wifi/Makefile
similarity index 69%
rename from package/gluon-luci-privatewifi/Makefile
rename to package/gluon-luci-private-wifi/Makefile
index 3b56da18..0d5c4619 100644
--- a/package/gluon-luci-privatewifi/Makefile
+++ b/package/gluon-luci-private-wifi/Makefile
@@ -1,6 +1,6 @@
 include $(TOPDIR)/rules.mk
 
-PKG_NAME:=gluon-luci-privatewifi
+PKG_NAME:=gluon-luci-private-wifi
 PKG_VERSION:=0.1
 PKG_RELEASE:=1
 
@@ -8,7 +8,7 @@ PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 
 include $(INCLUDE_DIR)/package.mk
 
-define Package/gluon-luci-privatewifi
+define Package/gluon-luci-private-wifi
   SECTION:=gluon
   CATEGORY:=Gluon
   DEPENDS:=+gluon-luci-admin
@@ -25,8 +25,8 @@ endef
 define Build/Compile
 endef
 
-define Package/gluon-luci-privatewifi/install
+define Package/gluon-luci-private-wifi/install
 	$(CP) ./files/* $(1)/
 endef
 
-$(eval $(call BuildPackage,gluon-luci-privatewifi))
+$(eval $(call BuildPackage,gluon-luci-private-wifi))
diff --git a/package/gluon-luci-privatewifi/files/usr/lib/lua/luci/controller/admin/privatewifi.lua b/package/gluon-luci-private-wifi/files/usr/lib/lua/luci/controller/admin/privatewifi.lua
similarity index 100%
rename from package/gluon-luci-privatewifi/files/usr/lib/lua/luci/controller/admin/privatewifi.lua
rename to package/gluon-luci-private-wifi/files/usr/lib/lua/luci/controller/admin/privatewifi.lua
diff --git a/package/gluon-luci-privatewifi/files/usr/lib/lua/luci/model/cbi/admin/privatewifi.lua b/package/gluon-luci-private-wifi/files/usr/lib/lua/luci/model/cbi/admin/privatewifi.lua
similarity index 100%
rename from package/gluon-luci-privatewifi/files/usr/lib/lua/luci/model/cbi/admin/privatewifi.lua
rename to package/gluon-luci-private-wifi/files/usr/lib/lua/luci/model/cbi/admin/privatewifi.lua

From cd0a932ac0cd029870a8962471dded7d09c77719 Mon Sep 17 00:00:00 2001
From: Matthias Schiffer 
Date: Wed, 6 Aug 2014 17:20:07 +0200
Subject: [PATCH 347/453] gluon-setup-mode: provide alternative rc.d directory
 for procd

---
 .../files/etc/init.d/gluon-setup-mode         | 88 -------------------
 .../lib/gluon/setup-mode/rc.d/K50dropbear     |  1 +
 .../files/lib/gluon/setup-mode/rc.d/K89log    |  1 +
 .../lib/gluon/setup-mode/rc.d/K90network      |  1 +
 .../files/lib/gluon/setup-mode/rc.d/K98boot   |  1 +
 .../files/lib/gluon/setup-mode/rc.d/K99umount |  1 +
 .../lib/gluon/setup-mode/rc.d/S00sysfixtime   |  1 +
 .../files/lib/gluon/setup-mode/rc.d/S10boot   |  1 +
 .../files/lib/gluon/setup-mode/rc.d/S10system |  1 +
 .../files/lib/gluon/setup-mode/rc.d/S11sysctl |  1 +
 .../files/lib/gluon/setup-mode/rc.d/S12log    |  1 +
 .../lib/gluon/setup-mode/rc.d/S13haveged      |  5 ++
 .../gluon/setup-mode/rc.d/S15gluon-setup-mode | 10 +++
 .../lib/gluon/setup-mode/rc.d/S20network      | 86 ++++++++++++++++++
 .../lib/gluon/setup-mode/rc.d/S50dropbear     |  1 +
 .../files/lib/gluon/setup-mode/rc.d/S50telnet | 12 +++
 .../files/lib/gluon/setup-mode/rc.d/S50uhttpd | 14 +++
 .../lib/gluon/setup-mode/rc.d/S60dnsmasq      | 17 ++++
 .../files/lib/gluon/setup-mode/rc.d/S95done   |  1 +
 .../files/lib/gluon/setup-mode/rc.d/S96led    |  9 ++
 .../files/lib/preinit/90_setup_mode           | 22 +++++
 21 files changed, 187 insertions(+), 88 deletions(-)
 delete mode 100755 package/gluon-setup-mode/files/etc/init.d/gluon-setup-mode
 create mode 120000 package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K50dropbear
 create mode 120000 package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K89log
 create mode 120000 package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K90network
 create mode 120000 package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K98boot
 create mode 120000 package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K99umount
 create mode 120000 package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S00sysfixtime
 create mode 120000 package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S10boot
 create mode 120000 package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S10system
 create mode 120000 package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S11sysctl
 create mode 120000 package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S12log
 create mode 100755 package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S13haveged
 create mode 100755 package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S15gluon-setup-mode
 create mode 100755 package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S20network
 create mode 120000 package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S50dropbear
 create mode 100755 package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S50telnet
 create mode 100755 package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S50uhttpd
 create mode 100755 package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S60dnsmasq
 create mode 120000 package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S95done
 create mode 100755 package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S96led
 create mode 100644 package/gluon-setup-mode/files/lib/preinit/90_setup_mode

diff --git a/package/gluon-setup-mode/files/etc/init.d/gluon-setup-mode b/package/gluon-setup-mode/files/etc/init.d/gluon-setup-mode
deleted file mode 100755
index 41c14fd2..00000000
--- a/package/gluon-setup-mode/files/etc/init.d/gluon-setup-mode
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/bin/sh /etc/rc.common
-
-START=15
-
-
-SETUP_MODE_ADDR=192.168.1.1
-SETUP_MODE_NETMASK=255.255.255.0
-
-SETUP_MODE_DHCP_RANGE=192.168.1.2,192.168.1.254
-
-
-delete_interface() {
-	[ "$1" = 'loopback' ] || uci_remove network "$1"
-}
-
-
-check_enable() {
-	config_get enabled "$1" enabled
-	config_get configured "$1" configured
-
-	if [ "$enabled" = 1 -o "$configured" != 1 ]; then
-		export enable=1
-	fi
-}
-
-setup_network() {
-	(
-		export UCI_CONFIG_DIR=/var/gluon/setup-mode/config
-
-		mkdir -p "$UCI_CONFIG_DIR"
-
-		cp /etc/config/network "$UCI_CONFIG_DIR"
-
-		config_load network
-		config_foreach delete_interface interface
-
-		uci_add network interface setup
-		uci_set network setup ifname "$(lua -e 'print(require("gluon.sysconfig").setup_ifname)')"
-		uci_set network setup type 'bridge'
-		uci_set network setup proto 'static'
-		uci_set network setup ipaddr "$SETUP_MODE_ADDR"
-		uci_set network setup netmask "$SETUP_MODE_NETMASK"
-
-		uci_commit network
-
-		SERVICE_DAEMONIZE=1
-		SERVICE_WRITE_PID=1
-		service_start /sbin/netifd -c "$UCI_CONFIG_DIR"
-
-		setup_switch() { return 0; }
-
-		include /lib/network
-		setup_switch
-	)
-}
-
-start() {
-	enable=0
-	config_load gluon-setup-mode
-	config_foreach check_enable setup_mode
-
-	if [ "$enable" = '1' ]; then
-		lua -luci -e 'require "luci.model.uci"; uci_state=luci.model.uci.cursor_state(); uci_state:section("gluon-setup-mode", "setup_mode", nil, { running = "1" }); uci_state:save("gluon-setup-mode")'
-		uci set 'gluon-setup-mode.@setup_mode[0].enabled=0'
-		uci commit gluon-setup-mode
-
-		setup_network
-
-		/usr/sbin/telnetd -l /lib/gluon/setup-mode/ash-login
-		/etc/init.d/dropbear start
-
-		/usr/sbin/uhttpd -h /lib/gluon/setup-mode/www -x /cgi-bin -A 1 -R -p 0.0.0.0:80
-
-		/usr/sbin/dnsmasq -p 0 -F $SETUP_MODE_DHCP_RANGE -l /tmp/dhcp.leases -O option:router
-
-		/etc/init.d/led start
-
-		# correctly finish firstboot
-		/etc/init.d/done boot
-
-		. /etc/diag.sh
-		get_status_led
-		status_led_set_timer 1000 300
-
-		# block further boot
-		while true; do sleep 1; done
-	fi
-}
diff --git a/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K50dropbear b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K50dropbear
new file mode 120000
index 00000000..066549b3
--- /dev/null
+++ b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K50dropbear
@@ -0,0 +1 @@
+/etc/init.d/dropbear
\ No newline at end of file
diff --git a/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K89log b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K89log
new file mode 120000
index 00000000..1e0c5ac0
--- /dev/null
+++ b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K89log
@@ -0,0 +1 @@
+/etc/init.d/log
\ No newline at end of file
diff --git a/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K90network b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K90network
new file mode 120000
index 00000000..0a43e66b
--- /dev/null
+++ b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K90network
@@ -0,0 +1 @@
+S20network
\ No newline at end of file
diff --git a/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K98boot b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K98boot
new file mode 120000
index 00000000..64aea5e8
--- /dev/null
+++ b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K98boot
@@ -0,0 +1 @@
+/etc/init.d/boot
\ No newline at end of file
diff --git a/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K99umount b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K99umount
new file mode 120000
index 00000000..b02f4892
--- /dev/null
+++ b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K99umount
@@ -0,0 +1 @@
+/etc/init.d/umount
\ No newline at end of file
diff --git a/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S00sysfixtime b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S00sysfixtime
new file mode 120000
index 00000000..a4fb1d5b
--- /dev/null
+++ b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S00sysfixtime
@@ -0,0 +1 @@
+/etc/init.d/sysfixtime
\ No newline at end of file
diff --git a/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S10boot b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S10boot
new file mode 120000
index 00000000..64aea5e8
--- /dev/null
+++ b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S10boot
@@ -0,0 +1 @@
+/etc/init.d/boot
\ No newline at end of file
diff --git a/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S10system b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S10system
new file mode 120000
index 00000000..81e8836f
--- /dev/null
+++ b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S10system
@@ -0,0 +1 @@
+/etc/init.d/system
\ No newline at end of file
diff --git a/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S11sysctl b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S11sysctl
new file mode 120000
index 00000000..b4ac535e
--- /dev/null
+++ b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S11sysctl
@@ -0,0 +1 @@
+/etc/init.d/sysctl
\ No newline at end of file
diff --git a/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S12log b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S12log
new file mode 120000
index 00000000..1e0c5ac0
--- /dev/null
+++ b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S12log
@@ -0,0 +1 @@
+/etc/init.d/log
\ No newline at end of file
diff --git a/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S13haveged b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S13haveged
new file mode 100755
index 00000000..b4af677a
--- /dev/null
+++ b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S13haveged
@@ -0,0 +1,5 @@
+#!/bin/sh /etc/rc.common
+
+if /etc/init.d/haveged enabled; then
+	. /etc/init.d/haveged
+fi
diff --git a/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S15gluon-setup-mode b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S15gluon-setup-mode
new file mode 100755
index 00000000..b6c1136e
--- /dev/null
+++ b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S15gluon-setup-mode
@@ -0,0 +1,10 @@
+#!/bin/sh /etc/rc.common
+
+START=15
+
+
+boot() {
+	lua -luci -e 'require "luci.model.uci"; uci_state=luci.model.uci.cursor_state(); uci_state:section("gluon-setup-mode", "setup_mode", nil, { running = "1" }); uci_state:save("gluon-setup-mode")'
+	uci set 'gluon-setup-mode.@setup_mode[0].enabled=0'
+	uci commit gluon-setup-mode
+}
diff --git a/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S20network b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S20network
new file mode 100755
index 00000000..8bc0ba4f
--- /dev/null
+++ b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S20network
@@ -0,0 +1,86 @@
+#!/bin/sh /etc/rc.common
+
+SETUP_MODE_ADDR=192.168.1.1
+SETUP_MODE_NETMASK=255.255.255.0
+
+START=20
+STOP=90
+
+USE_PROCD=1
+
+
+delete_interface() {
+        [ "$1" = 'loopback' ] || uci_remove network "$1"
+}
+
+prepare_config() {
+(
+	export UCI_CONFIG_DIR=/var/gluon/setup-mode/config
+
+	mkdir -p "$UCI_CONFIG_DIR"
+
+	cp /etc/config/network "$UCI_CONFIG_DIR"
+
+	config_load network
+	config_foreach delete_interface interface
+
+	uci_add network interface setup
+	uci_set network setup ifname "$(lua -e 'print(require("gluon.sysconfig").setup_ifname)')"
+	uci_set network setup type 'bridge'
+	uci_set network setup proto 'static'
+	uci_set network setup ipaddr "$SETUP_MODE_ADDR"
+	uci_set network setup netmask "$SETUP_MODE_NETMASK"
+
+	uci_commit network
+)
+}
+
+init_switch() {
+	setup_switch() { return 0; }
+
+	include /lib/network
+	setup_switch
+}
+
+start_service() {
+	prepare_config
+	init_switch
+
+	procd_open_instance
+	procd_set_param command /sbin/netifd -c /var/gluon/setup-mode/config
+	procd_set_param respawn
+	procd_set_param watch network.interface
+	[ -e /proc/sys/kernel/core_pattern ] && {
+		procd_set_param limits core="unlimited"
+		echo '/tmp/%e.%p.%s.%t.core' > /proc/sys/kernel/core_pattern
+	}
+	procd_close_instance
+}
+
+reload_service() {
+	init_switch
+	ubus call network reload
+	/sbin/wifi reload_legacy
+}
+
+stop_service() {
+	/sbin/wifi down
+}
+
+service_running() {
+	ubus -t 30 wait_for network.interface
+	/sbin/wifi reload_legacy
+}
+
+restart() {
+	ifdown -a
+	sleep 1
+	trap '' TERM
+	stop "$@"
+	start "$@"
+}
+
+shutdown() {
+	ifdown -a
+	stop
+}
diff --git a/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S50dropbear b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S50dropbear
new file mode 120000
index 00000000..066549b3
--- /dev/null
+++ b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S50dropbear
@@ -0,0 +1 @@
+/etc/init.d/dropbear
\ No newline at end of file
diff --git a/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S50telnet b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S50telnet
new file mode 100755
index 00000000..b524b2ce
--- /dev/null
+++ b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S50telnet
@@ -0,0 +1,12 @@
+#!/bin/sh /etc/rc.common
+
+START=50
+
+USE_PROCD=1
+PROG=/usr/sbin/telnetd
+
+start_service() {
+	procd_open_instance
+	procd_set_param command "$PROG" -F -l /lib/gluon/setup-mode/ash-login
+	procd_close_instance
+}
diff --git a/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S50uhttpd b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S50uhttpd
new file mode 100755
index 00000000..53118704
--- /dev/null
+++ b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S50uhttpd
@@ -0,0 +1,14 @@
+#!/bin/sh /etc/rc.common
+
+START=50
+
+USE_PROCD=1
+
+UHTTPD_BIN="/usr/sbin/uhttpd"
+
+start_service() {
+	procd_open_instance
+	procd_set_param respawn
+	procd_set_param command "$UHTTPD_BIN" -f -h /lib/gluon/setup-mode/www -x /cgi-bin -A 1 -R -p 0.0.0.0:80
+	procd_close_instance
+}
diff --git a/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S60dnsmasq b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S60dnsmasq
new file mode 100755
index 00000000..d275b4bf
--- /dev/null
+++ b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S60dnsmasq
@@ -0,0 +1,17 @@
+#!/bin/sh /etc/rc.common
+
+SETUP_MODE_DHCP_RANGE=192.168.1.2,192.168.1.254
+
+
+START=60
+
+USE_PROCD=1
+PROG=/usr/sbin/dnsmasq
+
+
+start_service() {
+	procd_open_instance
+	procd_set_param command $PROG -k -p 0 -F $SETUP_MODE_DHCP_RANGE -l /tmp/dhcp.leases -O option:router
+	procd_set_param respawn
+	procd_close_instance
+}
diff --git a/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S95done b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S95done
new file mode 120000
index 00000000..c9f30277
--- /dev/null
+++ b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S95done
@@ -0,0 +1 @@
+/etc/init.d/done
\ No newline at end of file
diff --git a/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S96led b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S96led
new file mode 100755
index 00000000..d5375acb
--- /dev/null
+++ b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S96led
@@ -0,0 +1,9 @@
+#!/bin/sh /etc/rc.common
+
+START=96
+
+start() {
+	. /etc/diag.sh
+	get_status_led
+	status_led_set_timer 1000 300
+}
diff --git a/package/gluon-setup-mode/files/lib/preinit/90_setup_mode b/package/gluon-setup-mode/files/lib/preinit/90_setup_mode
new file mode 100644
index 00000000..31f64f64
--- /dev/null
+++ b/package/gluon-setup-mode/files/lib/preinit/90_setup_mode
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+
+check_enable() {
+	local enabled
+	local configured
+
+        config_get enabled "$1" enabled
+        config_get configured "$1" configured
+
+        if [ "$enabled" = 1 -o "$configured" != 1 ]; then
+		echo '/lib/gluon/setup-mode/rc.d' > /tmp/rc_d_path
+        fi
+}
+
+
+setup_mode_enable() {
+        config_load gluon-setup-mode
+        config_foreach check_enable setup_mode
+}
+
+boot_hook_add preinit_main setup_mode_enable

From 4f65d49950bb50abcafbb8cfaeab6a8e55277c88 Mon Sep 17 00:00:00 2001
From: Nils Schneider 
Date: Fri, 8 Aug 2014 14:34:19 +0200
Subject: [PATCH 348/453] Revert "gluon-luci-theme: remove top padding
 cbi-field-title"

This reverts commit f37f1f1ac2c9a44d0aafb25e3f5a01e16df6019e.
---
 .../gluon-luci-theme/files/www/luci-static/gluon/cascade.css   | 2 +-
 package/gluon-luci-theme/sass/cascade.scss                     | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/package/gluon-luci-theme/files/www/luci-static/gluon/cascade.css b/package/gluon-luci-theme/files/www/luci-static/gluon/cascade.css
index 8827c3fb..b29120e4 100644
--- a/package/gluon-luci-theme/files/www/luci-static/gluon/cascade.css
+++ b/package/gluon-luci-theme/files/www/luci-static/gluon/cascade.css
@@ -1 +1 @@
-@charset "UTF-8";.lang_he{direction:RTL;unicode-bidi:embed}.hidden{display:none}html{min-height:100%;height:auto;position:relative}body{font-family:'Open Sans', Arial, sans-serif;font-size:12pt;color:#4d4e53;line-height:1.5em;margin:0;display:flex;flex-direction:column;min-height:100vh;background-color:#f3f3f3}a img{border:none;text-decoration:none}.tabmenu1{text-align:center}ul.tabmenu{list-style:none;padding:0;margin:2em 0;display:inline-flex}ul.tabmenu li{white-space:nowrap;margin:0 0.5em;padding:0;text-align:center}ul.tabmenu li a{display:block;text-decoration:none;padding:1em;margin:0;color:#333;border-radius:2em}ul.tabmenu li a:hover{background:#ffe9b3}ul.tabmenu li.active a{font-weight:bold;background:white;color:#333}abbr,acronym{font-style:normal;font-variant:normal}abbr[title],acronym[title]{border-bottom:1px dotted;cursor:help}a:link abbr[title],a:visited abbr[title],a:link acronym[title],a:visited acronym[title]{cursor:pointer}code{font-family:monospace;white-space:pre}#maincontent ul{margin-left:2em}.warning{color:red;background-color:white;font-weight:bold}.clear{clear:both}.error{color:#ff0000;background-color:white}div.hostinfo{margin:0;padding:0;font-size:80%;padding:0.5em;flex:1;font-weight:bold}#xhr_poll_status{cursor:pointer}#xhr_poll_status #xhr_poll_status_off{font-weight:bold;color:#FF0000}#xhr_poll_status #xhr_poll_status_on{font-weight:bold;color:#00FF00}#menubar{display:flex;background:#dc0067;color:#ffffff}#menubar .warning{color:red;background-color:#557788}#menubar a:link,#menubar a:visited{position:relative;display:block;padding:0.5em;text-decoration:none;font-size:80%;font-weight:normal;color:white}#menubar a:link:hover,#menubar a:visited:hover,#menubar a:link:focus,#menubar a:visited:focus{background:#ffb400;color:black}#menubar a:link.active,#menubar a:visited.active{background:#ffb400;color:black;font-weight:bold}#menubar a:link.warning,#menubar a:visited.warning{background:#000000;color:red;font-weight:bold}#modemenu{list-style:none;margin:0;padding:0}#modemenu li{display:inline-block}.lang_de #submenu_admin_uci{width:12em}.lang_ru #submenu_admin_uci{width:11.5em}textarea#syslog{width:98%;min-height:500px;border:3px solid #cccccc;padding:5px;font-family:monospace}#maincontent{padding:0 1em 2em;max-width:60em;min-width:40em;margin:1em auto}.lang_he #maincontent{direction:rtl}#maincontent p{margin-bottom:1em}.cbi-section{margin:0;padding:0;border:none}.cbi-section legend{font-size:1.4em;font-weight:bold;color:#dc0067;position:relative;padding:0;margin-bottom:0.5em}.cbi-section h2{margin:0em 0 0.5em -0.5em !important}.cbi-section h3{text-decoration:none !important;font-weight:bold !important;color:#555555 !important;margin:0.25em !important;font-size:100% !important}.cbi-section-descr{margin-bottom:2em}.cbi-title-ref{color:inherit;text-decoration:none;padding-right:18px;background:url("../resources/cbi/link.gif") no-repeat scroll right center;background-color:inherit}ul.cbi-apply{font-size:90%}input:-webkit-input-placeholder{color:#AAAAAA}input:-moz-placeholder{color:#AAAAAA}input:-ms-input-placeholder{color:#AAAAAA}input[type=checkbox]{-moz-appearance:none;-webkit-appearance:none;-o-appearance:none;appearance:none;width:2em;height:2em;margin:0}input[type=checkbox]:checked{position:relative}input[type=checkbox]:checked::after{content:'✔';color:#dc0067;vertical-align:middle;position:absolute;top:50%;left:0;margin-top:-0.5em;width:100%;text-align:center;font-size:1.7em}input[type=submit],input[type=reset],input[type=image],input[type=button]{cursor:pointer}select,input,textarea{color:#003247;border:none;background:#ffe199;border-radius:3pt;padding:0.5em}input[type=image]{border:none}select,input[type=text],input[type=password]{width:20em}td select,td input[type=text],td input[type=password]{width:99%}img.cbi-image-button{cursor:pointer;margin:0 2px;vertical-align:middle}input.cbi-button{display:inline-block;zoom:1;line-height:normal;white-space:nowrap;vertical-align:baseline;text-align:center;cursor:pointer;-webkit-user-drag:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;font-size:100%;padding:0.5em 1em;color:rgba(0,0,0,0.8);border:none rgba(0,0,0,0);background-color:#E6E6E6;text-decoration:none;border-radius:2px;-webkit-transition:0.1s linear -webkit-box-shadow;-moz-transition:0.1s linear -moz-box-shadow;-ms-transition:0.1s linear box-shadow;-o-transition:0.1s linear box-shadow;transition:0.1s linear box-shadow;background-repeat:no-repeat}input.cbi-button::-moz-focus-inner{padding:0;border:0}input.cbi-button:active{box-shadow:0 0 0 1px rgba(0,0,0,0.15) inset,0 0 6px rgba(0,0,0,0.2) inset}input.cbi-button:focus{outline:0}input.cbi-button:hover,input.cbi-button:focus{background-image:-webkit-gradient(linear, 0 0, 0 100%, from(transparent), color-stop(40%, rgba(0,0,0,0.05)), to(rgba(0,0,0,0.1)));background-image:-webkit-linear-gradient(transparent, rgba(0,0,0,0.05) 40%, rgba(0,0,0,0.1));background-image:-moz-linear-gradient(top, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.1));background-image:-o-linear-gradient(transparent, rgba(0,0,0,0.05) 40%, rgba(0,0,0,0.1));background-image:linear-gradient(transparent, rgba(0,0,0,0.05) 40%, rgba(0,0,0,0.1))}input.cbi-button[disabled]{border:none;background-image:none;opacity:0.40;cursor:not-allowed;box-shadow:none}input.cbi-input-user{background-image:url("../resources/cbi/user.gif");background-repeat:no-repeat;background-position:1px center;color:#000000;text-indent:17px}input.cbi-input-find,input.cbi-button-find{background-image:url("../resources/cbi/find.gif");color:#000000;padding-left:17px}input.cbi-input-reload{background-image:url("../resources/cbi/reload.gif");color:#000000;padding-left:17px}input.cbi-input-add,input.cbi-button-add{background-image:url("../resources/cbi/add.gif");color:#000000;padding-left:17px;padding-right:1px}input.cbi-input-fieldadd,input.cbi-button-fieldadd{background-image:url(../resources/cbi/fieldadd.gif);color:#000000;padding-left:17px;padding-right:1px}input.cbi-input-reset,input.cbi-button-reset{background-color:#e30;color:#fff}input.cbi-input-save,input.cbi-button-save{background-color:#009ee0;color:#fff}input.cbi-input-apply,input.cbi-button-apply{background-color:#009ee0;color:#fff}input.cbi-input-link,input.cbi-button-link{background-image:url("../resources/cbi/link.gif");color:#000000;padding-left:17px;padding-right:1px}input.cbi-input-download,input.cbi-button-download{background-image:url("../resources/cbi/download.gif");color:#000000;padding-left:17px;padding-right:1px}input.cbi-input-remove,div.cbi-section-remove input{background-image:url("../resources/cbi/remove.gif");color:#000000;padding-left:17px;padding-right:1px}input.cbi-button-up{background-image:url("../resources/cbi/up.gif");padding-left:11px;padding-right:1px}input.cbi-button-down{background-image:url("../resources/cbi/down.gif");padding-left:11px;padding-right:1px}input.cbi-button-edit{background-image:url("../resources/cbi/edit.gif");color:#000000;padding-left:17px;padding-right:1px}input.cbi-button-reload{background-image:url("../resources/cbi/reload.gif");color:#000000;padding-left:17px;padding-right:1px}input.cbi-button-remove{background-image:url("../resources/cbi/remove.gif");color:#000000;padding-left:17px;padding-right:1px}.cbi-input-invalid{background:#e30 !important;color:white}div.cbi-section-remove input{border-bottom:none}textarea{margin-left:-1px;margin-bottom:0.5em}form>div>input[type=submit],form>div>input[type=reset]{margin-left:0.5em}table td,table th{color:#000000}table.smalltext{background:#f5f5f5;color:#000000;border-top:1px solid #666666;border-right:1px solid #666666;border-bottom:1px solid #666666;font-size:90%;width:80%;margin-left:auto;margin-right:auto;border-collapse:collapse}table.smalltext tr:hover td{background-color:#bbddee;color:#000000}table.smalltext tr th{padding:0 0.25em;border-left:1px solid #666666;text-align:left}table.smalltext tr td{padding:0 0.25em;border-top:1px solid #666666;border-left:1px solid #666666}table.cbi-section-table .cbi-rowstyle-1{background-color:#eeeeff;color:#000000}table.cbi-section-table .cbi-rowstyle-1:hover,table.cbi-section-table .cbi-rowstyle-2:hover{background-color:#b2c8d4;color:#000000}table.cbi-section-table .cbi-section-table-cell{padding:3px;white-space:nowrap}.cbi-section .cbi-rowstyle-1 h3{background-color:#eeeeff;color:#555555}.cbi-rowstyle-2{color:#000000}div.cbi-value{display:flex;flex-direction:row;margin-bottom:0.8em}.cbi-value-title{flex:2;text-align:right;padding-right:1em;font-weight:bold}div.cbi-value-field{flex:3}div.cbi-value-description{font-size:8pt}div.cbi-section-create{clear:left;white-space:nowrap;vertical-align:top}div.cbi-section-create .cbi-button{margin:0.25em}input.cbi-section-create-name{margin-right:-0.25em}div.cbi-map-descr{margin-bottom:1em}.cbi-map-descr:empty,.cbi-section-descr:empty{display:none}.cbi-map-descr,.cbi-section-descr,.cbi-page-actions{padding:1em;background:#ececec}.cbi-page-actions{text-align:right;display:flex;display:-moz-flex;-moz-flex-flow:row-reverse;flex-flow:row-reverse}div.cbi-optionals{padding:0.25em;border-bottom:1px dotted #bbbbbb}div.cbi-section-remove{float:right}.cbi-section-node{clear:both;position:relative;border:none}.cbi-section-node-tabbed{border-top-left-radius:0}.cbi-section-node .cbi-value-last{border-bottom:none}.cbi-section-node table div{padding-bottom:0;border-bottom:none}.cbi-section-node div.cbi-section-table-row{margin:0.25em}table.cbi-section-table{width:100%;font-size:95%}table.cbi-section-table th,table.cbi-section-table td{text-align:center}tr.cbi-section-table-descr th{font-weight:normal;font-size:90%;vertical-align:top}td.cbi-section-table-optionals{text-align:left !important;padding-top:1em}.cbi-value-helpicon img{display:none}div.cbi-error{font-size:95%;font-weight:bold;color:#ff0000;background-color:#ffffff}td.cbi-value-error{border-color:red}.cbi-value-error input,.cbi-value-error select{background-color:#ffcccc}.cbi-section-error{color:red;background-color:white;font-size:95%;border:1px dotted red;margin:3px;padding:3px}.cbi-value-field var{color:#2222FF}ul.cbi-tabmenu{padding:3px 0;margin-left:0 !important;list-style-type:none;position:relative;z-index:10;top:4px;line-height:20px}ul.cbi-tabmenu li.cbi-tab,ul.cbi-tabmenu li.cbi-tab-disabled{display:inline;margin:0}ul.cbi-tabmenu li.cbi-tab a,ul.cbi-tabmenu li.cbi-tab-disabled a{text-decoration:none;padding:3px 7px;margin-right:3px;border:1px solid #BBBBBB;border-bottom:none;border-radius:3px 3px 0 0;background-color:#EEEEEE;color:#BBBBBB}ul.cbi-tabmenu li.cbi-tab-highlighted a{color:#000000;background-color:#FFEEAA}ul.cbi-tabmenu li a:hover{color:#000000}ul.cbi-tabmenu li.cbi-tab a{padding-top:4px;color:#000000;background-color:#FFFFFF}div.cbi-tab-descr{background-image:url(/luci-static/resources/cbi/help.gif);background-position:0.25em 50%;background-repeat:no-repeat;border-bottom:1px solid #CCCCCC;margin:0.25em 0.25em 2em;padding:0.5em 0.5em 0.5em 2em}.left{text-align:left !important}.right{text-align:right !important}.luci{position:absolute;bottom:0;left:1em;height:1.5em;font-size:80%}.luci a:link,.luci a:visited{background-color:transparent;color:#666666;text-decoration:none;font-size:70%}.inline{display:inline}.error500{white-space:normal;border:1px dotted #ff0000;background-color:#ffffff;color:#000000;padding:0.5em}.errorbox{border:1px solid #FF0000;background-color:#FFCCCC;padding:5px;margin-bottom:5px}.errorbox a{color:#000000 !important}.ifacebox{background-color:#FFFFFF;border:1px solid #CCCCCC;margin:0 10px;text-align:center;white-space:nowrap}.ifacebox .ifacebox-head{border-bottom:1px solid #CCCCCC;padding:2px}.ifacebox .ifacebox-body{padding:2px}.ifacebadge{background-color:#FFFFFF;border:1px solid #CCCCCC;padding:2px;margin-left:2px;display:inline-block}.ifacebadge-active{border-color:#000000;font-weight:bold}.zonebadge{padding:2px;display:inline-block;white-space:nowrap;cursor:pointer}.zonebadge em,.zonebadge strong{margin:3px;display:inline-block}.zonebadge input{width:6em;height:1.5em}.zonebadge-empty{border:1px dashed #AAAAAA;color:#AAAAAA;font-style:italic;font-size:smaller}.uci-change-list{font-family:monospace}.uci-change-list ins,.uci-change-legend-label ins{text-decoration:none;border:1px solid #00FF00;background-color:#CCFFCC;display:block;padding:2px}.uci-change-list del,.uci-change-legend-label del{text-decoration:none;border:1px solid #FF0000;background-color:#FFCCCC;display:block;font-style:normal;padding:2px}.uci-change-list var,.uci-change-legend-label var{text-decoration:none;border:1px solid #CCCCCC;background-color:#EEEEEE;display:block;font-style:normal;padding:2px}.uci-change-list var ins,.uci-change-list var del{border:none;white-space:pre;font-style:normal;padding:0px}.uci-change-legend{padding:5px}.uci-change-legend-label{width:150px;float:left;font-size:80%}.uci-change-legend-label>ins,.uci-change-legend-label>del,.uci-change-legend-label>var{float:left;margin-right:4px;width:10px;height:10px;display:block}.uci-change-legend-label var ins,.uci-change-legend-label var del{line-height:6px;border:none}.cbi-input-password+img{display:none}.the-key{text-align:left;font-size:1.4em;background:#ffe9b3;border:3pt dashed #dc0067;margin-bottom:0.5em;padding:0.5em}
+@charset "UTF-8";.lang_he{direction:RTL;unicode-bidi:embed}.hidden{display:none}html{min-height:100%;height:auto;position:relative}body{font-family:'Open Sans', Arial, sans-serif;font-size:12pt;color:#4d4e53;line-height:1.5em;margin:0;display:flex;flex-direction:column;min-height:100vh;background-color:#f3f3f3}a img{border:none;text-decoration:none}.tabmenu1{text-align:center}ul.tabmenu{list-style:none;padding:0;margin:2em 0;display:inline-flex}ul.tabmenu li{white-space:nowrap;margin:0 0.5em;padding:0;text-align:center}ul.tabmenu li a{display:block;text-decoration:none;padding:1em;margin:0;color:#333;border-radius:2em}ul.tabmenu li a:hover{background:#ffe9b3}ul.tabmenu li.active a{font-weight:bold;background:white;color:#333}abbr,acronym{font-style:normal;font-variant:normal}abbr[title],acronym[title]{border-bottom:1px dotted;cursor:help}a:link abbr[title],a:visited abbr[title],a:link acronym[title],a:visited acronym[title]{cursor:pointer}code{font-family:monospace;white-space:pre}#maincontent ul{margin-left:2em}.warning{color:red;background-color:white;font-weight:bold}.clear{clear:both}.error{color:#ff0000;background-color:white}div.hostinfo{margin:0;padding:0;font-size:80%;padding:0.5em;flex:1;font-weight:bold}#xhr_poll_status{cursor:pointer}#xhr_poll_status #xhr_poll_status_off{font-weight:bold;color:#FF0000}#xhr_poll_status #xhr_poll_status_on{font-weight:bold;color:#00FF00}#menubar{display:flex;background:#dc0067;color:#ffffff}#menubar .warning{color:red;background-color:#557788}#menubar a:link,#menubar a:visited{position:relative;display:block;padding:0.5em;text-decoration:none;font-size:80%;font-weight:normal;color:white}#menubar a:link:hover,#menubar a:visited:hover,#menubar a:link:focus,#menubar a:visited:focus{background:#ffb400;color:black}#menubar a:link.active,#menubar a:visited.active{background:#ffb400;color:black;font-weight:bold}#menubar a:link.warning,#menubar a:visited.warning{background:#000000;color:red;font-weight:bold}#modemenu{list-style:none;margin:0;padding:0}#modemenu li{display:inline-block}.lang_de #submenu_admin_uci{width:12em}.lang_ru #submenu_admin_uci{width:11.5em}textarea#syslog{width:98%;min-height:500px;border:3px solid #cccccc;padding:5px;font-family:monospace}#maincontent{padding:0 1em 2em;max-width:60em;min-width:40em;margin:1em auto}.lang_he #maincontent{direction:rtl}#maincontent p{margin-bottom:1em}.cbi-section{margin:0;padding:0;border:none}.cbi-section legend{font-size:1.4em;font-weight:bold;color:#dc0067;position:relative;padding:0;margin-bottom:0.5em}.cbi-section h2{margin:0em 0 0.5em -0.5em !important}.cbi-section h3{text-decoration:none !important;font-weight:bold !important;color:#555555 !important;margin:0.25em !important;font-size:100% !important}.cbi-section-descr{margin-bottom:2em}.cbi-title-ref{color:inherit;text-decoration:none;padding-right:18px;background:url("../resources/cbi/link.gif") no-repeat scroll right center;background-color:inherit}ul.cbi-apply{font-size:90%}input:-webkit-input-placeholder{color:#AAAAAA}input:-moz-placeholder{color:#AAAAAA}input:-ms-input-placeholder{color:#AAAAAA}input[type=checkbox]{-moz-appearance:none;-webkit-appearance:none;-o-appearance:none;appearance:none;width:2em;height:2em;margin:0}input[type=checkbox]:checked{position:relative}input[type=checkbox]:checked::after{content:'✔';color:#dc0067;vertical-align:middle;position:absolute;top:50%;left:0;margin-top:-0.5em;width:100%;text-align:center;font-size:1.7em}input[type=submit],input[type=reset],input[type=image],input[type=button]{cursor:pointer}select,input,textarea{color:#003247;border:none;background:#ffe199;border-radius:3pt;padding:0.5em}input[type=image]{border:none}select,input[type=text],input[type=password]{width:20em}td select,td input[type=text],td input[type=password]{width:99%}img.cbi-image-button{cursor:pointer;margin:0 2px;vertical-align:middle}input.cbi-button{display:inline-block;zoom:1;line-height:normal;white-space:nowrap;vertical-align:baseline;text-align:center;cursor:pointer;-webkit-user-drag:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;font-size:100%;padding:0.5em 1em;color:rgba(0,0,0,0.8);border:none rgba(0,0,0,0);background-color:#E6E6E6;text-decoration:none;border-radius:2px;-webkit-transition:0.1s linear -webkit-box-shadow;-moz-transition:0.1s linear -moz-box-shadow;-ms-transition:0.1s linear box-shadow;-o-transition:0.1s linear box-shadow;transition:0.1s linear box-shadow;background-repeat:no-repeat}input.cbi-button::-moz-focus-inner{padding:0;border:0}input.cbi-button:active{box-shadow:0 0 0 1px rgba(0,0,0,0.15) inset,0 0 6px rgba(0,0,0,0.2) inset}input.cbi-button:focus{outline:0}input.cbi-button:hover,input.cbi-button:focus{background-image:-webkit-gradient(linear, 0 0, 0 100%, from(transparent), color-stop(40%, rgba(0,0,0,0.05)), to(rgba(0,0,0,0.1)));background-image:-webkit-linear-gradient(transparent, rgba(0,0,0,0.05) 40%, rgba(0,0,0,0.1));background-image:-moz-linear-gradient(top, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.1));background-image:-o-linear-gradient(transparent, rgba(0,0,0,0.05) 40%, rgba(0,0,0,0.1));background-image:linear-gradient(transparent, rgba(0,0,0,0.05) 40%, rgba(0,0,0,0.1))}input.cbi-button[disabled]{border:none;background-image:none;opacity:0.40;cursor:not-allowed;box-shadow:none}input.cbi-input-user{background-image:url("../resources/cbi/user.gif");background-repeat:no-repeat;background-position:1px center;color:#000000;text-indent:17px}input.cbi-input-find,input.cbi-button-find{background-image:url("../resources/cbi/find.gif");color:#000000;padding-left:17px}input.cbi-input-reload{background-image:url("../resources/cbi/reload.gif");color:#000000;padding-left:17px}input.cbi-input-add,input.cbi-button-add{background-image:url("../resources/cbi/add.gif");color:#000000;padding-left:17px;padding-right:1px}input.cbi-input-fieldadd,input.cbi-button-fieldadd{background-image:url(../resources/cbi/fieldadd.gif);color:#000000;padding-left:17px;padding-right:1px}input.cbi-input-reset,input.cbi-button-reset{background-color:#e30;color:#fff}input.cbi-input-save,input.cbi-button-save{background-color:#009ee0;color:#fff}input.cbi-input-apply,input.cbi-button-apply{background-color:#009ee0;color:#fff}input.cbi-input-link,input.cbi-button-link{background-image:url("../resources/cbi/link.gif");color:#000000;padding-left:17px;padding-right:1px}input.cbi-input-download,input.cbi-button-download{background-image:url("../resources/cbi/download.gif");color:#000000;padding-left:17px;padding-right:1px}input.cbi-input-remove,div.cbi-section-remove input{background-image:url("../resources/cbi/remove.gif");color:#000000;padding-left:17px;padding-right:1px}input.cbi-button-up{background-image:url("../resources/cbi/up.gif");padding-left:11px;padding-right:1px}input.cbi-button-down{background-image:url("../resources/cbi/down.gif");padding-left:11px;padding-right:1px}input.cbi-button-edit{background-image:url("../resources/cbi/edit.gif");color:#000000;padding-left:17px;padding-right:1px}input.cbi-button-reload{background-image:url("../resources/cbi/reload.gif");color:#000000;padding-left:17px;padding-right:1px}input.cbi-button-remove{background-image:url("../resources/cbi/remove.gif");color:#000000;padding-left:17px;padding-right:1px}.cbi-input-invalid{background:#e30 !important;color:white}div.cbi-section-remove input{border-bottom:none}textarea{margin-left:-1px;margin-bottom:0.5em}form>div>input[type=submit],form>div>input[type=reset]{margin-left:0.5em}table td,table th{color:#000000}table.smalltext{background:#f5f5f5;color:#000000;border-top:1px solid #666666;border-right:1px solid #666666;border-bottom:1px solid #666666;font-size:90%;width:80%;margin-left:auto;margin-right:auto;border-collapse:collapse}table.smalltext tr:hover td{background-color:#bbddee;color:#000000}table.smalltext tr th{padding:0 0.25em;border-left:1px solid #666666;text-align:left}table.smalltext tr td{padding:0 0.25em;border-top:1px solid #666666;border-left:1px solid #666666}table.cbi-section-table .cbi-rowstyle-1{background-color:#eeeeff;color:#000000}table.cbi-section-table .cbi-rowstyle-1:hover,table.cbi-section-table .cbi-rowstyle-2:hover{background-color:#b2c8d4;color:#000000}table.cbi-section-table .cbi-section-table-cell{padding:3px;white-space:nowrap}.cbi-section .cbi-rowstyle-1 h3{background-color:#eeeeff;color:#555555}.cbi-rowstyle-2{color:#000000}div.cbi-value{display:flex;flex-direction:row;margin-bottom:0.5em}.cbi-value-title{flex:2;text-align:right;padding-top:0.39em;padding-right:1em;font-weight:bold}div.cbi-value-field{flex:3}div.cbi-value-description{font-size:8pt}div.cbi-section-create{clear:left;white-space:nowrap;vertical-align:top}div.cbi-section-create .cbi-button{margin:0.25em}input.cbi-section-create-name{margin-right:-0.25em}div.cbi-map-descr{margin-bottom:1em}.cbi-map-descr:empty,.cbi-section-descr:empty{display:none}.cbi-map-descr,.cbi-section-descr,.cbi-page-actions{padding:1em;background:#ececec}.cbi-page-actions{text-align:right;display:flex;display:-moz-flex;-moz-flex-flow:row-reverse;flex-flow:row-reverse}div.cbi-optionals{padding:0.25em;border-bottom:1px dotted #bbbbbb}div.cbi-section-remove{float:right}.cbi-section-node{clear:both;position:relative;border:none}.cbi-section-node-tabbed{border-top-left-radius:0}.cbi-section-node .cbi-value-last{border-bottom:none}.cbi-section-node table div{padding-bottom:0;border-bottom:none}.cbi-section-node div.cbi-section-table-row{margin:0.25em}table.cbi-section-table{width:100%;font-size:95%}table.cbi-section-table th,table.cbi-section-table td{text-align:center}tr.cbi-section-table-descr th{font-weight:normal;font-size:90%;vertical-align:top}td.cbi-section-table-optionals{text-align:left !important;padding-top:1em}.cbi-value-helpicon img{display:none}div.cbi-error{font-size:95%;font-weight:bold;color:#ff0000;background-color:#ffffff}td.cbi-value-error{border-color:red}.cbi-value-error input,.cbi-value-error select{background-color:#ffcccc}.cbi-section-error{color:red;background-color:white;font-size:95%;border:1px dotted red;margin:3px;padding:3px}.cbi-value-field var{color:#2222FF}ul.cbi-tabmenu{padding:3px 0;margin-left:0 !important;list-style-type:none;position:relative;z-index:10;top:4px;line-height:20px}ul.cbi-tabmenu li.cbi-tab,ul.cbi-tabmenu li.cbi-tab-disabled{display:inline;margin:0}ul.cbi-tabmenu li.cbi-tab a,ul.cbi-tabmenu li.cbi-tab-disabled a{text-decoration:none;padding:3px 7px;margin-right:3px;border:1px solid #BBBBBB;border-bottom:none;border-radius:3px 3px 0 0;background-color:#EEEEEE;color:#BBBBBB}ul.cbi-tabmenu li.cbi-tab-highlighted a{color:#000000;background-color:#FFEEAA}ul.cbi-tabmenu li a:hover{color:#000000}ul.cbi-tabmenu li.cbi-tab a{padding-top:4px;color:#000000;background-color:#FFFFFF}div.cbi-tab-descr{background-image:url(/luci-static/resources/cbi/help.gif);background-position:0.25em 50%;background-repeat:no-repeat;border-bottom:1px solid #CCCCCC;margin:0.25em 0.25em 2em;padding:0.5em 0.5em 0.5em 2em}.left{text-align:left !important}.right{text-align:right !important}.luci{position:absolute;bottom:0;left:1em;height:1.5em;font-size:80%}.luci a:link,.luci a:visited{background-color:transparent;color:#666666;text-decoration:none;font-size:70%}.inline{display:inline}.error500{white-space:normal;border:1px dotted #ff0000;background-color:#ffffff;color:#000000;padding:0.5em}.errorbox{border:1px solid #FF0000;background-color:#FFCCCC;padding:5px;margin-bottom:5px}.errorbox a{color:#000000 !important}.ifacebox{background-color:#FFFFFF;border:1px solid #CCCCCC;margin:0 10px;text-align:center;white-space:nowrap}.ifacebox .ifacebox-head{border-bottom:1px solid #CCCCCC;padding:2px}.ifacebox .ifacebox-body{padding:2px}.ifacebadge{background-color:#FFFFFF;border:1px solid #CCCCCC;padding:2px;margin-left:2px;display:inline-block}.ifacebadge-active{border-color:#000000;font-weight:bold}.zonebadge{padding:2px;display:inline-block;white-space:nowrap;cursor:pointer}.zonebadge em,.zonebadge strong{margin:3px;display:inline-block}.zonebadge input{width:6em;height:1.5em}.zonebadge-empty{border:1px dashed #AAAAAA;color:#AAAAAA;font-style:italic;font-size:smaller}.uci-change-list{font-family:monospace}.uci-change-list ins,.uci-change-legend-label ins{text-decoration:none;border:1px solid #00FF00;background-color:#CCFFCC;display:block;padding:2px}.uci-change-list del,.uci-change-legend-label del{text-decoration:none;border:1px solid #FF0000;background-color:#FFCCCC;display:block;font-style:normal;padding:2px}.uci-change-list var,.uci-change-legend-label var{text-decoration:none;border:1px solid #CCCCCC;background-color:#EEEEEE;display:block;font-style:normal;padding:2px}.uci-change-list var ins,.uci-change-list var del{border:none;white-space:pre;font-style:normal;padding:0px}.uci-change-legend{padding:5px}.uci-change-legend-label{width:150px;float:left;font-size:80%}.uci-change-legend-label>ins,.uci-change-legend-label>del,.uci-change-legend-label>var{float:left;margin-right:4px;width:10px;height:10px;display:block}.uci-change-legend-label var ins,.uci-change-legend-label var del{line-height:6px;border:none}.cbi-input-password+img{display:none}.the-key{text-align:left;font-size:1.4em;background:#ffe9b3;border:3pt dashed #dc0067;margin-bottom:0.5em;padding:0.5em}
diff --git a/package/gluon-luci-theme/sass/cascade.scss b/package/gluon-luci-theme/sass/cascade.scss
index 01465f48..70892a5b 100644
--- a/package/gluon-luci-theme/sass/cascade.scss
+++ b/package/gluon-luci-theme/sass/cascade.scss
@@ -632,12 +632,13 @@ table.cbi-section-table .cbi-section-table-cell {
 div.cbi-value {
   display: flex;
   flex-direction: row;
-  margin-bottom: 0.8em;
+  margin-bottom: 0.5em;
 }
 
 .cbi-value-title {
   flex: 2;
   text-align: right;
+  padding-top: 0.39em;
   padding-right: 1em;
   font-weight: bold;
 }

From 8a32dd7887c14a04b415897c939a030b0b247fe4 Mon Sep 17 00:00:00 2001
From: Jan-Philipp Litza 
Date: Fri, 8 Aug 2014 14:50:00 +0200
Subject: [PATCH 349/453] gluon-announced: fix help message

It incorrectly stated "-m" to be the multicast group option, when it really was "-g"
---
 package/gluon-announced/src/gluon-announced.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/gluon-announced/src/gluon-announced.c b/package/gluon-announced/src/gluon-announced.c
index b6758f09..b1f6da17 100644
--- a/package/gluon-announced/src/gluon-announced.c
+++ b/package/gluon-announced/src/gluon-announced.c
@@ -34,8 +34,8 @@
 #include 
 
 void usage() {
-  puts("Usage: gluon-announced [-h] -m  -p  -i  [-i  ..] -s ")
+io.write("" .. hostname .. "")
+io.write("")
+io.write("")
 
-echo "

$(cat /proc/sys/kernel/hostname)

" +io.write("

" .. hostname .. "

") +io.write("
")
 
-echo "
"
+io.write("Model: " .. model .. "\n")
+io.write("Firmware release: " .. release .. "\n\n")
 
-echo "Model: $model" | escape_html
-echo "Firmware release: $(cat /lib/gluon/release | escape_html)"
-echo
+io.write(util.trim(sys.exec("uptime | sed 's/^ \+//'")) .. "\n\n")
+io.write(sys.exec("ip address show dev br-client") .. "\n")
+io.write(sys.exec("free -m") .. "\n")
+io.write(sys.exec("df /rom /overlay"))
+io.write("
") -uptime | sed 's/^ \+//' | escape_html -echo +io.write("

Neighbours

") -ip address show dev br-client | escape_html -echo +local interfaces = util.split(util.trim(util.exec("iw dev | grep IBSS -B 5 | grep Interface | cut -d' ' -f2"))) -free -m | escape_html -echo +for _, ifname in ipairs(interfaces) do + io.write("

" .. ifname .. "

") + io.write("
")
 
-df /rom /overlay | escape_html
+  io.write(sys.exec("iw dev " .. ifname .. " link") .. "\n")
 
-echo "
" + for _, line in ipairs(util.split(util.exec("iw dev " .. ifname .. " station dump"))) do + local mac = line:match("^Station (.*) %(on ") + if mac then + io.write("Station " .. mac .. " (on " .. ifname .. ")\n") + else + io.write(line .. "\n") + end + end -echo "

Neighbours

" + io.write("
") +end +io.write("") +io.write("") +io.write("") diff --git a/package/gluon-status-page/files/lib/gluon/status-page/www/status.js b/package/gluon-status-page/files/lib/gluon/status-page/www/status.js new file mode 100644 index 00000000..e17102d0 --- /dev/null +++ b/package/gluon-status-page/files/lib/gluon/status-page/www/status.js @@ -0,0 +1,9 @@ +function update_node(id, ip, hostname) { + var el = document.getElementById(id); + + if (!el) + return; + + el.href = "http://[" + ip + "]/"; + el.textContent += " (" + hostname + ")"; +} From 5266a073342924fb6a07e9ae2b21ec0004492742 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Thu, 13 Nov 2014 01:24:46 +0100 Subject: [PATCH 391/453] status-page: escape html, move script to body --- .../lib/gluon/status-page/www/cgi-bin/status | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status b/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status index 59c2e00f..aa74b853 100755 --- a/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status +++ b/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status @@ -10,6 +10,10 @@ local hostname = sys.hostname() local model = platform_info.get_model() local release = util.trim(fs.readfile("/lib/gluon/release") or "") +function escape_html(s) + return (s:gsub('&', '&'):gsub('<', '<'):gsub('>', '>'):gsub('"', '"')) +end + function neighbours(ifname) local info = util.exec("gluon-neighbour-info -d ff02::2:1001 -p 1001 -r nodeinfo -t 3 -i " .. ifname) local macs = {} @@ -32,20 +36,20 @@ io.write("\n") io.write("") io.write("") io.write("") -io.write("" .. hostname .. "") +io.write("" .. escape_html(hostname) .. "") io.write("") io.write("") -io.write("

" .. hostname .. "

") +io.write("

" .. escape_html(hostname) .. "

") io.write("
")
 
-io.write("Model: " .. model .. "\n")
-io.write("Firmware release: " .. release .. "\n\n")
+io.write("Model: " .. escape_html(model) .. "\n")
+io.write("Firmware release: " .. escape_html(release) .. "\n\n")
 
-io.write(util.trim(sys.exec("uptime | sed 's/^ \+//'")) .. "\n\n")
-io.write(sys.exec("ip address show dev br-client") .. "\n")
-io.write(sys.exec("free -m") .. "\n")
-io.write(sys.exec("df /rom /overlay"))
+io.write(escape_html(util.trim(sys.exec("uptime | sed 's/^ \+//'"))) .. "\n\n")
+io.write(escape_html(sys.exec("ip address show dev br-client")) .. "\n")
+io.write(escape_html(sys.exec("free -m")) .. "\n")
+io.write(escape_html(sys.exec("df /rom /overlay")))
 io.write("
") io.write("

Neighbours

") @@ -53,24 +57,23 @@ io.write("

Neighbours

") local interfaces = util.split(util.trim(util.exec("iw dev | grep IBSS -B 5 | grep Interface | cut -d' ' -f2"))) for _, ifname in ipairs(interfaces) do - io.write("

" .. ifname .. "

") + io.write("

" .. escape_html(ifname) .. "

") io.write("
")
 
-  io.write(sys.exec("iw dev " .. ifname .. " link") .. "\n")
+  io.write(escape_html(sys.exec("iw dev " .. ifname .. " link")) .. "\n")
 
   for _, line in ipairs(util.split(util.exec("iw dev " .. ifname .. " station dump"))) do
     local mac = line:match("^Station (.*) %(on ")
     if mac then
-      io.write("Station " .. mac .. " (on " .. ifname .. ")\n")
+      io.write("Station " .. mac .. " (on " .. escape_html(ifname) .. ")\n")
     else
-      io.write(line .. "\n")
+      io.write(escape_html(line) .. "\n")
     end
   end
 
   io.write("
") end -io.write("") io.write("") +io.write("") io.write("") From 7bd30f9c840070f82e5bb7a71cb249907bad341a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 13 Nov 2014 02:23:47 +0100 Subject: [PATCH 392/453] gluon-ebtables-filter-multicast: allow hop-by-hop options as ICMPv6 is sometimes prefixed by an HBH header --- .../files/lib/gluon/ebtables/110-mcast-allow-icmpv6 | 1 + 1 file changed, 1 insertion(+) diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 index b670ff45..a7b67414 100644 --- a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 @@ -1 +1,2 @@ +rule 'MULTICAST_OUT -p IPv6 --ip6-protocol 0 -j RETURN' -- hop-by-hop rule 'MULTICAST_OUT -p IPv6 --ip6-protocol ipv6-icmp -j RETURN' From 5ee5cf3ec149c90c4140bd382406d967d130494d Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 17 Nov 2014 03:23:36 +0100 Subject: [PATCH 393/453] gluon-mesh-vpn-fastd: configure a status socket --- .../gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd | 1 + 1 file changed, 1 insertion(+) diff --git a/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd index 4697762c..dcd14c3f 100755 --- a/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd +++ b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd @@ -26,6 +26,7 @@ c:section('fastd', 'fastd', 'mesh_vpn', secure_handshakes = '1', method = site.fastd_mesh_vpn.methods, packet_mark = 1, + status_socket = '/var/run/fastd.mesh_vpn.socket', } ) c:delete('fastd', 'mesh_vpn', 'user') From 691f0cb6c5a4b1e332838aff36719099e34cfc68 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 17 Nov 2014 03:24:08 +0100 Subject: [PATCH 394/453] gluon-status-page: show VPN status (very minimalistic for now) --- .../lib/gluon/status-page/www/cgi-bin/status | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status b/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status index aa74b853..af91d8c0 100755 --- a/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status +++ b/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status @@ -2,8 +2,10 @@ local util = require("luci.util") local fs = require("luci.fs") +local ltn12 = require 'luci.ltn12' local sys = require("luci.sys") local json = require("luci.json") +local nixio = require 'nixio' local platform_info = require("platform_info") local hostname = sys.hostname() @@ -74,6 +76,65 @@ for _, ifname in ipairs(interfaces) do io.write("
") end +local err, fastd_status = pcall( + function() + local fastd_sock = nixio.socket('unix', 'stream') + assert(fastd_sock:connect('/var/run/fastd.mesh_vpn.socket')) + + -- Stop as soon as we see an empty chunk + local function guard_source(src) + return function() + local chunk, err = src() + if not chunk then return nil, err end + if chunk:len() == 0 then return nil end + return chunk + end + end + + source = guard_source(ltn12.source.file(fastd_sock)) + decoder = json.Decoder() + ltn12.pump.all(source, decoder:sink()) + fastd_sock:close() + + return decoder:get() + end +) + +io.write("

VPN status

") +io.write("
")
+
+if fastd_status then
+  io.write(string.format("fastd running for %.3f seconds\n", fastd_status.uptime/1000))
+
+  local peers = 0
+  local connections = 0
+
+  for key, peer in pairs(fastd_status.peers) do
+    peers = peers+1
+
+    if peer.connection then
+      connections = connections+1
+    end
+  end
+
+  io.write(string.format("There are %i peers configured, of which %i are connected:\n\n", peers, connections))
+
+  for key, peer in pairs(fastd_status.peers) do
+    io.write(string.format("%s: ", escape_html(peer.name)))
+
+    if peer.connection then
+      io.write(string.format("connected for %.3f seconds\n", peer.connection.established/1000))
+    else
+      io.write("not connected\n")
+    end
+  end
+
+else
+  io.write("fastd not running")
+end
+
+io.write("
") + io.write("
diff --git a/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm b/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm index dd547f35..e8f32d99 100644 --- a/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm +++ b/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm @@ -9,7 +9,7 @@
-

Dein Freifunkknoten ist nun fertig eingerichtet.

+

<%:Your node's setup is now complete.%>

<% for k, v in ipairs(parts) do v() end %>
diff --git a/package/gluon-config-mode-core/i18n/de.po b/package/gluon-config-mode-core/i18n/de.po new file mode 100644 index 00000000..6f852f43 --- /dev/null +++ b/package/gluon-config-mode-core/i18n/de.po @@ -0,0 +1,24 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"PO-Revision-Date: 2015-03-19 02:07+0100\n" +"Last-Translator: Matthias Schiffer \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 Freifunkknoten ist nun fertig eingerichtet." diff --git a/package/gluon-config-mode-core/i18n/en.po b/package/gluon-config-mode-core/i18n/en.po new file mode 100644 index 00000000..d0758a04 --- /dev/null +++ b/package/gluon-config-mode-core/i18n/en.po @@ -0,0 +1,24 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"PO-Revision-Date: 2015-03-19 02:07+0100\n" +"Last-Translator: Matthias Schiffer \n" +"Language-Team: English\n" +"Language: en\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 "Save & restart" + +msgid "Welcome!" +msgstr "Welcome!" + +msgid "Wizard" +msgstr "Wizard" + +msgid "Your node's setup is now complete." +msgstr "Your node's setup is now complete." diff --git a/package/gluon-config-mode-core/i18n/gluon-config-mode-core.pot b/package/gluon-config-mode-core/i18n/gluon-config-mode-core.pot new file mode 100644 index 00000000..a80d3b97 --- /dev/null +++ b/package/gluon-config-mode-core/i18n/gluon-config-mode-core.pot @@ -0,0 +1,14 @@ +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 "" From 113f362c30e315ac7e89ef7c753704becc9af53c Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 19 Mar 2015 03:54:12 +0100 Subject: [PATCH 436/453] gluon-config: use PKG_FILE_DEPENDS --- package/gluon-config/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package/gluon-config/Makefile b/package/gluon-config/Makefile index 988fb867..dd53b6bc 100644 --- a/package/gluon-config/Makefile +++ b/package/gluon-config/Makefile @@ -2,7 +2,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-config PKG_VERSION:=$(GLUON_SITE_CODE) -PKG_RELEASE:=$(GLUON_RELEASE).$(shell $(MD5SUM) $(GLUON_SITEDIR)/site.conf) +PKG_RELEASE:=0.$(GLUON_RELEASE) + +PKG_FILE_DEPENDS := $(GLUON_SITEDIR)/ PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) From d9366935e3c9f32837484c35fd818aeb8805156a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 19 Mar 2015 19:05:42 +0100 Subject: [PATCH 437/453] gluon-config-mode-*: add source directory to GluonBuildI18N calls --- package/gluon-config-mode-autoupdater/Makefile | 2 +- package/gluon-config-mode-contact-info/Makefile | 2 +- package/gluon-config-mode-core/Makefile | 2 +- package/gluon-config-mode-geo-location/Makefile | 2 +- package/gluon-config-mode-hostname/Makefile | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package/gluon-config-mode-autoupdater/Makefile b/package/gluon-config-mode-autoupdater/Makefile index 6e32b2b9..d480e132 100644 --- a/package/gluon-config-mode-autoupdater/Makefile +++ b/package/gluon-config-mode-autoupdater/Makefile @@ -29,7 +29,7 @@ define Build/Configure endef define Build/Compile - $(call GluonBuildI18N,gluon-config-mode-autoupdater) + $(call GluonBuildI18N,gluon-config-mode-autoupdater,i18n) endef define Package/gluon-config-mode-autoupdater/install diff --git a/package/gluon-config-mode-contact-info/Makefile b/package/gluon-config-mode-contact-info/Makefile index 0248f80e..d5c50dd6 100644 --- a/package/gluon-config-mode-contact-info/Makefile +++ b/package/gluon-config-mode-contact-info/Makefile @@ -25,7 +25,7 @@ define Build/Configure endef define Build/Compile - $(call GluonBuildI18N,gluon-config-mode-contact-info) + $(call GluonBuildI18N,gluon-config-mode-contact-info,i18n) endef define Package/gluon-config-mode-contact-info/install diff --git a/package/gluon-config-mode-core/Makefile b/package/gluon-config-mode-core/Makefile index 51049962..329abe23 100644 --- a/package/gluon-config-mode-core/Makefile +++ b/package/gluon-config-mode-core/Makefile @@ -28,7 +28,7 @@ define Build/Configure endef define Build/Compile - $(call GluonBuildI18N,gluon-config-mode-core) + $(call GluonBuildI18N,gluon-config-mode-core,i18n) endef define Package/gluon-config-mode-core/install diff --git a/package/gluon-config-mode-geo-location/Makefile b/package/gluon-config-mode-geo-location/Makefile index 4ce31f12..4b5204e0 100644 --- a/package/gluon-config-mode-geo-location/Makefile +++ b/package/gluon-config-mode-geo-location/Makefile @@ -25,7 +25,7 @@ define Build/Configure endef define Build/Compile - $(call GluonBuildI18N,gluon-config-mode-geo-location) + $(call GluonBuildI18N,gluon-config-mode-geo-location,i18n) endef define Package/gluon-config-mode-geo-location/install diff --git a/package/gluon-config-mode-hostname/Makefile b/package/gluon-config-mode-hostname/Makefile index 9eabeb68..255740e4 100644 --- a/package/gluon-config-mode-hostname/Makefile +++ b/package/gluon-config-mode-hostname/Makefile @@ -25,7 +25,7 @@ define Build/Configure endef define Build/Compile - $(call GluonBuildI18N,gluon-config-mode-hostname) + $(call GluonBuildI18N,gluon-config-mode-hostname,i18n) endef define Package/gluon-config-mode-hostname/install From 65b44ca4ceca6ed4296e77edc1d5134396fa8a74 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 19 Mar 2015 20:14:40 +0100 Subject: [PATCH 438/453] Rename gluon-config to gluon-site --- package/gluon-core/Makefile | 2 +- package/{gluon-config => gluon-site}/Makefile | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) rename package/{gluon-config => gluon-site}/Makefile (78%) diff --git a/package/gluon-core/Makefile b/package/gluon-core/Makefile index ebb5268f..2c632a00 100644 --- a/package/gluon-core/Makefile +++ b/package/gluon-core/Makefile @@ -12,7 +12,7 @@ define Package/gluon-core SECTION:=gluon CATEGORY:=Gluon TITLE:=Base files of Gluon - DEPENDS:=+gluon-config +lua-platform-info +luci-lib-nixio +odhcp6c +firewall + DEPENDS:=+gluon-site +lua-platform-info +luci-lib-nixio +odhcp6c +firewall endef diff --git a/package/gluon-config/Makefile b/package/gluon-site/Makefile similarity index 78% rename from package/gluon-config/Makefile rename to package/gluon-site/Makefile index dd53b6bc..d8147359 100644 --- a/package/gluon-config/Makefile +++ b/package/gluon-site/Makefile @@ -1,6 +1,6 @@ include $(TOPDIR)/rules.mk -PKG_NAME:=gluon-config +PKG_NAME:=gluon-site PKG_VERSION:=$(GLUON_SITE_CODE) PKG_RELEASE:=0.$(GLUON_RELEASE) @@ -10,13 +10,13 @@ PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) include $(INCLUDE_DIR)/package.mk -define Package/gluon-config +define Package/gluon-site SECTION:=gluon CATEGORY:=Gluon TITLE:=Site-specific config files of Gluon endef -define Package/gluon-config/description +define Package/gluon-site/description Gluon community wifi mesh firmware framework: site configuration endef @@ -30,10 +30,10 @@ endef define Build/Compile endef -define Package/gluon-config/install +define Package/gluon-site/install $(INSTALL_DIR) $(1)/lib/gluon $(CP) $(GLUON_SITEDIR)/site.conf $(1)/lib/gluon/site.conf echo "$(GLUON_RELEASE)" > $(1)/lib/gluon/release endef -$(eval $(call BuildPackage,gluon-config)) +$(eval $(call BuildPackage,gluon-site)) From 87370a456d2ab52a8397de89025ed656809f6ef3 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 19 Mar 2015 20:28:02 +0100 Subject: [PATCH 439/453] gluon-site: add POT file for site-configurable messages --- package/gluon-site/i18n/gluon-site.pot | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 package/gluon-site/i18n/gluon-site.pot diff --git a/package/gluon-site/i18n/gluon-site.pot b/package/gluon-site/i18n/gluon-site.pot new file mode 100644 index 00000000..670de410 --- /dev/null +++ b/package/gluon-site/i18n/gluon-site.pot @@ -0,0 +1,11 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +msgid "gluon-config-mode:welcome" +msgstr "" + +msgid "gluon-config-mode:pubkey" +msgstr "" + +msgid "gluon-config-mode:reboot" +msgstr "" From 0e9095b58c25183ea02bebeab202b59f5d722d02 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 19 Mar 2015 21:14:41 +0100 Subject: [PATCH 440/453] gluon-config-mode-contact-info: add missing translation --- .../gluon/config-mode/wizard/0500-contact-info.lua | 2 +- package/gluon-config-mode-contact-info/i18n/de.po | 13 ++++++++----- package/gluon-config-mode-contact-info/i18n/en.po | 5 ++++- .../i18n/gluon-config-mode-contact-info.pot | 3 +++ 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/package/gluon-config-mode-contact-info/files/lib/gluon/config-mode/wizard/0500-contact-info.lua b/package/gluon-config-mode-contact-info/files/lib/gluon/config-mode/wizard/0500-contact-info.lua index f6e3eade..a2182f95 100644 --- a/package/gluon-config-mode-contact-info/files/lib/gluon/config-mode/wizard/0500-contact-info.lua +++ b/package/gluon-config-mode-contact-info/files/lib/gluon/config-mode/wizard/0500-contact-info.lua @@ -17,7 +17,7 @@ function M.section(form) o.default = uci:get_first("gluon-node-info", "owner", "contact", "") o.rmempty = true o.datatype = "string" - o.description = "e.g. E-mail or phone number" + o.description = i18n.translate("e.g. E-mail or phone number") o.maxlen = 140 end diff --git a/package/gluon-config-mode-contact-info/i18n/de.po b/package/gluon-config-mode-contact-info/i18n/de.po index 4cf42535..e802524c 100644 --- a/package/gluon-config-mode-contact-info/i18n/de.po +++ b/package/gluon-config-mode-contact-info/i18n/de.po @@ -1,12 +1,12 @@ msgid "" msgstr "" -"Content-Type: text/plain; charset=UTF-8\n" "Project-Id-Version: PACKAGE VERSION\n" "PO-Revision-Date: 2015-03-19 01:32+0100\n" "Last-Translator: Matthias Schiffer \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" @@ -18,7 +18,10 @@ msgid "" "you. Please note that this information will be visible publicly on " "the internet together with your node's coordinates." msgstr "" -"Hier kannst du einen öffentlichen Hinweis hinterlegen, um " -"anderen Freifunkern zu ermöglichen, Kontakt mit dir aufzunehmen. Bitte " -"beachte, dass dieser Hinweis auch öffentlich im Internet, zusammen mit " -"den Koordinaten deines Knotens, einsehbar sein wird." +"Hier kannst du einen öffentlichen Hinweis hinterlegen, um anderen " +"Freifunkern zu ermöglichen, Kontakt mit dir aufzunehmen. Bitte beachte, dass " +"dieser Hinweis auch öffentlich im Internet, zusammen mit den Koordinaten " +"deines Knotens, einsehbar sein wird." + +msgid "e.g. E-mail or phone number" +msgstr "z.B. E-Mail oder Telefonnummer" diff --git a/package/gluon-config-mode-contact-info/i18n/en.po b/package/gluon-config-mode-contact-info/i18n/en.po index fdf8805e..1b1b8816 100644 --- a/package/gluon-config-mode-contact-info/i18n/en.po +++ b/package/gluon-config-mode-contact-info/i18n/en.po @@ -1,12 +1,12 @@ msgid "" msgstr "" -"Content-Type: text/plain; charset=UTF-8\n" "Project-Id-Version: PACKAGE VERSION\n" "PO-Revision-Date: 2015-03-19 01:32+0100\n" "Last-Translator: Matthias Schiffer \n" "Language-Team: English\n" "Language: en\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" @@ -21,3 +21,6 @@ msgstr "" "You can provide your contact information here to allow others to contact " "you. Please note that this information will be visible publicly on " "the internet together with your node's coordinates." + +msgid "e.g. E-mail or phone number" +msgstr "e.g. E-mail or phone number" diff --git a/package/gluon-config-mode-contact-info/i18n/gluon-config-mode-contact-info.pot b/package/gluon-config-mode-contact-info/i18n/gluon-config-mode-contact-info.pot index eace2af2..63939a83 100644 --- a/package/gluon-config-mode-contact-info/i18n/gluon-config-mode-contact-info.pot +++ b/package/gluon-config-mode-contact-info/i18n/gluon-config-mode-contact-info.pot @@ -9,3 +9,6 @@ msgid "" "you. Please note that this information will be visible publicly on " "the internet together with your node's coordinates." msgstr "" + +msgid "e.g. E-mail or phone number" +msgstr "" From 5805e78455928a6839f68ae97cde0eba26afc6d1 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 19 Mar 2015 21:31:44 +0100 Subject: [PATCH 441/453] gluon-site: add translations from the site configuration --- package/gluon-site/Makefile | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/package/gluon-site/Makefile b/package/gluon-site/Makefile index d8147359..50936202 100644 --- a/package/gluon-site/Makefile +++ b/package/gluon-site/Makefile @@ -5,19 +5,19 @@ PKG_VERSION:=$(GLUON_SITE_CODE) PKG_RELEASE:=0.$(GLUON_RELEASE) PKG_FILE_DEPENDS := $(GLUON_SITEDIR)/ +PKG_BUILD_DEPENDS := luci PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) -include $(INCLUDE_DIR)/package.mk +include $(GLUONDIR)/include/package.mk + +PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG) + define Package/gluon-site SECTION:=gluon CATEGORY:=Gluon - TITLE:=Site-specific config files of Gluon -endef - -define Package/gluon-site/description - Gluon community wifi mesh firmware framework: site configuration + TITLE:=Site-specific files of Gluon endef define Build/Prepare @@ -28,12 +28,15 @@ define Build/Configure endef define Build/Compile + $(call GluonBuildI18N,gluon-site,$(GLUON_SITEDIR)/i18n) endef define Package/gluon-site/install $(INSTALL_DIR) $(1)/lib/gluon $(CP) $(GLUON_SITEDIR)/site.conf $(1)/lib/gluon/site.conf echo "$(GLUON_RELEASE)" > $(1)/lib/gluon/release + + $(call GluonInstallI18N,gluon-site,$(1)) endef $(eval $(call BuildPackage,gluon-site)) From ce82baf0ad2003164a63218e83b0189d9ab307b0 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 19 Mar 2015 22:11:43 +0100 Subject: [PATCH 442/453] gluon-config-mode-core: use translated messages from the site configuration --- package/gluon-config-mode-core/Makefile | 5 ----- package/gluon-config-mode-core/check_site.lua | 2 -- .../files/lib/gluon/config-mode/reboot/0900-msg-reboot.lua | 4 ++-- .../usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm | 4 ++-- 4 files changed, 4 insertions(+), 11 deletions(-) delete mode 100644 package/gluon-config-mode-core/check_site.lua diff --git a/package/gluon-config-mode-core/Makefile b/package/gluon-config-mode-core/Makefile index 329abe23..35946b27 100644 --- a/package/gluon-config-mode-core/Makefile +++ b/package/gluon-config-mode-core/Makefile @@ -36,9 +36,4 @@ define Package/gluon-config-mode-core/install $(call GluonInstallI18N,gluon-config-mode-core,$(1)) endef -define Package/gluon-config-mode-core/postinst -#!/bin/sh -$(call GluonCheckSite,check_site.lua) -endef - $(eval $(call BuildPackage,gluon-config-mode-core)) diff --git a/package/gluon-config-mode-core/check_site.lua b/package/gluon-config-mode-core/check_site.lua deleted file mode 100644 index 2ee08b0e..00000000 --- a/package/gluon-config-mode-core/check_site.lua +++ /dev/null @@ -1,2 +0,0 @@ -need_string 'config_mode.msg_welcome' -need_string 'config_mode.msg_reboot' diff --git a/package/gluon-config-mode-core/files/lib/gluon/config-mode/reboot/0900-msg-reboot.lua b/package/gluon-config-mode-core/files/lib/gluon/config-mode/reboot/0900-msg-reboot.lua index e35bf308..bf27c07f 100644 --- a/package/gluon-config-mode-core/files/lib/gluon/config-mode/reboot/0900-msg-reboot.lua +++ b/package/gluon-config-mode-core/files/lib/gluon/config-mode/reboot/0900-msg-reboot.lua @@ -1,3 +1,3 @@ -local site = require 'gluon.site_config' +local i18n = require 'luci.i18n' -return function () luci.template.render_string(site.config_mode.msg_reboot) end +return function () luci.template.render_string(i18n.translate('gluon-config-mode:reboot')) end diff --git a/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm b/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm index ee0b2f8e..d2210eca 100644 --- a/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm +++ b/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm @@ -1,12 +1,12 @@ <%- - local site = require 'gluon.site_config' local sysconfig = require 'gluon.sysconfig' + local i18n = require 'luci.i18n' local template = require 'luci.template' -%>

<%:Welcome!%>

- <%= template.render_string(site.config_mode.msg_welcome, {hostname=hostname, sysconfig=sysconfig}) %> + <%= template.render_string(i18n.translate('gluon-config-mode:welcome'), {hostname=hostname, sysconfig=sysconfig}) %>

<% if not self.embedded then %> From 7896f91f868d19edf95059c7b6a3d0ba54c59036 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 19 Mar 2015 22:22:39 +0100 Subject: [PATCH 443/453] gluon-config-mode-mesh-vpn: add translations --- package/gluon-config-mode-mesh-vpn/Makefile | 10 +++--- .../gluon-config-mode-mesh-vpn/check_site.lua | 1 - .../config-mode/reboot/0100-mesh-vpn.lua | 17 +++++---- .../config-mode/wizard/0300-mesh-vpn.lua | 23 ++++++------ package/gluon-config-mode-mesh-vpn/i18n/de.po | 36 +++++++++++++++++++ package/gluon-config-mode-mesh-vpn/i18n/en.po | 36 +++++++++++++++++++ .../i18n/gluon-config-mode-mesh-vpn.pot | 22 ++++++++++++ 7 files changed, 119 insertions(+), 26 deletions(-) delete mode 100644 package/gluon-config-mode-mesh-vpn/check_site.lua create mode 100644 package/gluon-config-mode-mesh-vpn/i18n/de.po create mode 100644 package/gluon-config-mode-mesh-vpn/i18n/en.po create mode 100644 package/gluon-config-mode-mesh-vpn/i18n/gluon-config-mode-mesh-vpn.pot diff --git a/package/gluon-config-mode-mesh-vpn/Makefile b/package/gluon-config-mode-mesh-vpn/Makefile index a56c9a26..4792e3d3 100644 --- a/package/gluon-config-mode-mesh-vpn/Makefile +++ b/package/gluon-config-mode-mesh-vpn/Makefile @@ -7,6 +7,9 @@ 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 @@ -22,15 +25,12 @@ 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)/ -endef - -define Package/gluon-config-mode-mesh-vpn/postinst -#!/bin/sh -$(call GluonCheckSite,check_site.lua) + $(call GluonInstallI18N,gluon-config-mode-mesh-vpn,$(1)) endef $(eval $(call BuildPackage,gluon-config-mode-mesh-vpn)) diff --git a/package/gluon-config-mode-mesh-vpn/check_site.lua b/package/gluon-config-mode-mesh-vpn/check_site.lua deleted file mode 100644 index 906f9f22..00000000 --- a/package/gluon-config-mode-mesh-vpn/check_site.lua +++ /dev/null @@ -1 +0,0 @@ -need_string 'config_mode.msg_pubkey' diff --git a/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua b/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua index 772d8701..dbb93b11 100644 --- a/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua +++ b/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua @@ -1,18 +1,10 @@ -local msg = [[

- <%= luci.template.render_string(site.config_mode.msg_pubkey) %> -

-
- # <%= hostname %> -
- <%= pubkey %> -
]] - 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' @@ -20,6 +12,13 @@ else local pubkey = util.exec("/etc/init.d/fastd show_key " .. "mesh_vpn") local hostname = uci:get_first("system", "system", "hostname") + local msg = [[

]] .. i18n.translate('gluon-config-mode:pubkey') .. [[

+
+ # <%= hostname %> +
+ <%= pubkey %> +
]] + return function () luci.template.render_string(msg, { pubkey=pubkey , hostname=hostname diff --git a/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/wizard/0300-mesh-vpn.lua b/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/wizard/0300-mesh-vpn.lua index 8638cc8a..669a7bc3 100644 --- a/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/wizard/0300-mesh-vpn.lua +++ b/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/wizard/0300-mesh-vpn.lua @@ -1,35 +1,36 @@ 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, - [[Dein Knoten kann deine Internetverbindung nutzen um darüber - eine verschlüsselte Verbindung zu anderen Freifunkknoten 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 Freifunk zur Verfügung stellen möchtest.]]) + 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", "Internetverbindung nutzen (Mesh-VPN)") + 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", "Bandbreite begrenzen") + 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", "Downstream (kbit/s)") + 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", "Upstream (kbit/s)") + 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 diff --git a/package/gluon-config-mode-mesh-vpn/i18n/de.po b/package/gluon-config-mode-mesh-vpn/i18n/de.po new file mode 100644 index 00000000..997be5a3 --- /dev/null +++ b/package/gluon-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 \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 Freifunkknoten 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 Freifunk zur Verfügung stellen möchtest." diff --git a/package/gluon-config-mode-mesh-vpn/i18n/en.po b/package/gluon-config-mode-mesh-vpn/i18n/en.po new file mode 100644 index 00000000..dd841831 --- /dev/null +++ b/package/gluon-config-mode-mesh-vpn/i18n/en.po @@ -0,0 +1,36 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Project-Id-Version: PACKAGE VERSION\n" +"PO-Revision-Date: 2015-03-19 22:08+0100\n" +"Last-Translator: Matthias Schiffer \n" +"Language-Team: English\n" +"Language: en\n" +"MIME-Version: 1.0\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 "Limit bandwidth" + +msgid "Upstream (kbit/s)" +msgstr "Upstream (kbit/s)" + +msgid "Use internet connection (mesh VPN)" +msgstr "Use internet connection (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 "" +"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." diff --git a/package/gluon-config-mode-mesh-vpn/i18n/gluon-config-mode-mesh-vpn.pot b/package/gluon-config-mode-mesh-vpn/i18n/gluon-config-mode-mesh-vpn.pot new file mode 100644 index 00000000..52e2eef8 --- /dev/null +++ b/package/gluon-config-mode-mesh-vpn/i18n/gluon-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 "" From 335026af09fd4bd5661a08546649e8567046ee13 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Sat, 21 Mar 2015 13:21:49 +0100 Subject: [PATCH 444/453] Allow empty hostname prefix In Bremen it has been noted that a prefix may lead people to believe it has to stay there and thus naming their nodes "ffhb-*", which is not what the community wants (see FreifunkBremen/gluon-site-ffhb#1). However, an empty prefix lead to the connecting hyphen still being inserted. This commit thus makes the hyphen part of the configured prefix and allows the prefix to be missing from the `site.conf`. --- package/gluon-core/check_site.lua | 2 +- package/gluon-core/files/lib/gluon/upgrade/030-system | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/gluon-core/check_site.lua b/package/gluon-core/check_site.lua index 67035c0e..1a6987a0 100644 --- a/package/gluon-core/check_site.lua +++ b/package/gluon-core/check_site.lua @@ -1,7 +1,7 @@ need_string 'site_code' need_string 'site_name' -need_string 'hostname_prefix' +need_string('hostname_prefix', false) need_string 'timezone' need_string_array('ntp_servers', false) diff --git a/package/gluon-core/files/lib/gluon/upgrade/030-system b/package/gluon-core/files/lib/gluon/upgrade/030-system index b31ba42e..d7a66605 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/030-system +++ b/package/gluon-core/files/lib/gluon/upgrade/030-system @@ -10,7 +10,7 @@ if not sysconfig.gluon_version then local system = uci:get_first('system', 'system') - uci:set('system', system, 'hostname', site.hostname_prefix .. '-' .. util.node_id()) + uci:set('system', system, 'hostname', (site.hostname_prefix or '') .. util.node_id()) uci:set('system', system, 'timezone', site.timezone) uci:save('system') From 6c387af9ca6b5c06bd65618b0ae0fbc53662d1d2 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 21 Mar 2015 18:26:54 +0100 Subject: [PATCH 445/453] gluon-site: always provide a PKG_VERSION, also during package scan --- package/gluon-site/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/gluon-site/Makefile b/package/gluon-site/Makefile index 50936202..fc9f58ce 100644 --- a/package/gluon-site/Makefile +++ b/package/gluon-site/Makefile @@ -1,8 +1,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-site -PKG_VERSION:=$(GLUON_SITE_CODE) -PKG_RELEASE:=0.$(GLUON_RELEASE) +PKG_VERSION:=$(if $(GLUON_SITE_CODE),$(GLUON_SITE_CODE),1) +PKG_RELEASE:=$(GLUON_RELEASE) PKG_FILE_DEPENDS := $(GLUON_SITEDIR)/ PKG_BUILD_DEPENDS := luci From 127b576fa55cde2281b8f1ea1a80db2f0f840b27 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 22 Mar 2015 23:41:58 +0100 Subject: [PATCH 446/453] gluon-config-mode-*: remove usages of the word "Freifunk" --- package/gluon-config-mode-contact-info/i18n/de.po | 2 +- package/gluon-config-mode-core/i18n/de.po | 2 +- package/gluon-config-mode-mesh-vpn/i18n/de.po | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package/gluon-config-mode-contact-info/i18n/de.po b/package/gluon-config-mode-contact-info/i18n/de.po index e802524c..719246f4 100644 --- a/package/gluon-config-mode-contact-info/i18n/de.po +++ b/package/gluon-config-mode-contact-info/i18n/de.po @@ -19,7 +19,7 @@ msgid "" "the internet together with your node's coordinates." msgstr "" "Hier kannst du einen öffentlichen Hinweis hinterlegen, um anderen " -"Freifunkern zu ermöglichen, Kontakt mit dir aufzunehmen. Bitte beachte, dass " +"zu ermöglichen, Kontakt mit dir aufzunehmen. Bitte beachte, dass " "dieser Hinweis auch öffentlich im Internet, zusammen mit den Koordinaten " "deines Knotens, einsehbar sein wird." diff --git a/package/gluon-config-mode-core/i18n/de.po b/package/gluon-config-mode-core/i18n/de.po index 6f852f43..58d23894 100644 --- a/package/gluon-config-mode-core/i18n/de.po +++ b/package/gluon-config-mode-core/i18n/de.po @@ -21,4 +21,4 @@ msgid "Wizard" msgstr "Wizard" msgid "Your node's setup is now complete." -msgstr "Dein Freifunkknoten ist nun fertig eingerichtet." +msgstr "Dein Knoten ist nun fertig eingerichtet." diff --git a/package/gluon-config-mode-mesh-vpn/i18n/de.po b/package/gluon-config-mode-mesh-vpn/i18n/de.po index 997be5a3..8c613aa0 100644 --- a/package/gluon-config-mode-mesh-vpn/i18n/de.po +++ b/package/gluon-config-mode-mesh-vpn/i18n/de.po @@ -30,7 +30,7 @@ msgid "" "node will use at most." msgstr "" "Dein Knoten kann deine Internetverbindung nutzen um darüber eine " -"verschlüsselte Verbindung zu anderen Freifunkknoten aufzubauen. Die dafür " +"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 Freifunk zur Verfügung stellen möchtest." +"Internetverbindung für das Mesh-Netzwerk zur Verfügung stellen möchtest." From 8361b51c32d1a3f5240fb3469e8960639cefb56c Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Mon, 23 Mar 2015 00:12:39 +0100 Subject: [PATCH 447/453] gluon-config-mode-geo-location: add altitude field --- .../config-mode/wizard/0400-geo-location.lua | 20 +++++++++++++++++-- .../gluon-config-mode-geo-location/i18n/de.po | 18 +++++++++++------ .../gluon-config-mode-geo-location/i18n/en.po | 19 +++++++++++------- .../i18n/gluon-config-mode-geo-location.pot | 5 +++-- .../lib/gluon/announce/nodeinfo.d/location | 1 + 5 files changed, 46 insertions(+), 17 deletions(-) diff --git a/package/gluon-config-mode-geo-location/files/lib/gluon/config-mode/wizard/0400-geo-location.lua b/package/gluon-config-mode-geo-location/files/lib/gluon/config-mode/wizard/0400-geo-location.lua index ef60ae66..a3ac089d 100644 --- a/package/gluon-config-mode-geo-location/files/lib/gluon/config-mode/wizard/0400-geo-location.lua +++ b/package/gluon-config-mode-geo-location/files/lib/gluon/config-mode/wizard/0400-geo-location.lua @@ -5,8 +5,11 @@ local uci = luci.model.uci.cursor() local M = {} function M.section(form) - local s = form:section(cbi.SimpleSection, nil, - i18n.translate("If you want your node to be displayed on the map, you can enter its coodinates here.")) + 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 @@ -27,6 +30,14 @@ function M.section(form) 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) @@ -36,6 +47,11 @@ function M.handle(data) 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") diff --git a/package/gluon-config-mode-geo-location/i18n/de.po b/package/gluon-config-mode-geo-location/i18n/de.po index 08573026..e83443dd 100644 --- a/package/gluon-config-mode-geo-location/i18n/de.po +++ b/package/gluon-config-mode-geo-location/i18n/de.po @@ -1,8 +1,8 @@ msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"PO-Revision-Date: 2015-03-19 01:05+0100\n" -"Last-Translator: Matthias Schiffer \n" +"Project-Id-Version: gluon-config-mode-geo-location\n" +"PO-Revision-Date: 2015-03-23 02:18+0100\n" +"Last-Translator: Martin Weinelt \n" "Language-Team: German\n" "Language: de\n" "MIME-Version: 1.0\n" @@ -11,11 +11,14 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" msgid "" -"If you want your node to be displayed on the map, you can enter its " -"coodinates here." +"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." +"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" @@ -23,6 +26,9 @@ 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" diff --git a/package/gluon-config-mode-geo-location/i18n/en.po b/package/gluon-config-mode-geo-location/i18n/en.po index aaed7e1a..dbdd6fe2 100644 --- a/package/gluon-config-mode-geo-location/i18n/en.po +++ b/package/gluon-config-mode-geo-location/i18n/en.po @@ -1,8 +1,8 @@ msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"PO-Revision-Date: 2015-03-19 01:04+0100\n" -"Last-Translator: Matthias Schiffer \n" +"Project-Id-Version: gluon-config-mode-geo-location\n" +"PO-Revision-Date: 2015-03-23 02:19+0100\n" +"Last-Translator: Martin Weinelt \n" "Language-Team: English\n" "Language: en\n" "MIME-Version: 1.0\n" @@ -11,11 +11,13 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" msgid "" -"If you want your node to be displayed on the map, you can enter its " -"coodinates here." +"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 "" -"If you want your node to be displayed on the map, you can enter its " -"coodinates here." +"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." msgid "Latitude" msgstr "Latitude" @@ -23,6 +25,9 @@ msgstr "Latitude" msgid "Longitude" msgstr "Longitude" +msgid "Altitude" +msgstr "Altitude" + msgid "Show node on the map" msgstr "Show node on the map" diff --git a/package/gluon-config-mode-geo-location/i18n/gluon-config-mode-geo-location.pot b/package/gluon-config-mode-geo-location/i18n/gluon-config-mode-geo-location.pot index 6881b366..84800c8a 100644 --- a/package/gluon-config-mode-geo-location/i18n/gluon-config-mode-geo-location.pot +++ b/package/gluon-config-mode-geo-location/i18n/gluon-config-mode-geo-location.pot @@ -2,8 +2,9 @@ msgid "" msgstr "Content-Type: text/plain; charset=UTF-8" msgid "" -"If you want your node to be displayed on the map, you can enter its " -"coodinates here." +"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" diff --git a/package/gluon-node-info/files/lib/gluon/announce/nodeinfo.d/location b/package/gluon-node-info/files/lib/gluon/announce/nodeinfo.d/location index eb9b3a9a..72bf8878 100644 --- a/package/gluon-node-info/files/lib/gluon/announce/nodeinfo.d/location +++ b/package/gluon-node-info/files/lib/gluon/announce/nodeinfo.d/location @@ -2,5 +2,6 @@ if uci:get_first('gluon-node-info', 'location', 'share_location', false) then return { latitude = tonumber(uci:get_first('gluon-node-info', 'location', 'latitude')), longitude = tonumber(uci:get_first('gluon-node-info', 'location', 'longitude')), + altitude = tonumber(uci:get_first('gluon-node-info', 'location', 'altitude')), } end From 7e7ee16105f6922581ca1eb0cf53268e7e3ae28f Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Mon, 23 Mar 2015 21:04:27 +0100 Subject: [PATCH 448/453] gluon-announce: move collect_dir to library --- .../files/lib/gluon/announce/collect.lua | 39 ++----------------- .../files/usr/lib/lua/gluon/announce.lua | 33 ++++++++++++++++ 2 files changed, 36 insertions(+), 36 deletions(-) mode change 100755 => 100644 package/gluon-announce/files/lib/gluon/announce/collect.lua create mode 100755 package/gluon-announce/files/usr/lib/lua/gluon/announce.lua diff --git a/package/gluon-announce/files/lib/gluon/announce/collect.lua b/package/gluon-announce/files/lib/gluon/announce/collect.lua old mode 100755 new mode 100644 index 7bce0a78..e2974b49 --- a/package/gluon-announce/files/lib/gluon/announce/collect.lua +++ b/package/gluon-announce/files/lib/gluon/announce/collect.lua @@ -1,43 +1,10 @@ #!/usr/bin/lua -local announce_base = '/lib/gluon/announce/' - - -fs = require 'luci.fs' -uci = require('luci.model.uci').cursor() -util = require 'luci.util' - - +local announce = require 'gluon.announce' local json = require 'luci.json' local ltn12 = require 'luci.ltn12' +local announce_dir = '/lib/gluon/announce/' .. arg[1] .. '.d' -local function collect_entry(entry) - if fs.isdirectory(entry) then - return collect_dir(entry) - else - return dofile(entry) - end -end - -function collect_dir(dir) - local ret = {} - - for _, entry in ipairs(fs.dir(dir)) do - if entry:sub(1, 1) ~= '.' then - local ok, val = pcall(collect_entry, dir .. '/' .. entry) - if ok then - ret[entry] = val - else - io.stderr:write(val, '\n') - end - end - end - - return ret -end - -local announce_dir = announce_base .. arg[1] .. '.d/' - -encoder = json.Encoder(collect_dir(announce_dir)) +encoder = json.Encoder(announce.collect_dir(announce_dir)) ltn12.pump.all(encoder:source(), ltn12.sink.file(io.stdout)) diff --git a/package/gluon-announce/files/usr/lib/lua/gluon/announce.lua b/package/gluon-announce/files/usr/lib/lua/gluon/announce.lua new file mode 100755 index 00000000..7f3f62e2 --- /dev/null +++ b/package/gluon-announce/files/usr/lib/lua/gluon/announce.lua @@ -0,0 +1,33 @@ +#!/usr/bin/lua + +module('gluon.announce', package.seeall) + +fs = require 'luci.fs' +uci = require('luci.model.uci').cursor() +util = require 'luci.util' + +local function collect_entry(entry) + if fs.isdirectory(entry) then + return collect_dir(entry) + else + return setfenv(loadfile(entry), _M)() + end +end + +function collect_dir(dir) + local ret = {} + + for _, entry in ipairs(fs.dir(dir)) do + if entry:sub(1, 1) ~= '.' then + local ok, val = pcall(collect_entry, dir .. '/' .. entry) + if ok then + ret[entry] = val + else + io.stderr:write(val, '\n') + end + end + end + + return ret +end + From a97116b90901db01e75cc6c6a51409a543a6f7f3 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 25 Mar 2015 17:42:58 +0100 Subject: [PATCH 449/453] Remove english .po files, they are redundant. --- .../gluon-config-mode-autoupdater/i18n/en.po | 18 ---------- .../gluon-config-mode-contact-info/i18n/en.po | 26 -------------- package/gluon-config-mode-core/i18n/en.po | 24 ------------- .../gluon-config-mode-geo-location/i18n/en.po | 35 ------------------ package/gluon-config-mode-hostname/i18n/en.po | 14 -------- package/gluon-config-mode-mesh-vpn/i18n/en.po | 36 ------------------- 6 files changed, 153 deletions(-) delete mode 100644 package/gluon-config-mode-autoupdater/i18n/en.po delete mode 100644 package/gluon-config-mode-contact-info/i18n/en.po delete mode 100644 package/gluon-config-mode-core/i18n/en.po delete mode 100644 package/gluon-config-mode-geo-location/i18n/en.po delete mode 100644 package/gluon-config-mode-hostname/i18n/en.po delete mode 100644 package/gluon-config-mode-mesh-vpn/i18n/en.po diff --git a/package/gluon-config-mode-autoupdater/i18n/en.po b/package/gluon-config-mode-autoupdater/i18n/en.po deleted file mode 100644 index 211befae..00000000 --- a/package/gluon-config-mode-autoupdater/i18n/en.po +++ /dev/null @@ -1,18 +0,0 @@ -msgid "" -msgstr "" -"Content-Type: text/plain; charset=UTF-8\n" -"Project-Id-Version: PACKAGE VERSION\n" -"PO-Revision-Date: 2015-03-18 16:03+0100\n" -"Last-Translator: Matthias Schiffer \n" -"Language-Team: English\n" -"Language: en\n" -"MIME-Version: 1.0\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -msgid "" -"This node will automatically update its firmware when a new version is " -"available." -msgstr "" -"This node will automatically update its firmware when a new version is " -"available." diff --git a/package/gluon-config-mode-contact-info/i18n/en.po b/package/gluon-config-mode-contact-info/i18n/en.po deleted file mode 100644 index 1b1b8816..00000000 --- a/package/gluon-config-mode-contact-info/i18n/en.po +++ /dev/null @@ -1,26 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"PO-Revision-Date: 2015-03-19 01:32+0100\n" -"Last-Translator: Matthias Schiffer \n" -"Language-Team: English\n" -"Language: en\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 "Contact info" -msgstr "Contact info" - -msgid "" -"You can provide your contact information here to allow others to contact " -"you. Please note that this information will be visible publicly on " -"the internet together with your node's coordinates." -msgstr "" -"You can provide your contact information here to allow others to contact " -"you. Please note that this information will be visible publicly on " -"the internet together with your node's coordinates." - -msgid "e.g. E-mail or phone number" -msgstr "e.g. E-mail or phone number" diff --git a/package/gluon-config-mode-core/i18n/en.po b/package/gluon-config-mode-core/i18n/en.po deleted file mode 100644 index d0758a04..00000000 --- a/package/gluon-config-mode-core/i18n/en.po +++ /dev/null @@ -1,24 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"PO-Revision-Date: 2015-03-19 02:07+0100\n" -"Last-Translator: Matthias Schiffer \n" -"Language-Team: English\n" -"Language: en\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 "Save & restart" - -msgid "Welcome!" -msgstr "Welcome!" - -msgid "Wizard" -msgstr "Wizard" - -msgid "Your node's setup is now complete." -msgstr "Your node's setup is now complete." diff --git a/package/gluon-config-mode-geo-location/i18n/en.po b/package/gluon-config-mode-geo-location/i18n/en.po deleted file mode 100644 index dbdd6fe2..00000000 --- a/package/gluon-config-mode-geo-location/i18n/en.po +++ /dev/null @@ -1,35 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: gluon-config-mode-geo-location\n" -"PO-Revision-Date: 2015-03-23 02:19+0100\n" -"Last-Translator: Martin Weinelt \n" -"Language-Team: English\n" -"Language: en\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 "" -"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." - -msgid "Latitude" -msgstr "Latitude" - -msgid "Longitude" -msgstr "Longitude" - -msgid "Altitude" -msgstr "Altitude" - -msgid "Show node on the map" -msgstr "Show node on the map" - -msgid "e.g. %s" -msgstr "e.g. %s" diff --git a/package/gluon-config-mode-hostname/i18n/en.po b/package/gluon-config-mode-hostname/i18n/en.po deleted file mode 100644 index 3bd5cb5c..00000000 --- a/package/gluon-config-mode-hostname/i18n/en.po +++ /dev/null @@ -1,14 +0,0 @@ -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 \n" -"Language-Team: English\n" -"Language: en\n" -"MIME-Version: 1.0\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -msgid "Node name" -msgstr "Node name" diff --git a/package/gluon-config-mode-mesh-vpn/i18n/en.po b/package/gluon-config-mode-mesh-vpn/i18n/en.po deleted file mode 100644 index dd841831..00000000 --- a/package/gluon-config-mode-mesh-vpn/i18n/en.po +++ /dev/null @@ -1,36 +0,0 @@ -msgid "" -msgstr "" -"Content-Type: text/plain; charset=UTF-8\n" -"Project-Id-Version: PACKAGE VERSION\n" -"PO-Revision-Date: 2015-03-19 22:08+0100\n" -"Last-Translator: Matthias Schiffer \n" -"Language-Team: English\n" -"Language: en\n" -"MIME-Version: 1.0\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 "Limit bandwidth" - -msgid "Upstream (kbit/s)" -msgstr "Upstream (kbit/s)" - -msgid "Use internet connection (mesh VPN)" -msgstr "Use internet connection (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 "" -"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." From a476dd4e33596f680d7c20e6c18ab27bcd33eb8d Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 25 Mar 2015 17:43:37 +0100 Subject: [PATCH 450/453] gluon-site: remove PO template, it is maintained in the site-example Having two POT files will only cause confusion. --- package/gluon-site/i18n/gluon-site.pot | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 package/gluon-site/i18n/gluon-site.pot diff --git a/package/gluon-site/i18n/gluon-site.pot b/package/gluon-site/i18n/gluon-site.pot deleted file mode 100644 index 670de410..00000000 --- a/package/gluon-site/i18n/gluon-site.pot +++ /dev/null @@ -1,11 +0,0 @@ -msgid "" -msgstr "Content-Type: text/plain; charset=UTF-8" - -msgid "gluon-config-mode:welcome" -msgstr "" - -msgid "gluon-config-mode:pubkey" -msgstr "" - -msgid "gluon-config-mode:reboot" -msgstr "" From cd34cb2ebb7da0d814744c3d5dc001af192d611e Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 8 Apr 2015 00:42:22 +0200 Subject: [PATCH 451/453] gluon-core, gluon-setup-mode: improve support for UAP Outdoor+ --- package/gluon-core/files/lib/gluon/upgrade/010-primary-mac | 4 ++++ package/gluon-core/files/lib/gluon/upgrade/020-interfaces | 2 +- .../gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac b/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac index 12128efc..70aee39d 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac +++ b/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac @@ -23,6 +23,10 @@ if platform.match('ar71xx', 'generic', {'tl-wdr3600', 'tl-wdr4300'}) then table.insert(try_files, 1, '/sys/class/ieee80211/phy1/macaddress') end +if platform.match('ar71xx', 'generic', {'unifi-outdoor-plus'}) then + table.insert(try_files, 1, '/sys/class/net/eth0/address') +end + if platform.match('ar71xx', 'generic', {'archer-c5', 'archer-c7'}) then table.insert(try_files, 1, '/sys/class/net/eth1/address') end diff --git a/package/gluon-core/files/lib/gluon/upgrade/020-interfaces b/package/gluon-core/files/lib/gluon/upgrade/020-interfaces index 077f77be..a051c738 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/020-interfaces +++ b/package/gluon-core/files/lib/gluon/upgrade/020-interfaces @@ -16,7 +16,7 @@ if not (sysconfig.lan_ifname or sysconfig.wan_ifname) then local lan_ifname = uci:get('network', 'lan', 'ifname') local wan_ifname = uci:get('network', 'wan', 'ifname') - if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw'}) then + if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus'}) then lan_ifname, wan_ifname = wan_ifname, lan_ifname end diff --git a/package/gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname b/package/gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname index f6084814..3c4a8afe 100755 --- a/package/gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname +++ b/package/gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname @@ -8,7 +8,7 @@ if sysconfig.setup_ifname then os.exit(0) end -if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw'}) then +if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus'}) then sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.wan_ifname or sysconfig.lan_ifname else sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.lan_ifname or sysconfig.wan_ifname From ba9ce051b01e16a23882a54f3b0c6dd41320e913 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Wed, 8 Apr 2015 21:16:55 +0200 Subject: [PATCH 452/453] gluon-announce: Fix permissions of collect.lua --- package/gluon-announce/files/lib/gluon/announce/collect.lua | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 package/gluon-announce/files/lib/gluon/announce/collect.lua diff --git a/package/gluon-announce/files/lib/gluon/announce/collect.lua b/package/gluon-announce/files/lib/gluon/announce/collect.lua old mode 100644 new mode 100755 From c4f7a52621bd70d15329f59eb23a3c49b3c42f29 Mon Sep 17 00:00:00 2001 From: bjoern Date: Fri, 10 Apr 2015 23:00:13 +0200 Subject: [PATCH 453/453] gluon-config-mode-mesh-vpn: Remove trailing newline from pubkey variable in 0100-mesh-vpn.lua --- .../files/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua b/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua index dbb93b11..1b32c731 100644 --- a/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua +++ b/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua @@ -9,7 +9,7 @@ else local site = require 'gluon.site_config' local sysconfig = require 'gluon.sysconfig' - local pubkey = util.exec("/etc/init.d/fastd show_key " .. "mesh_vpn") + local pubkey = util.trim(util.exec("/etc/init.d/fastd show_key " .. "mesh_vpn")) local hostname = uci:get_first("system", "system", "hostname") local msg = [[

]] .. i18n.translate('gluon-config-mode:pubkey') .. [[