mirror of https://git.openwrt.org/project/luci.git
* Mördercommit ;-)
* Major Repository Reorganisation * API 0.4 Softfreeze to come
This commit is contained in:
parent
a3a51464fd
commit
aa9ccf77c6
2
INSTALL
2
INSTALL
|
@ -13,7 +13,7 @@ TOC:
|
|||
|
||||
3. Run ./scripts/feeds update
|
||||
|
||||
4. Run ./scripts/feeds install ffluci
|
||||
4. Run ./scripts/feeds install ffluci-meta
|
||||
|
||||
5. Type make menuconfig and you will find ffluci in the menu "Administration"
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
include build/config.mk
|
||||
|
||||
MODULES = applications/* core modules/* themes/*
|
||||
LUA_TARGET = source
|
||||
|
||||
|
||||
.PHONY: all build clean host hostclean
|
||||
|
||||
all: build
|
||||
|
||||
build:
|
||||
for i in $(MODULES); do make -C$$i $(LUA_TARGET); done
|
||||
|
||||
clean:
|
||||
for i in $(MODULES); do make -C$$i clean; done
|
||||
|
||||
host: build
|
||||
mkdir -p host/ffluci
|
||||
for i in $(MODULES); do cp $$i/dist$(LUCI_INSTALLDIR) host/ffluci -R; done
|
||||
|
||||
hostclean:
|
||||
rm host -rf
|
50
README
50
README
|
@ -1,50 +0,0 @@
|
|||
FFLuCI - Freifunk Lua Configuration Interface
|
||||
|
||||
This is a leightweight MVC-Webframework for small embedded devices.
|
||||
It uses the the Lua programming language and relies on Haserl.
|
||||
|
||||
It consists of several parts:
|
||||
|
||||
MVC Dispatcher
|
||||
Simple PATH_INFO based dispatching mechanism using Lua modules
|
||||
|
||||
|
||||
Template engine
|
||||
Support for plain and compiled templates, on-demand compiling support
|
||||
Short markups:
|
||||
<% Lua-Code %>
|
||||
<%= Lua-Code with return value %>
|
||||
<%:i18nkey default translation%>
|
||||
<%+template-to-be-included%>
|
||||
<%~uci.short.cut%>
|
||||
|
||||
Predefined variables for controller dir and media dir
|
||||
|
||||
|
||||
Configuration Bind Interface (CBI)
|
||||
Generates and validates XHTML-Forms out of an UCI model description
|
||||
Makes it very easy to create webinterface pages that manipulate UCI files
|
||||
|
||||
|
||||
i18n Translation support
|
||||
Simple multi-language per-module internationalization support
|
||||
|
||||
|
||||
UCI wrapper support
|
||||
Lua UCI-Wrapper adapting the CLI of the uci binary
|
||||
|
||||
|
||||
Menu Building support
|
||||
Supports menu building for modules and exported actions
|
||||
|
||||
|
||||
HTTP-Abstraction and Formvalue validation support
|
||||
HTTP-Redirect, Statuscode, Content-Type abstraction
|
||||
Dynamic formvalue validation support including varaible type and
|
||||
value range validation
|
||||
|
||||
|
||||
Known issues:
|
||||
There is a bug in older versions of busybox-httpd (as those in Kamikaze 7.09)
|
||||
that do not handle Status-headers correctly making valid HTTP-Redirects impossible.
|
||||
Using a newer version of Kamikaze should fix this.
|
|
@ -0,0 +1,2 @@
|
|||
include ../../build/config.mk
|
||||
include ../../build/module.mk
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
uci batch <<-EOF
|
||||
set freifunk.community.name='Freifunk Leipzig'
|
||||
set freifunk.community.homepage=http://leipzig.freifunk.net
|
||||
set freifunk.community.essid=leipzig.freifunk.net
|
||||
set freifunk.community.bssid=02:CA:FF:EE:BA:BE
|
||||
set freifunk.community.realm=db.leipzig.freifunk.net
|
||||
set freifunk.community.channel=1
|
||||
set freifunk.community.net=104.0.0.0
|
||||
set freifunk.community.mask=255.0.0.0
|
||||
set freifunk.community.dhcp=10.0.0.0
|
||||
set freifunk.community.dhcpmask=255.255.255.0
|
||||
set freifunk.community.dns='88.198.178.18 141.54.1.1 212.204.49.83 208.67.220.220 208.67.222.222'
|
||||
EOF
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
include ../../build/config.mk
|
||||
include ../../build/module.mk
|
|
@ -0,0 +1,3 @@
|
|||
sel("admin", "network")
|
||||
act("portfw", "Portweiterleitung")
|
||||
act("firewall", "Firewall")
|
|
@ -0,0 +1,2 @@
|
|||
include ../../build/config.mk
|
||||
include ../../build/module.mk
|
|
@ -0,0 +1,2 @@
|
|||
sel("admin", "services")
|
||||
act("splash", "Client-Splash")
|
|
@ -0,0 +1,2 @@
|
|||
include ../../build/config.mk
|
||||
include ../../build/module.mk
|
|
@ -5,7 +5,7 @@ Description:
|
|||
Server Gateway Interface for Haserl
|
||||
|
||||
FileId:
|
||||
$Id$
|
||||
$Id: haserl.lua 2027 2008-05-07 21:16:35Z Cyrus $
|
||||
|
||||
License:
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
|
@ -0,0 +1,2 @@
|
|||
include ../../build/config.mk
|
||||
include ../../build/module.mk
|
|
@ -5,7 +5,7 @@ Description:
|
|||
Server Gateway Interface for Haserl
|
||||
|
||||
FileId:
|
||||
$Id$
|
||||
$Id: webuci.lua 2027 2008-05-07 21:16:35Z Cyrus $
|
||||
|
||||
License:
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
|
@ -0,0 +1,3 @@
|
|||
LUAC = luac
|
||||
LUAC_OPTIONS = -s
|
||||
LUCI_INSTALLDIR = /usr/lib/lua/ffluci
|
|
@ -0,0 +1,15 @@
|
|||
.PHONY: all compile source clean
|
||||
|
||||
all: compile
|
||||
|
||||
source:
|
||||
mkdir -p dist$(LUCI_INSTALLDIR)
|
||||
cp root dist -R
|
||||
cp src dist$(LUCI_INSTALLDIR) -R
|
||||
for i in $$(find dist -name .svn); do rm $$i -rf; done
|
||||
|
||||
compile: source
|
||||
for i in $$(find dist -name *.lua); do $(LUAC) $(LUAC_OPTIONS) -o $$i $$i; done
|
||||
|
||||
clean:
|
||||
rm dist -rf
|
|
@ -1,43 +0,0 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ffluci-splash
|
||||
PKG_VERSION:=0.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
|
||||
PKG_BUILD_DEPENDS:=lua-luci
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ffluci-splash
|
||||
SECTION:=admin
|
||||
CATEGORY:=Administration
|
||||
SUBMENU:=FFLuCI
|
||||
DEPENDS:=+ffluci +iptables-mod-nat +lua-luci
|
||||
TITLE:=FFLuCI DHCP-Splash
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/ffluci-splash/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/luci-splash/htdocs/cgi-bin
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/cron.minutely
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
|
||||
$(CP) -a ./src/luci-splash/* $(1)/usr/lib/luci-splash/ -R
|
||||
$(INSTALL_BIN) ./src/luci-splash/htdocs/cgi-bin/index.cgi $(1)/usr/lib/luci-splash/htdocs/cgi-bin
|
||||
$(INSTALL_BIN) ./src/luci_splash.init $(1)/etc/init.d/luci_splash
|
||||
$(INSTALL_BIN) ./src/luci-splash.lua $(1)/usr/sbin/luci-splash
|
||||
|
||||
$(INSTALL_BIN) ./src/luci_splash.cron $(1)/etc/cron.minutely/luci-splash
|
||||
$(CP) -a ./src/luci_splash.uci $(1)/etc/config/luci_splash
|
||||
$(CP) -a ./src/luci_splash_httpd.conf $(1)/etc/
|
||||
|
||||
$(CP) -a ./ipkg/conffiles $(1)/CONTROL/conffiles
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ffluci-splash))
|
|
@ -1 +0,0 @@
|
|||
/etc/config/luci_splash
|
|
@ -1,176 +0,0 @@
|
|||
#!/usr/bin/lua
|
||||
package.path = "/usr/lib/lua/?.lua;/usr/lib/lua/?/init.lua;" .. package.path
|
||||
package.cpath = "/usr/lib/lua/?.so;" .. package.cpath
|
||||
|
||||
require("ffluci.http")
|
||||
require("ffluci.sys")
|
||||
require("ffluci.model.uci")
|
||||
|
||||
-- Init state session
|
||||
uci = ffluci.model.uci.StateSession()
|
||||
|
||||
|
||||
function main(argv)
|
||||
local cmd = argv[1]
|
||||
local arg = argv[2]
|
||||
|
||||
if cmd == "status" then
|
||||
if not arg then
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
if iswhitelisted(arg) then
|
||||
print("whitelisted")
|
||||
os.exit(0)
|
||||
end
|
||||
|
||||
if haslease(arg) then
|
||||
print("lease")
|
||||
os.exit(0)
|
||||
end
|
||||
|
||||
print("unknown")
|
||||
os.exit(0)
|
||||
elseif cmd == "add" then
|
||||
if not arg then
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
if not haslease(arg) then
|
||||
add_lease(arg)
|
||||
else
|
||||
print("already leased!")
|
||||
os.exit(2)
|
||||
end
|
||||
os.exit(0)
|
||||
elseif cmd == "remove" then
|
||||
if not arg then
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
remove_lease(arg)
|
||||
os.exit(0)
|
||||
elseif cmd == "sync" then
|
||||
sync()
|
||||
os.exit(0)
|
||||
else
|
||||
print("Usage: " .. argv[0] .. " <status|add|remove|sync> [MAC]")
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
|
||||
-- Add a lease to state and invoke add_rule
|
||||
function add_lease(mac)
|
||||
local key = uci:add("luci_splash", "lease")
|
||||
uci:set("luci_splash", key, "mac", mac)
|
||||
uci:set("luci_splash", key, "start", os.time())
|
||||
add_rule(mac)
|
||||
end
|
||||
|
||||
|
||||
-- Remove a lease from state and invoke remove_rule
|
||||
function remove_lease(mac)
|
||||
mac = mac:lower()
|
||||
|
||||
for k, v in pairs(uci:sections("luci_splash")) do
|
||||
if v[".type"] == "lease" and v.mac:lower() == mac then
|
||||
remove_rule(mac)
|
||||
uci:del("luci_splash", k)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Add an iptables rule
|
||||
function add_rule(mac)
|
||||
return os.execute("iptables -t nat -I luci_splash_leases -m mac --mac-source '"..mac.."' -j RETURN")
|
||||
end
|
||||
|
||||
|
||||
-- Remove an iptables rule
|
||||
function remove_rule(mac)
|
||||
return os.execute("iptables -t nat -D luci_splash_leases -m mac --mac-source '"..mac.."' -j RETURN")
|
||||
end
|
||||
|
||||
|
||||
-- Check whether a MAC-Address is listed in the lease state list
|
||||
function haslease(mac)
|
||||
mac = mac:lower()
|
||||
|
||||
for k, v in pairs(uci:sections("luci_splash")) do
|
||||
if v[".type"] == "lease" and v.mac and v.mac:lower() == mac then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
-- Check whether a MAC-Address is whitelisted
|
||||
function iswhitelisted(mac)
|
||||
mac = mac:lower()
|
||||
|
||||
for k, v in pairs(uci:sections("luci_splash")) do
|
||||
if v[".type"] == "whitelist" and v.mac and v.mac:lower() == mac then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
-- Returns a list of MAC-Addresses for which a rule is existing
|
||||
function listrules()
|
||||
local cmd = "iptables -t nat -L luci_splash_leases | grep RETURN |"
|
||||
cmd = cmd .. "egrep -io [0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+"
|
||||
return ffluci.util.split(ffluci.sys.exec(cmd))
|
||||
end
|
||||
|
||||
|
||||
-- Synchronise leases, remove abandoned rules
|
||||
function sync()
|
||||
local written = {}
|
||||
local time = os.time()
|
||||
|
||||
uci:t_load("luci_splash")
|
||||
|
||||
-- Current leases in state files
|
||||
local leases = uci:t_sections("luci_splash")
|
||||
|
||||
-- Convert leasetime to seconds
|
||||
local leasetime = tonumber(uci:t_get("luci_splash", "general", "leasetime")) * 3600
|
||||
|
||||
-- Clean state file
|
||||
uci:t_revert("luci_splash")
|
||||
|
||||
|
||||
-- For all leases
|
||||
for k, v in pairs(leases) do
|
||||
if v[".type"] == "lease" then
|
||||
if os.difftime(time, tonumber(v.start)) > leasetime then
|
||||
-- Remove expired
|
||||
remove_rule(v.mac)
|
||||
else
|
||||
-- Rewrite state
|
||||
local n = uci:t_add("luci_splash", "lease")
|
||||
uci:t_set("luci_splash", n, "mac", v.mac)
|
||||
uci:t_set("luci_splash", n, "start", v.start)
|
||||
written[v.mac:lower()] = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Delete rules without state
|
||||
for i, r in ipairs(listrules()) do
|
||||
if #r > 0 and not written[r:lower()] then
|
||||
remove_rule(r)
|
||||
end
|
||||
end
|
||||
|
||||
uci:t_save("luci_splash")
|
||||
end
|
||||
|
||||
main(arg)
|
|
@ -1,32 +0,0 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ffluci-system-addons
|
||||
PKG_VERSION:=0.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ffluci-system-addons
|
||||
SECTION:=admin
|
||||
CATEGORY:=Administration
|
||||
SUBMENU:=FFLuCI
|
||||
TITLE:=FFLuCI System Addons for Kamikaze
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/ffluci-system-addons/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/etc/crontabs
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
|
||||
$(INSTALL_BIN) ./src/run-parts $(1)/usr/bin
|
||||
$(CP) ./src/root.crontab $(1)/etc/crontabs/root
|
||||
$(CP) ./src/hotplug.d-20-aliases $(1)/etc/hotplug.d/iface/20-aliases
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ffluci-system-addons))
|
|
@ -1,79 +1,205 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ffluci
|
||||
PKG_REV:=HEAD
|
||||
PKG_VERSION:=0.3+svn$(PKG_REV)
|
||||
PKG_RELEASE:=1
|
||||
PKG_BRANCH:=trunk
|
||||
PKG_SOURCE_URL:=https://dev.leipzig.freifunk.net/svn/ff-luci/$(PKG_BRANCH)
|
||||
PKG_REV:=$(shell LC_ALL=C svn info ${PKG_SOURCE_URL} | sed -ne's/^Last Changed Rev: //p')
|
||||
|
||||
PKG_NAME:=ffluci
|
||||
PKG_VERSION:=0.4+svn$(PKG_REV)
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
|
||||
PKG_SOURCE_PROTO:=svn
|
||||
PKG_SOURCE_VERSION:=$(PKG_REV)
|
||||
PKG_SOURCE_URL:=https://dev.leipzig.freifunk.net/svn/ff-luci/$(PKG_BRANCH)
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
|
||||
|
||||
PKG_BUILD_DEPENDS:=lua-luci
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
|
||||
|
||||
PKG_BUILD_DEPENDS:=lua-luci
|
||||
# LUA_TARGET:=compile LUAC=$(BUILD_DIR_HOST)/lua-luci/luac
|
||||
LUA_TARGET:=source
|
||||
|
||||
# MAKE_ACTION:=compile LUAC=$(BUILD_DIR_HOST)/lua-luci/luac
|
||||
MAKE_ACTION:=source
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ffluci
|
||||
SECTION:=admin
|
||||
CATEGORY:=Administration
|
||||
TITLE:=FFLuCI
|
||||
SUBMENU:=FFLuCI
|
||||
DEPENDS:=+luaposix +haserl-lua +ffluci-system-addons
|
||||
MAINTAINER:=Steven Barth <steven-at-midlink-dot-org>
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/core $(MAKE_ACTION)
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/module/admin-core $(MAKE_ACTION)
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/module/public-core $(MAKE_ACTION)
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/module/rpc-core $(MAKE_ACTION)
|
||||
$(MAKE) -C$(PKG_BUILD_DIR) build LUA_TARGET=$(LUA_TARGET)
|
||||
endef
|
||||
|
||||
|
||||
define Package/ffluci/template
|
||||
SECTION:=admin
|
||||
CATEGORY:=Administration
|
||||
TITLE:=FFLuCI - Freifunk Lua Configuration Interface
|
||||
URL:=http://luci.freifunk-halle.net/
|
||||
MAINTAINER:=Steven Barth <steven-at-midlink-dot-org>
|
||||
endef
|
||||
|
||||
define Package/ffluci/install/template
|
||||
$(CP) $(PKG_BUILD_DIR)/$(2)/dist/* $(1)/ -R
|
||||
|
||||
for i in $(PKG_BUILD_DIR)/$(2)/dist/usr/bin/*; do $(INSTALL_BIN) $$i $(1)/usr/bin/; done
|
||||
for i in $(PKG_BUILD_DIR)/$(2)/dist/usr/sbin/*; do $(INSTALL_BIN) $$i $(1)/usr/sbin/; done
|
||||
for i in $(PKG_BUILD_DIR)/$(2)/dist/bin/*; do $(INSTALL_BIN) $$i $(1)/bin/; done
|
||||
for i in $(PKG_BUILD_DIR)/$(2)/dist/sbin/*; do $(INSTALL_BIN) $$i $(1)/sbin/; done
|
||||
endef
|
||||
|
||||
|
||||
define Package/ffluci
|
||||
$(call Package/ffluci/template)
|
||||
MENU:=1
|
||||
DEPENDS:=+lua-luci +luaposix +luci-addons
|
||||
endef
|
||||
|
||||
define Package/ffluci/conffiles
|
||||
/etc/config/luci
|
||||
endef
|
||||
|
||||
define Package/ffluci/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/ffluci
|
||||
$(INSTALL_DIR) $(1)/www/cgi-bin
|
||||
$(INSTALL_DIR) $(1)/www/ffluci
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/core/dist/* $(1)/usr/lib/lua/ -R
|
||||
$(CP) $(PKG_BUILD_DIR)/core/contrib/uci/* $(1)/etc/config/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/core/contrib/ffluci $(1)/www/cgi-bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/core/contrib/ffluci-upload $(1)/www/cgi-bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/core/contrib/index.cgi $(1)/www/cgi-bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/core/contrib/index.html $(1)/www
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/themes/fledermaus/contrib/media $(1)/www/ffluci/ -R
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/module/admin-core/dist/* $(1)/usr/lib/lua/ffluci/ -R
|
||||
$(CP) $(PKG_BUILD_DIR)/module/admin-core/contrib/uci/luci_fw $(1)/etc/config/luci_fw
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/module/admin-core/contrib/init.d/luci_fw $(1)/etc/init.d/luci_fw
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/module/admin-core/contrib/init.d/luci_freifunk $(1)/etc/init.d/luci_freifunk
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/module/admin-core/contrib/ffluci-flash $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/module/admin-core/contrib/luci-splash $(1)/www/cgi-bin
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/module/public-core/dist/* $(1)/usr/lib/lua/ffluci/ -R
|
||||
$(CP) $(PKG_BUILD_DIR)/module/public-core/contrib/media $(1)/www/ffluci/ -R
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/module/rpc-core/dist/* $(1)/usr/lib/lua/ffluci/ -R
|
||||
|
||||
$(CP) -a ./ipkg/ffluci.postinst $(1)/CONTROL/postinst
|
||||
$(CP) -a ./ipkg/conffiles $(1)/CONTROL/conffiles
|
||||
rm $(DL_DIR)/$(PKG_SOURCE)
|
||||
$(call Package/ffluci/install/template,$(1),core)
|
||||
$(call Package/ffluci/install/template,$(1),themes/fledermaus)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ffluci))
|
||||
|
||||
|
||||
### Meta Packages ###
|
||||
|
||||
define Package/ffluci-freifunk-meta
|
||||
$(call Package/ffluci/template)
|
||||
DEPENDS:=+ffluci +ffluci-sgi-haserl +ffluci-freifunk +ffluci-firewall +ffluci-splash
|
||||
TITLE:=Freifunk Meta-Package
|
||||
endef
|
||||
|
||||
define Package/ffluci-meta/install
|
||||
endef
|
||||
|
||||
|
||||
define Package/ffluci-freifunk-halle
|
||||
$(call Package/ffluci/template)
|
||||
DEPENDS:=+ffluci-freifunk-meta +kmod-tun
|
||||
TITLE:=Community Meta-Package Halle
|
||||
endef
|
||||
|
||||
define Package/ffluci-freifunk-halle/install
|
||||
endef
|
||||
|
||||
|
||||
define Package/ffluci-freifunk-leipzig
|
||||
$(call Package/ffluci/template)
|
||||
DEPENDS:=+ffluci-freifunk-meta +kmod-tun
|
||||
TITLE:=Community Meta-Package Leipzig
|
||||
endef
|
||||
|
||||
define Package/ffluci-freifunk-leipzig/install
|
||||
$(call Package/ffluci/install/template,$(1),applications/community-leipzig)
|
||||
endef
|
||||
|
||||
|
||||
|
||||
### Modules ###
|
||||
|
||||
define Package/ffluci-module-admin-core
|
||||
$(call Package/ffluci/template)
|
||||
DEPENDS:=+ffluci
|
||||
TITLE:=Core Administrative pages for FFLuCI
|
||||
endef
|
||||
|
||||
define Package/ffluci-module-admin-core/install
|
||||
$(call Package/ffluci/install/template,$(1),modules/admin-core)
|
||||
endef
|
||||
|
||||
|
||||
define Package/ffluci-module-freifunk
|
||||
$(call Package/ffluci/template)
|
||||
DEPENDS:=+ffluci +ffluci-module-admin-core
|
||||
TITLE:=Freifunk public and configuration pages
|
||||
endef
|
||||
|
||||
define Package/ffluci-module-freifunk/conffiles
|
||||
/etc/config/freifunk
|
||||
endef
|
||||
|
||||
define Package/ffluci-module-freifunk/install
|
||||
$(call Package/ffluci/install/template,$(1),modules/freifunk)
|
||||
endef
|
||||
|
||||
|
||||
|
||||
### Applications ###
|
||||
|
||||
define Package/ffluci-firewall
|
||||
$(call Package/ffluci/template)
|
||||
DEPENDS:=+ffluci +ffluci-module-admin-core
|
||||
TITLE:=Firewall and Portforwarding module
|
||||
endef
|
||||
|
||||
define Package/ffluci-firewall/conffiles
|
||||
/etc/config/luci_fw
|
||||
endef
|
||||
|
||||
define Package/ffluci-firewall/install
|
||||
$(call Package/ffluci/install/template,$(1),applications/luci-fw)
|
||||
endef
|
||||
|
||||
|
||||
define Package/ffluci-splash
|
||||
$(call Package/ffluci/template)
|
||||
DEPENDS:=+ffluci +ffluci-freifunk +ffluci-sgi-haserl +iptables-mod-nat
|
||||
TITLE:=Freifunk DHCP-Splash
|
||||
endef
|
||||
|
||||
define Package/ffluci-splash/conffiles
|
||||
/etc/config/luci_splash
|
||||
endef
|
||||
|
||||
define Package/ffluci-splash/install
|
||||
$(call Package/ffluci/install/template,$(1),applications/luci-splash)
|
||||
endef
|
||||
|
||||
|
||||
|
||||
### Server Gateway Interfaces ###
|
||||
|
||||
define Package/ffluci-sgi-haserl
|
||||
$(call Package/ffluci/template)
|
||||
DEPENDS:=+ffluci +haserl-lua
|
||||
TITLE:=SGI for Haserl on top of Busybox httpd
|
||||
endef
|
||||
|
||||
define Package/ffluci-sgi-haserl/install
|
||||
$(call Package/ffluci/install/template,$(1),applications/sgi-haserl)
|
||||
endef
|
||||
|
||||
|
||||
define Package/ffluci-sgi-webuci
|
||||
$(call Package/ffluci/template)
|
||||
DEPENDS:=+ffluci
|
||||
TITLE:=SGI for Webuci
|
||||
endef
|
||||
|
||||
define Package/ffluci-sgi-webuci/install
|
||||
$(call Package/ffluci/install/template,$(1),applications/sgi-webuci)
|
||||
endef
|
||||
|
||||
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,ffluci))
|
||||
|
||||
$(eval $(call BuildPackage,ffluci-freifunk-meta))
|
||||
$(eval $(call BuildPackage,ffluci-freifunk-halle))
|
||||
$(eval $(call BuildPackage,ffluci-freifunk-leipzig))
|
||||
|
||||
$(eval $(call BuildPackage,ffluci-module-admin-core))
|
||||
$(eval $(call BuildPackage,ffluci-module-freifunk))
|
||||
|
||||
$(eval $(call BuildPackage,ffluci-firewall))
|
||||
$(eval $(call BuildPackage,ffluci-splash))
|
||||
|
||||
$(eval $(call BuildPackage,ffluci-sgi-haserl))
|
||||
$(eval $(call BuildPackage,ffluci-sgi-webuci))
|
|
@ -1,2 +0,0 @@
|
|||
/etc/config/luci
|
||||
/etc/config/luci_fw
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
[ -n "${IPKG_INSTROOT}" ] || {
|
||||
( . /etc/uci-defaults/ffluci-community-leipzig ) && rm -f /etc/uci-defaults/ffluci-community-leipzig
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-addons
|
||||
PKG_VERSION:=0.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
|
||||
define Package/luci-addons
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=FFLuCI System Addons for Kamikaze
|
||||
URL:=http://luci.freifunk-halle.net
|
||||
endef
|
||||
|
||||
define Package/luci-addons/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/crontabs
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
|
||||
$(INSTALL_BIN) ./dist/usr/bin/run-parts $(1)/usr/bin
|
||||
$(INSTALL_BIN) ./dist/sbin/ffluci-flash $(1)/sbin
|
||||
|
||||
$(CP) ./dist/etc/crontabs/root $(1)/etc/crontabs/root
|
||||
$(CP) ./dist/etc/hotplug.d/iface/20-aliases $(1)/etc/hotplug.d/iface/20-aliases
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,luci-addons))
|
|
@ -1,39 +1,2 @@
|
|||
LUAC = luac
|
||||
LUAC_OPTIONS = -s
|
||||
|
||||
FILES = ffluci/debug.lua ffluci/view/*.htm ffluci/view/cbi/*.htm ffluci/i18n/*
|
||||
|
||||
CFILES = ffluci/bits.lua ffluci/util.lua \
|
||||
ffluci/sgi/haserl.lua ffluci/sgi/webuci.lua \
|
||||
ffluci/http.lua ffluci/fs.lua ffluci/sys.lua \
|
||||
ffluci/model/uci/wrapper.lua ffluci/model/uci/libuci.lua ffluci/model/uci.lua \
|
||||
ffluci/model/ipkg.lua ffluci/config.lua ffluci/i18n.lua ffluci/template.lua \
|
||||
ffluci/cbi.lua ffluci/dispatcher.lua ffluci/menu.lua ffluci/init.lua
|
||||
|
||||
DIRECTORIES = ffluci/model/cbi ffluci/model/menu ffluci/controller ffluci/i18n ffluci/view/cbi ffluci/model/uci ffluci/sgi
|
||||
|
||||
OUTDIRS = $(DIRECTORIES:%=dist/%)
|
||||
INFILES = $(CFILES:%=src/%)
|
||||
OUTFILE = ffluci/init.lua
|
||||
CPFILES = $(FILES:%=src/%)
|
||||
|
||||
.PHONY: all compile source depends clean
|
||||
|
||||
all: compile
|
||||
|
||||
depends:
|
||||
mkdir -p $(OUTDIRS)
|
||||
for i in $(CPFILES); do if [ -f "$$i" ]; then i=$$(echo $$i | cut -d/ -f2-); \
|
||||
mkdir -p dist/$$(dirname $$i); cp src/$$i dist/$$i; fi; done
|
||||
|
||||
compile: depends
|
||||
$(LUAC) $(LUAC_OPTIONS) -o dist/$(OUTFILE) $(INFILES)
|
||||
for i in $(CFILES); do [ -f dist/$$i ] || ln -s `dirname $$i | cut -s -d / -f 2- | sed -e 's/[^/]*\/*/..\//g'``basename $(OUTFILE)` dist/$$i; done
|
||||
|
||||
|
||||
source: depends
|
||||
for i in $(CFILES); do cp src/$$i dist/$$i; done
|
||||
|
||||
|
||||
clean:
|
||||
rm dist -rf
|
||||
include ../build/config.mk
|
||||
include ../build/module.mk
|
|
@ -1,26 +0,0 @@
|
|||
config public contact
|
||||
option nickname
|
||||
option name
|
||||
option mail
|
||||
option phone
|
||||
option location
|
||||
option geo
|
||||
option note
|
||||
|
||||
config public community
|
||||
option name "Freifunk Halle"
|
||||
option homepage http://halle.freifunk.net
|
||||
option essid halle.freifunk.net
|
||||
option bssid 02:CA:FF:EE:BA:BE
|
||||
option realm netz.freifunk-halle.net
|
||||
option channel 1
|
||||
option net 104.0.0.0
|
||||
option mask 255.0.0.0
|
||||
option dhcp 10.0.0.0
|
||||
option dhcpmask 255.255.255.0
|
||||
option dns "88.198.178.18 141.54.1.1 212.204.49.83 208.67.220.220 208.67.222.222"
|
||||
|
||||
config settings routing
|
||||
option internal 0
|
||||
option internet 0
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
LUAC = luac
|
||||
LUAC_OPTIONS = -s
|
||||
|
||||
FILES = i18n/* view/*/*.htm
|
||||
|
||||
CFILES = controller/*/*.lua model/cbi/*/*.lua model/menu/*.lua
|
||||
|
||||
DIRECTORIES = model/cbi model/menu controller i18n view
|
||||
|
||||
|
||||
INFILES = $(CFILES:%=src/%)
|
||||
OUTDIRS = $(DIRECTORIES:%=dist/%)
|
||||
CPFILES = $(FILES:%=src/%)
|
||||
|
||||
.PHONY: all compile source clean depends
|
||||
|
||||
all: compile
|
||||
|
||||
depends:
|
||||
mkdir -p $(OUTDIRS)
|
||||
for i in $(CPFILES); do if [ -f "$$i" ]; then i=$$(echo $$i | cut -d/ -f2-); \
|
||||
mkdir -p dist/$$(dirname $$i); cp src/$$i dist/$$i; fi; done
|
||||
|
||||
compile: depends
|
||||
for i in $(INFILES); do if [ -f "$$i" ]; then i=$$(echo $$i | cut -d/ -f2-); \
|
||||
mkdir -p dist/$$(dirname $$i); $(LUAC) $(LUAC_OPTIONS) -o dist/$$i src/$$i; fi; done
|
||||
|
||||
source: depends
|
||||
for i in $(INFILES); do if [ -f "$$i" ]; then i=$$(echo $$i | cut -d/ -f2-); \
|
||||
mkdir -p dist/$$(dirname $$i); cp src/$$i dist/$$i; fi; done
|
||||
|
||||
|
||||
clean:
|
||||
rm dist -rf
|
|
@ -1,91 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
START=70
|
||||
|
||||
start() {
|
||||
include /lib/network
|
||||
scan_interfaces
|
||||
|
||||
|
||||
### Read interface names
|
||||
config_get wanif wan ifname
|
||||
config_get lanif lan ifname
|
||||
config_get ffif ff ifname
|
||||
config_get ffdif ffdhcp ifname
|
||||
|
||||
config_get lanip lan ipaddr
|
||||
config_get lanmask lan netmask
|
||||
|
||||
config_get ffip ff ipaddr
|
||||
config_get ffmask ff netmask
|
||||
|
||||
config_get ffdip ffdhcp ipaddr
|
||||
config_get ffdmask ffdhcp netmask
|
||||
|
||||
[ -n "$ffif" ] || return 0
|
||||
|
||||
|
||||
### Creating chains
|
||||
iptables -N luci_freifunk_forwarding
|
||||
iptables -t nat -N luci_freifunk_postrouting
|
||||
|
||||
|
||||
### Read from config
|
||||
config_load freifunk
|
||||
|
||||
config_get_bool internal routing internal
|
||||
[ -n "$wanif" ] && config_get_bool internet routing internet
|
||||
|
||||
|
||||
### Freifunk to Freifunk
|
||||
[ "$internal" -gt 0 ] && {
|
||||
iptables -A luci_freifunk_forwarding -i "$ffif" -o "$ffif" -j ACCEPT
|
||||
}
|
||||
|
||||
### Freifunk DHCP to Freifunk
|
||||
[ "$internal" -gt 0 -a -n "$ffdif" ] && {
|
||||
eval "$(ipcalc.sh $ffdip $ffdmask)"
|
||||
|
||||
iptables -t nat -A luci_freifunk_postrouting -s "$NETWORK/$PREFIX" -o "$ffif" -j MASQUERADE
|
||||
}
|
||||
|
||||
### Lan to Freifunk
|
||||
[ -n "$lanif" ] && {
|
||||
eval "$(ipcalc.sh $lanip $lanmask)"
|
||||
|
||||
iptables -A luci_freifunk_forwarding -i "$lanif" -o "$ffif" -j ACCEPT
|
||||
iptables -t nat -A luci_freifunk_postrouting -s "$NETWORK/$PREFIX" -o "$ffif" -j MASQUERADE
|
||||
}
|
||||
|
||||
### Freifunk to Wan
|
||||
[ "$internet" -gt 0 ] && {
|
||||
eval "$(ipcalc.sh $ffip $ffmask)"
|
||||
|
||||
iptables -A luci_freifunk_forwarding -i "$ffif" -o "$wanif" -j ACCEPT
|
||||
iptables -t nat -A luci_freifunk_postrouting -s "$NETWORK/$PREFIX" -o "$wanif" -j MASQUERADE
|
||||
}
|
||||
|
||||
### Freifunk DHCP to Wan
|
||||
[ "$internet" -gt 0 -a -n "$ffdif" ] && {
|
||||
eval "$(ipcalc.sh $ffdip $ffdmask)"
|
||||
|
||||
iptables -t nat -A luci_freifunk_postrouting -s "$NETWORK/$PREFIX" -o "$wanif" -j MASQUERADE
|
||||
}
|
||||
|
||||
### Hook in the chains
|
||||
iptables -A forwarding_rule -j luci_freifunk_forwarding
|
||||
iptables -t nat -A postrouting_rule -j luci_freifunk_postrouting
|
||||
}
|
||||
|
||||
stop() {
|
||||
### Hook out the chains
|
||||
iptables -D forwarding_rule -j luci_freifunk_forwarding
|
||||
iptables -t nat -D postrouting_rule -j luci_freifunk_postrouting
|
||||
|
||||
### Clear the chains
|
||||
iptables -F luci_freifunk_forwarding
|
||||
iptables -t nat -F luci_freifunk_postrouting
|
||||
|
||||
### Delete chains
|
||||
iptables -X luci_freifunk_forwarding
|
||||
iptables -t nat -X luci_freifunk_postrouting
|
||||
}
|
|
@ -1,171 +0,0 @@
|
|||
module("ffluci.controller.admin.index", package.seeall)
|
||||
|
||||
function action_wizard()
|
||||
if ffluci.http.formvalue("ip") then
|
||||
return configure_freifunk()
|
||||
end
|
||||
|
||||
local ifaces = {}
|
||||
local wldevs = ffluci.model.uci.sections("wireless")
|
||||
|
||||
if wldevs then
|
||||
for k, v in pairs(wldevs) do
|
||||
if v[".type"] == "wifi-device" then
|
||||
table.insert(ifaces, k)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ffluci.template.render("admin_index/wizard", {ifaces=ifaces})
|
||||
end
|
||||
|
||||
function configure_freifunk()
|
||||
local ip = ffluci.http.formvalue("ip")
|
||||
local uci = ffluci.model.uci.Session()
|
||||
|
||||
-- Load UCI
|
||||
uci:t_load("network")
|
||||
uci:t_load("dhcp")
|
||||
uci:t_load("freifunk")
|
||||
uci:t_load("luci_splash")
|
||||
uci:t_load("olsr")
|
||||
uci:t_load("wireless")
|
||||
|
||||
|
||||
-- Configure FF-Interface
|
||||
uci:t_del("network", "ff")
|
||||
uci:t_del("network", "ffdhcp")
|
||||
|
||||
uci:t_set("network", "ff", nil, "interface")
|
||||
uci:t_set("network", "ff", "type", "bridge")
|
||||
uci:t_set("network", "ff", "proto", "static")
|
||||
uci:t_set("network", "ff", "ipaddr", ip)
|
||||
uci:t_set("network", "ff", "netmask", uci:t_get("freifunk", "community", "mask"))
|
||||
uci:t_set("network", "ff", "dns", uci:t_get("freifunk", "community", "dns"))
|
||||
|
||||
-- Enable internal routing
|
||||
uci:t_set("freifunk", "routing", "internal", "1")
|
||||
|
||||
-- Enable internet routing
|
||||
if ffluci.http.formvalue("shareinet") then
|
||||
uci:t_set("freifunk", "routing", "internet", "1")
|
||||
else
|
||||
uci:t_set("freifunk", "routing", "internet", "0")
|
||||
end
|
||||
|
||||
-- Configure DHCP
|
||||
if ffluci.http.formvalue("dhcp") then
|
||||
local dhcpnet = uci:t_get("freifunk", "community", "dhcp"):match("^([0-9]+)")
|
||||
local dhcpip = ip:gsub("^[0-9]+", dhcpnet)
|
||||
|
||||
uci:t_set("network", "ffdhcp", nil, "interface")
|
||||
uci:t_set("network", "ffdhcp", "proto", "static")
|
||||
uci:t_set("network", "ffdhcp", "ifname", "br-ff:dhcp")
|
||||
uci:t_set("network", "ffdhcp", "ipaddr", dhcpip)
|
||||
uci:t_set("network", "ffdhcp", "netmask", uci:t_get("freifunk", "community", "dhcpmask"))
|
||||
|
||||
local dhcp = uci:t_sections("dhcp")
|
||||
if dhcp then
|
||||
for k, v in pairs(dhcp) do
|
||||
if v[".type"] == "dhcp" and v.interface == "ffdhcp" then
|
||||
uci:t_del("dhcp", k)
|
||||
end
|
||||
end
|
||||
|
||||
local dhcpbeg = 48 + tonumber(ip:match("[0-9]+$")) * 4
|
||||
|
||||
local sk = uci:t_add("dhcp", "dhcp")
|
||||
uci:t_set("dhcp", sk, "interface", "ffdhcp")
|
||||
uci:t_set("dhcp", sk, "start", dhcpbeg)
|
||||
uci:t_set("dhcp", sk, "limit", (dhcpbeg < 252) and 3 or 2)
|
||||
uci:t_set("dhcp", sk, "leasetime", "30m")
|
||||
end
|
||||
|
||||
local splash = uci:t_sections("luci_splash")
|
||||
if splash then
|
||||
for k, v in pairs(splash) do
|
||||
if v[".type"] == "iface" then
|
||||
uci:t_del("luci_splash", k)
|
||||
end
|
||||
end
|
||||
|
||||
local sk = uci:t_add("luci_splash", "iface")
|
||||
uci:t_set("luci_splash", sk, "network", "ffdhcp")
|
||||
end
|
||||
end
|
||||
|
||||
-- Configure OLSR
|
||||
if ffluci.http.formvalue("olsr") and uci:t_sections("olsr") then
|
||||
for k, v in pairs(uci:t_sections("olsr")) do
|
||||
if v[".type"] == "Interface" or v[".type"] == "LoadPlugin" then
|
||||
uci:t_del("olsr", k)
|
||||
end
|
||||
end
|
||||
|
||||
if ffluci.http.formvalue("shareinet") then
|
||||
uci:t_set("olsr", "dyn_gw", nil, "LoadPlugin")
|
||||
uci:t_set("olsr", "dyn_gw", "Library", "olsrd_dyn_gw.so.0.4")
|
||||
end
|
||||
|
||||
uci:t_set("olsr", "nameservice", nil, "LoadPlugin")
|
||||
uci:t_set("olsr", "nameservice", "Library", "olsrd_nameservice.so.0.3")
|
||||
uci:t_set("olsr", "nameservice", "name", ip:gsub("%.", "-"))
|
||||
uci:t_set("olsr", "nameservice", "hosts_file", "/var/etc/hosts")
|
||||
uci:t_set("olsr", "nameservice", "suffix", ".olsr")
|
||||
uci:t_set("olsr", "nameservice", "latlon_infile", "/tmp/latlon.txt")
|
||||
|
||||
uci:t_set("olsr", "txtinfo", nil, "LoadPlugin")
|
||||
uci:t_set("olsr", "txtinfo", "Library", "olsrd_txtinfo.so.0.1")
|
||||
uci:t_set("olsr", "txtinfo", "Accept", "127.0.0.1")
|
||||
|
||||
local oif = uci:t_add("olsr", "Interface")
|
||||
uci:t_set("olsr", oif, "Interface", "ff")
|
||||
uci:t_set("olsr", oif, "HelloInterval", "6.0")
|
||||
uci:t_set("olsr", oif, "HelloValidityTime", "108.0")
|
||||
uci:t_set("olsr", oif, "TcInterval", "4.0")
|
||||
uci:t_set("olsr", oif, "TcValidityTime", "324.0")
|
||||
uci:t_set("olsr", oif, "MidInterval", "18.0")
|
||||
uci:t_set("olsr", oif, "MidValidityTime", "324.0")
|
||||
uci:t_set("olsr", oif, "HnaInterval", "18.0")
|
||||
uci:t_set("olsr", oif, "HnaValidityTime", "108.0")
|
||||
end
|
||||
|
||||
-- Configure Wifi
|
||||
local wcfg = uci:t_sections("wireless")
|
||||
if wcfg then
|
||||
for iface, v in pairs(wcfg) do
|
||||
if v[".type"] == "wifi-device" and ffluci.http.formvalue("wifi."..iface) then
|
||||
-- Cleanup
|
||||
for k, j in pairs(wcfg) do
|
||||
if j[".type"] == "wifi-iface" and j.device == iface then
|
||||
uci:t_del("wireless", k)
|
||||
end
|
||||
end
|
||||
|
||||
uci:t_set("wireless", iface, "disabled", "0")
|
||||
uci:t_set("wireless", iface, "mode", "11g")
|
||||
uci:t_set("wireless", iface, "txantenna", 1)
|
||||
uci:t_set("wireless", iface, "rxantenna", 1)
|
||||
uci:t_set("wireless", iface, "channel", uci:t_get("freifunk", "community", "channel"))
|
||||
|
||||
local wif = uci:t_add("wireless", "wifi-iface")
|
||||
uci:t_set("wireless", wif, "device", iface)
|
||||
uci:t_set("wireless", wif, "network", "ff")
|
||||
uci:t_set("wireless", wif, "mode", "adhoc")
|
||||
uci:t_set("wireless", wif, "ssid", uci:t_get("freifunk", "community", "essid"))
|
||||
uci:t_set("wireless", wif, "bssid", uci:t_get("freifunk", "community", "bssid"))
|
||||
uci:t_set("wireless", wif, "txpower", 13)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Save UCI
|
||||
uci:t_save("network")
|
||||
uci:t_save("dhcp")
|
||||
uci:t_save("freifunk")
|
||||
uci:t_save("luci_splash")
|
||||
uci:t_save("olsr")
|
||||
uci:t_save("wireless")
|
||||
|
||||
ffluci.http.redirect(ffluci.dispatcher.build_url("admin", "uci", "changes"))
|
||||
end
|
|
@ -1,18 +0,0 @@
|
|||
-- Todo: Translate
|
||||
m = Map("freifunk", translate("contact", "Kontakt"), translate("contact1", [[Diese Daten sind
|
||||
auf der öffentlichen Kontaktseite sichtbar. Bitte gib an, wie man dich am besten kontaktieren kann.
|
||||
Diese Informationen sollten nach der Picopeering Vereinbarung mindestens deine E-Mail-Adresse enthalten.
|
||||
Damit dein Knoten durch Topographieprogramme erfasst werden kann, gib bitte deine Geokoordinaten oder
|
||||
zumindest deine Straße und Hausnummer unter Standort an.]]))
|
||||
|
||||
c = m:section(NamedSection, "contact", "public")
|
||||
|
||||
c:option(Value, "nickname", translate("nickname", "Pseudonym"))
|
||||
c:option(Value, "name", translate("name", "Name"))
|
||||
c:option(Value, "mail", translate("mail", "E-Mail"), translate("mail1", "Bitte unbedingt angeben!"))
|
||||
c:option(Value, "phone", translate("phone", "Telefon"))
|
||||
c:option(Value, "location", translate("location", "Standort"))
|
||||
c:option(Value, "geo", translate("coord", "Koordinaten"), translate("coord1", "Bitte als Breite;Länge (z.B: 51.5;12.9) angeben"))
|
||||
c:option(Value, "note", translate("note", "Notiz"))
|
||||
|
||||
return m
|
|
@ -1,23 +0,0 @@
|
|||
-- Todo: Translate
|
||||
m = Map("freifunk", "Freifunk")
|
||||
|
||||
s = m:section(NamedSection, "routing", "settings", "Netzverkehr")
|
||||
s:option(Flag, "internal", "Freifunk zulassen", "immer aktivieren!")
|
||||
s:option(Flag, "internet", "Internet zulassen")
|
||||
|
||||
c = m:section(NamedSection, "community", "public", "Gemeinschaft", [[Dies sind die Grundeinstellungen
|
||||
für die lokale Freifunkgemeinschaft. Diese Werte wirken sich NICHT auf die Konfiguration
|
||||
des Routers aus, sondern definieren nur die Vorgaben für den Freifunkassistenten.]])
|
||||
c:option(Value, "name", "Gemeinschaft")
|
||||
c:option(Value, "homepage", "Webseite")
|
||||
c:option(Value, "essid", "ESSID")
|
||||
c:option(Value, "bssid", "BSSID")
|
||||
c:option(Value, "channel", "Funkkanal")
|
||||
c:option(Value, "realm", "Realm")
|
||||
c:option(Value, "net", "Adressbereich")
|
||||
c:option(Value, "mask", "Netzmaske")
|
||||
c:option(Value, "dns", "DNS-Server")
|
||||
c:option(Value, "dhcp", "DHCP-Bereich")
|
||||
c:option(Value, "dhcpmask", "DHCP-Maske")
|
||||
|
||||
return m
|
|
@ -1,35 +0,0 @@
|
|||
LUAC = luac
|
||||
LUAC_OPTIONS = -s
|
||||
|
||||
FILES = i18n/* view/*/*.htm
|
||||
|
||||
CFILES = controller/*/*.lua model/cbi/*/*.lua model/menu/*.lua
|
||||
|
||||
DIRECTORIES = model/cbi model/menu controller i18n view
|
||||
|
||||
|
||||
INFILES = $(CFILES:%=src/%)
|
||||
OUTDIRS = $(DIRECTORIES:%=dist/%)
|
||||
CPFILES = $(FILES:%=src/%)
|
||||
|
||||
.PHONY: all compile source clean depends
|
||||
|
||||
all: compile
|
||||
|
||||
|
||||
depends:
|
||||
mkdir -p $(OUTDIRS)
|
||||
for i in $(CPFILES); do if [ -f "$$i" ]; then i=$$(echo $$i | cut -d/ -f2-); \
|
||||
mkdir -p dist/$$(dirname $$i); cp src/$$i dist/$$i; fi; done
|
||||
|
||||
compile: depends
|
||||
for i in $(INFILES); do if [ -f "$$i" ]; then i=$$(echo $$i | cut -d/ -f2-); \
|
||||
mkdir -p dist/$$(dirname $$i); $(LUAC) $(LUAC_OPTIONS) -o dist/$$i src/$$i; fi; done
|
||||
|
||||
source: depends
|
||||
for i in $(INFILES); do if [ -f "$$i" ]; then i=$$(echo $$i | cut -d/ -f2-); \
|
||||
mkdir -p dist/$$(dirname $$i); cp src/$$i dist/$$i; fi; done
|
||||
|
||||
|
||||
clean:
|
||||
rm dist -rf
|
|
@ -1 +0,0 @@
|
|||
module("ffluci.controller.public.index", package.seeall)
|
|
@ -1,137 +0,0 @@
|
|||
module("ffluci.controller.public.olsr", package.seeall)
|
||||
require("ffluci.sys")
|
||||
|
||||
function action_index()
|
||||
local data = fetch_txtinfo("links")
|
||||
|
||||
if not data or not data.Links then
|
||||
ffluci.template.render("public_olsr/error_olsr")
|
||||
return nil
|
||||
end
|
||||
|
||||
local function compare(a, b)
|
||||
if tonumber(a.ETX) == 0 then
|
||||
return false
|
||||
end
|
||||
|
||||
if tonumber(b.ETX) == 0 then
|
||||
return true
|
||||
end
|
||||
|
||||
return tonumber(a.ETX) < tonumber(b.ETX)
|
||||
end
|
||||
|
||||
table.sort(data.Links, compare)
|
||||
|
||||
ffluci.template.render("public_olsr/index", {links=data.Links})
|
||||
end
|
||||
|
||||
function action_routes()
|
||||
local data = fetch_txtinfo("routes")
|
||||
|
||||
if not data or not data.Routes then
|
||||
ffluci.template.render("public_olsr/error_olsr")
|
||||
return nil
|
||||
end
|
||||
|
||||
local function compare(a, b)
|
||||
if tonumber(a.ETX) == 0 then
|
||||
return false
|
||||
end
|
||||
|
||||
if tonumber(b.ETX) == 0 then
|
||||
return true
|
||||
end
|
||||
|
||||
return tonumber(a.ETX) < tonumber(b.ETX)
|
||||
end
|
||||
|
||||
table.sort(data.Routes, compare)
|
||||
|
||||
ffluci.template.render("public_olsr/routes", {routes=data.Routes})
|
||||
end
|
||||
|
||||
function action_topology()
|
||||
local data = fetch_txtinfo("topology")
|
||||
|
||||
if not data or not data.Topology then
|
||||
ffluci.template.render("public_olsr/error_olsr")
|
||||
return nil
|
||||
end
|
||||
|
||||
local function compare(a, b)
|
||||
return a["Destination IP"] < b["Destination IP"]
|
||||
end
|
||||
|
||||
table.sort(data.Topology, compare)
|
||||
|
||||
ffluci.template.render("public_olsr/topology", {routes=data.Topology})
|
||||
end
|
||||
|
||||
function action_hna()
|
||||
local data = fetch_txtinfo("hna")
|
||||
|
||||
if not data or not data.HNA then
|
||||
ffluci.template.render("public_olsr/error_olsr")
|
||||
return nil
|
||||
end
|
||||
|
||||
local function compare(a, b)
|
||||
return a.Network < b.Network
|
||||
end
|
||||
|
||||
table.sort(data.HNA, compare)
|
||||
|
||||
ffluci.template.render("public_olsr/hna", {routes=data.HNA})
|
||||
end
|
||||
|
||||
function action_mid()
|
||||
local data = fetch_txtinfo("mid")
|
||||
|
||||
if not data or not data.MID then
|
||||
ffluci.template.render("public_olsr/error_olsr")
|
||||
return nil
|
||||
end
|
||||
|
||||
local function compare(a, b)
|
||||
return a.IP < b.IP
|
||||
end
|
||||
|
||||
table.sort(data.MID, compare)
|
||||
|
||||
ffluci.template.render("public_olsr/mid", {mids=data.MID})
|
||||
end
|
||||
|
||||
|
||||
-- Internal
|
||||
function fetch_txtinfo(otable)
|
||||
otable = otable or ""
|
||||
local rawdata = ffluci.sys.httpget("http://127.0.0.1:2006/"..otable)
|
||||
|
||||
if #rawdata == 0 then
|
||||
return nil
|
||||
end
|
||||
|
||||
local data = {}
|
||||
|
||||
local tables = ffluci.util.split(ffluci.util.trim(rawdata), "\n\n")
|
||||
|
||||
|
||||
for i, tbl in ipairs(tables) do
|
||||
local lines = ffluci.util.split(tbl, "\n")
|
||||
local name = table.remove(lines, 1):sub(8)
|
||||
local keys = ffluci.util.split(table.remove(lines, 1), "\t")
|
||||
|
||||
data[name] = {}
|
||||
|
||||
for j, line in ipairs(lines) do
|
||||
local fields = ffluci.util.split(line, "\t")
|
||||
data[name][j] = {}
|
||||
for k, key in pairs(keys) do
|
||||
data[name][j][key] = fields[k]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return data
|
||||
end
|
|
@ -1,21 +0,0 @@
|
|||
module("ffluci.controller.public.status", package.seeall)
|
||||
|
||||
function action_index()
|
||||
local data = {}
|
||||
|
||||
data.s, data.m, data.r = ffluci.sys.sysinfo()
|
||||
|
||||
data.wifi = ffluci.sys.wifi.getiwconfig()
|
||||
|
||||
data.routes = {}
|
||||
for i, r in pairs(ffluci.sys.net.routes()) do
|
||||
if r.Destination == "00000000" then
|
||||
table.insert(data.routes, r)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
ffluci.template.render("public_status/index", data)
|
||||
end
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
module("ffluci.controller.sudo.status", package.seeall)
|
|
@ -1,12 +0,0 @@
|
|||
add("public", "index", "Übersicht", 10)
|
||||
act("contact", "Kontakt")
|
||||
|
||||
add("public", "status", "Status", 20)
|
||||
act("routes", "Routingtabelle")
|
||||
act("iwscan", "WLAN-Scan")
|
||||
|
||||
add("public", "olsr", "OLSR", 30)
|
||||
act("routes", "Routen")
|
||||
act("topology", "Topologie")
|
||||
act("hna", "HNA")
|
||||
act("mid", "MID")
|
|
@ -1,13 +0,0 @@
|
|||
<%+header%>
|
||||
<% local contact = ffluci.model.uci.sections("freifunk").contact %>
|
||||
<h1><%:contact Kontakt%></h1>
|
||||
<table cellspacing="0" cellpadding="6">
|
||||
<tr><th><%:nickname Pseudonym%>:</th><td><%=contact.nickname%></td></tr>
|
||||
<tr><th><%:name Name%>:</th><td><%=contact.name%></td></tr>
|
||||
<tr><th><%:mail E-Mail%>:</th><td><%=contact.mail%></td></tr>
|
||||
<tr><th><%:phone Telefon%>:</th><td><%=contact.phone%></td></tr>
|
||||
<tr><th><%:location Standort%>:</th><td><%=contact.location%></td></tr>
|
||||
<tr><th><%:geocoord Geokoordinaten%>:</th><td><%=contact.geo%></td></tr>
|
||||
<tr><th><%:note Notiz%>:</th><td><%=contact.note%></td></tr>
|
||||
</table>
|
||||
<%+footer%>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue