parent
0fc9d44e95
commit
cc08450972
|
@ -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))
|
||||
|
|
4
gluon-config-mode-ffhh/check_site.lua
Normal file
4
gluon-config-mode-ffhh/check_site.lua
Normal file
|
@ -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'
|
|
@ -1,3 +0,0 @@
|
|||
config wizard
|
||||
option enabled '0'
|
||||
option configured '0'
|
|
@ -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
|
|
@ -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
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
exec /bin/ash --login
|
|
@ -1,5 +0,0 @@
|
|||
#!/usr/bin/lua
|
||||
require "luci.cacheloader"
|
||||
require "luci.sgi.cgi"
|
||||
luci.dispatcher.indexcache = "/tmp/luci-indexcache"
|
||||
luci.sgi.cgi.run()
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0; URL=/cgi-bin/luci" />
|
||||
</head>
|
||||
<body style="background-color: black">
|
||||
<a style="color: white; text-decoration: none" href="/cgi-bin/luci">LuCI - Lua Configuration Interface</a>
|
||||
</body>
|
||||
</html>
|
|
@ -1 +0,0 @@
|
|||
/www/luci-static
|
|
@ -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
|
|
@ -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
|
|
@ -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")
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue