From cc08450972722ebcaedf53a6f26cbcc82dc091d0 Mon Sep 17 00:00:00 2001 From: ohrensessel Date: Fri, 11 Jul 2014 00:30:55 +0200 Subject: [PATCH] Pull new upstream changes based on freifunk-gluon/packages@48b26ad13e03ddb7d6e6f25424597f38648f8217 --- gluon-config-mode-ffhh/Makefile | 9 +- gluon-config-mode-ffhh/check_site.lua | 4 + .../files/etc/config/gluon-config-mode | 3 - .../etc/hotplug.d/button/50-gluon-config-mode | 29 ------ .../files/etc/init.d/gluon-config-mode | 90 ------------------- .../files/lib/gluon/config-mode/ash-login | 3 - .../lib/gluon/config-mode/www/cgi-bin/luci | 5 -- .../lib/gluon/config-mode/www/index.html | 10 --- .../lib/gluon/config-mode/www/luci-static | 1 - .../invariant/010-config-ifname | 17 ---- .../legacy/010-migrate-configured | 20 ----- .../controller/gluon-config-mode/index.lua | 8 +- .../model/cbi/gluon-config-mode/wizard.lua | 3 +- 13 files changed, 17 insertions(+), 185 deletions(-) create mode 100644 gluon-config-mode-ffhh/check_site.lua delete mode 100644 gluon-config-mode-ffhh/files/etc/config/gluon-config-mode delete mode 100755 gluon-config-mode-ffhh/files/etc/hotplug.d/button/50-gluon-config-mode delete mode 100755 gluon-config-mode-ffhh/files/etc/init.d/gluon-config-mode delete mode 100755 gluon-config-mode-ffhh/files/lib/gluon/config-mode/ash-login delete mode 100755 gluon-config-mode-ffhh/files/lib/gluon/config-mode/www/cgi-bin/luci delete mode 100644 gluon-config-mode-ffhh/files/lib/gluon/config-mode/www/index.html delete mode 120000 gluon-config-mode-ffhh/files/lib/gluon/config-mode/www/luci-static delete mode 100755 gluon-config-mode-ffhh/files/lib/gluon/upgrade/config-mode-ffhh/invariant/010-config-ifname delete mode 100755 gluon-config-mode-ffhh/files/lib/gluon/upgrade/config-mode-ffhh/legacy/010-migrate-configured diff --git a/gluon-config-mode-ffhh/Makefile b/gluon-config-mode-ffhh/Makefile index e2af77d..93a547a 100644 --- a/gluon-config-mode-ffhh/Makefile +++ b/gluon-config-mode-ffhh/Makefile @@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-config-mode-ffhh -PKG_VERSION:=2 +PKG_VERSION:=4 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) @@ -14,7 +14,7 @@ define Package/gluon-config-mode-ffhh 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 + DEPENDS:=+gluon-luci-core +gluon-setup-mode +gluon-lock-password +gluon-simple-tc PROVIDES:=gluon-config-mode endef @@ -36,4 +36,9 @@ define Package/gluon-config-mode-ffhh/install $(CP) ./files/* $(1)/ endef +define Package/gluon-config-mode-ffhh/postinst +#!/bin/sh +$(call GluonCheckSite,check_site.lua) +endef + $(eval $(call BuildPackage,gluon-config-mode-ffhh)) diff --git a/gluon-config-mode-ffhh/check_site.lua b/gluon-config-mode-ffhh/check_site.lua new file mode 100644 index 0000000..436de62 --- /dev/null +++ b/gluon-config-mode-ffhh/check_site.lua @@ -0,0 +1,4 @@ +need_string 'config_mode.msg_welcome' +need_string 'config_mode.msg_pubkey' +need_string 'config_mode.msg_reboot' +need_string 'config_mode.msg_nopubkey' diff --git a/gluon-config-mode-ffhh/files/etc/config/gluon-config-mode b/gluon-config-mode-ffhh/files/etc/config/gluon-config-mode deleted file mode 100644 index c2d2be2..0000000 --- a/gluon-config-mode-ffhh/files/etc/config/gluon-config-mode +++ /dev/null @@ -1,3 +0,0 @@ -config wizard - option enabled '0' - option configured '0' diff --git a/gluon-config-mode-ffhh/files/etc/hotplug.d/button/50-gluon-config-mode b/gluon-config-mode-ffhh/files/etc/hotplug.d/button/50-gluon-config-mode deleted file mode 100755 index 7648cd6..0000000 --- a/gluon-config-mode-ffhh/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/gluon-config-mode-ffhh/files/etc/init.d/gluon-config-mode b/gluon-config-mode-ffhh/files/etc/init.d/gluon-config-mode deleted file mode 100755 index e613f7b..0000000 --- a/gluon-config-mode-ffhh/files/etc/init.d/gluon-config-mode +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/sh /etc/rc.common - -START=12 - - -CONFIG_MODE_ADDR=192.168.1.1 -CONFIG_MODE_NETMASK=255.255.255.0 - -CONFIG_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/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 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_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() { - . /lib/gluon/functions/sysconfig.sh - - enable=0 - 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("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 - - setup_network - - /usr/sbin/telnetd -l /lib/gluon/config-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/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 - - . /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/gluon-config-mode-ffhh/files/lib/gluon/config-mode/ash-login b/gluon-config-mode-ffhh/files/lib/gluon/config-mode/ash-login deleted file mode 100755 index 3349c44..0000000 --- a/gluon-config-mode-ffhh/files/lib/gluon/config-mode/ash-login +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -exec /bin/ash --login diff --git a/gluon-config-mode-ffhh/files/lib/gluon/config-mode/www/cgi-bin/luci b/gluon-config-mode-ffhh/files/lib/gluon/config-mode/www/cgi-bin/luci deleted file mode 100755 index c5c9847..0000000 --- a/gluon-config-mode-ffhh/files/lib/gluon/config-mode/www/cgi-bin/luci +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/lua -require "luci.cacheloader" -require "luci.sgi.cgi" -luci.dispatcher.indexcache = "/tmp/luci-indexcache" -luci.sgi.cgi.run() diff --git a/gluon-config-mode-ffhh/files/lib/gluon/config-mode/www/index.html b/gluon-config-mode-ffhh/files/lib/gluon/config-mode/www/index.html deleted file mode 100644 index 0a7238b..0000000 --- a/gluon-config-mode-ffhh/files/lib/gluon/config-mode/www/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - -LuCI - Lua Configuration Interface - - diff --git a/gluon-config-mode-ffhh/files/lib/gluon/config-mode/www/luci-static b/gluon-config-mode-ffhh/files/lib/gluon/config-mode/www/luci-static deleted file mode 120000 index aea80e0..0000000 --- a/gluon-config-mode-ffhh/files/lib/gluon/config-mode/www/luci-static +++ /dev/null @@ -1 +0,0 @@ -/www/luci-static \ No newline at end of file diff --git a/gluon-config-mode-ffhh/files/lib/gluon/upgrade/config-mode-ffhh/invariant/010-config-ifname b/gluon-config-mode-ffhh/files/lib/gluon/upgrade/config-mode-ffhh/invariant/010-config-ifname deleted file mode 100755 index ce54a9b..0000000 --- a/gluon-config-mode-ffhh/files/lib/gluon/upgrade/config-mode-ffhh/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/gluon-config-mode-ffhh/files/lib/gluon/upgrade/config-mode-ffhh/legacy/010-migrate-configured b/gluon-config-mode-ffhh/files/lib/gluon/upgrade/config-mode-ffhh/legacy/010-migrate-configured deleted file mode 100755 index 18bdaf1..0000000 --- a/gluon-config-mode-ffhh/files/lib/gluon/upgrade/config-mode-ffhh/legacy/010-migrate-configured +++ /dev/null @@ -1,20 +0,0 @@ -#!/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/gluon-config-mode-ffhh/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua b/gluon-config-mode-ffhh/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua index d8b21b8..def9d40 100644 --- a/gluon-config-mode-ffhh/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua +++ b/gluon-config-mode-ffhh/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/gluon-config-mode-ffhh/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/gluon-config-mode-ffhh/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua index 8f5bf66..1b61e49 100644 --- a/gluon-config-mode-ffhh/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua +++ b/gluon-config-mode-ffhh/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua @@ -30,7 +30,8 @@ o.datatype = "hostname" 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