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"
--- /dev/null
+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
\ No newline at end of file
+++ /dev/null
-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.
\ No newline at end of file
--- /dev/null
+include ../../build/config.mk
+include ../../build/module.mk
\ No newline at end of file
--- /dev/null
+#!/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
+
\ No newline at end of file
--- /dev/null
+include ../../build/config.mk
+include ../../build/module.mk
\ No newline at end of file
--- /dev/null
+sel("admin", "network")
+act("portfw", "Portweiterleitung")
+act("firewall", "Firewall")
\ No newline at end of file
--- /dev/null
+include ../../build/config.mk
+include ../../build/module.mk
\ No newline at end of file
--- /dev/null
+sel("admin", "services")
+act("splash", "Client-Splash")
\ No newline at end of file
--- /dev/null
+include ../../build/config.mk
+include ../../build/module.mk
\ No newline at end of file
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>
--- /dev/null
+include ../../build/config.mk
+include ../../build/module.mk
\ No newline at end of file
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>
--- /dev/null
+LUAC = luac
+LUAC_OPTIONS = -s
+LUCI_INSTALLDIR = /usr/lib/lua/ffluci
\ No newline at end of file
--- /dev/null
+.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
\ No newline at end of file
+++ /dev/null
-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))
+++ /dev/null
-/etc/config/luci_splash
\ No newline at end of file
+++ /dev/null
-#!/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)
\ No newline at end of file
+++ /dev/null
-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))
include $(TOPDIR)/rules.mk
+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_REV:=HEAD
-PKG_VERSION:=0.3+svn$(PKG_REV)
+PKG_VERSION:=0.4+svn$(PKG_REV)
PKG_RELEASE:=1
-PKG_BRANCH:=trunk
+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
+define Build/Configure
+endef
+
+define Build/Compile
+ $(MAKE) -C$(PKG_BUILD_DIR) build LUA_TARGET=$(LUA_TARGET)
+endef
+
+
+define Package/ffluci/template
SECTION:=admin
CATEGORY:=Administration
- TITLE:=FFLuCI
- SUBMENU:=FFLuCI
- DEPENDS:=+luaposix +haserl-lua +ffluci-system-addons
+ TITLE:=FFLuCI - Freifunk Lua Configuration Interface
+ URL:=http://luci.freifunk-halle.net/
MAINTAINER:=Steven Barth <steven-at-midlink-dot-org>
endef
-define Build/Configure
+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 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)
+
+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)
-endef
-
-$(eval $(call BuildPackage,ffluci))
\ No newline at end of file
+ $(call Package/ffluci/install/template,$(1),core)
+ $(call Package/ffluci/install/template,$(1),themes/fledermaus)
+endef
+
+
+
+### 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))
\ No newline at end of file
+++ /dev/null
-/etc/config/luci
-/etc/config/luci_fw
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+[ -n "${IPKG_INSTROOT}" ] || {
+ ( . /etc/uci-defaults/ffluci-community-leipzig ) && rm -f /etc/uci-defaults/ffluci-community-leipzig
+}
--- /dev/null
+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))
\ No newline at end of file
-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
\ No newline at end of file
+++ /dev/null
-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
-
\ No newline at end of file
+++ /dev/null
-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
+++ /dev/null
-#!/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
-}
+++ /dev/null
-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
\ No newline at end of file
+++ /dev/null
--- 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
\ No newline at end of file
+++ /dev/null
--- 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
\ No newline at end of file
+++ /dev/null
-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
+++ /dev/null
-module("ffluci.controller.public.index", package.seeall)
\ No newline at end of file
+++ /dev/null
-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
\ No newline at end of file
+++ /dev/null
-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
-
-
+++ /dev/null
-module("ffluci.controller.sudo.status", package.seeall)
\ No newline at end of file
+++ /dev/null
-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")
+++ /dev/null
-<%+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%>
\ No newline at end of file
+++ /dev/null
-<%+header%>
-<% local ff = ffluci.model.uci.sections("freifunk") %>
-<h1><%:hellonet Hallo und willkommen im Netz von%> <%=ff.community.name%>!</h1>
-<p><%:public1 Wir sind eine Initiative zur Schaffung eines freien, offenen und unabhängigen Funknetzwerks auf WLAN-Basis.%><br />
-<%:public2 Dies ist der Zugangspunkt %><%=ffluci.sys.hostname()%>. <%:public3 Er wird betrieben von %>
-<a href="<%=controller%>/public/index/contact"><%=ff.contact.nickname%></a>.</p>
-<p><%:public4 Weitere Informationen zur globalen Freifunkinitiative findest du unter%> <a href="http://freifunk.net">Freifunk.net</a>.<br />
-<%:public5 Hast du Interesse an diesem Projekt, dann wende dich an deine lokale Gemeinschaft%> <a href="<%=ff.community.homepage%>"><%=ff.community.name%></a>.</p>
-<p><strong><%:note Hinweis%></strong>: <%:public6 Der Internetzugang über das experimentelle Freifunknetz ist an technische und organisatorische Bedingungen geknüpft und deshalb möglicherweise
-nicht (immer) gewährleistet.%></p>
-<%+footer%>
\ No newline at end of file
+++ /dev/null
-<%+header%>
-<h1><%:olsr OLSR%></h1>
-<p class="error"><%:olsrerror1 Es konnte keine Verbindung zum OLSR-Daemon hergestellt werden!%></p>
-<p><%:olsrerror2 Um die Statusinformationen abfragen zu können muss der OLSR-Daemon gestartet
-und das Plugin "txtinfo" geladen sein.%></p>
-<%+footer%>
\ No newline at end of file
+++ /dev/null
-<%+header%>
-<h1><%:olsrhna OLSR-HNA%></h1>
-<br />
-<table cellspacing="0" cellpadding="6">
-<tr>
-<th><%:destination Ziel%></th>
-<th><%:gateway Gateway%></th>
-</tr>
-<% for k, route in ipairs(routes) do %>
-<tr>
-<td><%=route.Network%>/<%=route.Netmask%></td>
-<td><a href="http://<%=route.Gateway%>"><%=route.Gateway%></a></td>
-</tr>
-<% end %>
-</table>
-<br />
-<%+footer%>
\ No newline at end of file
+++ /dev/null
-<%+header%>
-<h1><%:olsrlinks OLSR-Verbindungen%></h1>
-<p><%:olsrlinks1 Übersicht über aktuell bestehende OLSR-Verbindungen%></p>
-<br />
-<table cellspacing="0" cellpadding="6">
-<tr>
-<th><%:destination Ziel%></th>
-<th><%:local Lokal%></th>
-<th>LQ</th>
-<th>NLQ</th>
-<th>ETX</th>
-</tr>
-<% for k, link in ipairs(links) do
- local color = "#bb3333"
-
- link.ETX = tonumber(link.ETX)
- if link.ETX == 0 then
- color = "#bb3333"
- elseif link.ETX < 4 then
- color = "#00cc00"
- elseif link.ETX < 10 then
- color = "#ffcb05"
- elseif link.ETX < 100 then
- color = "#ff6600"
- end
-%>
-<tr>
-<td><a href="http://<%=link["remote IP"]%>"><%=link["remote IP"]%></a></td>
-<td><%=link["Local IP"]%></td>
-<td><%=link.LinkQuality%></td>
-<td><%=link.NLQ%></td>
-<td style="background-color:<%=color%>"><%=link.ETX%></td>
-</tr>
-<% end %>
-</table>
-<br />
-<h3><%:legend Legende%>:</h3>
-<ul>
-<li><strong>LQ: </strong><%:lq1 Erfolgsquote gesendeter Pakete%></li>
-<li><strong>NLQ: </strong><%:nlq1 Erfolgsquote empfangener Pakete%></li>
-<li><strong>ETX: </strong><%:etx1 Zu erwartende Sendeversuche pro Paket%></li>
-</ul>
-<%+footer%>
\ No newline at end of file
+++ /dev/null
-<%+header%>
-<h1><%:olsrmid OLSR-MID%></h1>
-<br />
-<table cellspacing="0" cellpadding="6">
-<tr>
-<th><%:node Knoten%></th>
-<th><%:aliases Aliasse%></th>
-</tr>
-<% for k, mid in ipairs(mids) do %>
-<tr>
-<td><a href="http://<%=mid.IP%>"><%=mid.IP%></a></td>
-<td><%=mid.Aliases%></td>
-</tr>
-<% end %>
-</table>
-<br />
-<%+footer%>
\ No newline at end of file
+++ /dev/null
-<%+header%>
-<h1><%:olsrlinks OLSR-Routen%></h1>
-<br />
-<table cellspacing="0" cellpadding="6">
-<tr>
-<th><%:destination Ziel%></th>
-<th><%:gateway Gateway%></th>
-<th><%:interface Schnittstelle%></th>
-<th><%:metric Metrik%></th>
-<th>ETX</th>
-</tr>
-<% for k, route in ipairs(routes) do
- local color = "#bb3333"
-
- route.ETX = tonumber(route.ETX)
- if route.ETX == 0 then
- color = "#bb3333"
- elseif route.ETX < 4 then
- color = "#00cc00"
- elseif route.ETX < 10 then
- color = "#ffcb05"
- elseif route.ETX < 100 then
- color = "#ff6600"
- end
-%>
-<tr>
-<td><%=route.Destination%></td>
-<td><%=route.Gateway%></td>
-<td><%=route.Interface%></td>
-<td><%=route.Metric%></td>
-<td style="background-color:<%=color%>"><%=route.ETX%></td>
-</tr>
-<% end %>
-</table>
-<br />
-<%+footer%>
\ No newline at end of file
+++ /dev/null
-<%+header%>
-<h1><%:olsrtopo OLSR-Topologie%></h1>
-<br />
-<table cellspacing="0" cellpadding="6">
-<tr>
-<th><%:destination Ziel%></th>
-<th><%:lasthop Letzter Router%></th>
-<th>LQ</th>
-<th>ILQ</th>
-<th>ETX</th>
-</tr>
-<% for k, route in ipairs(routes) do %>
-<tr>
-<td><a href="http://<%=route["Destination IP"]%>"><%=route["Destination IP"]%></a></td>
-<td><a href="http://<%=route["Last hop IP"]%>"><%=route["Last hop IP"]%></a></td>
-<td><%=route.LQ%></td>
-<td><%=route.ILQ%></td>
-<td><%=route.ETX%></td>
-</tr>
-<% end %>
-</table>
-<br />
-<%+footer%>
\ No newline at end of file
+++ /dev/null
-<%+header%>
-<h1><%:status Status%></h1>
-<h2><%:system System%></h2>
-
-<br />
-<table cellspacing="0" cellpadding="6" class="smalltext">
-<tr>
-<th><%:system_type Systemtyp%>:</th>
-<td><%=s%></td>
-</tr>
-<tr>
-<th><%:cpu Prozessor%>:</th>
-<td><%=m%></td>
-</tr>
-<tr>
-<th><%:ram Hauptspeicher%>:</th>
-<td><%=r%></td>
-</tr>
-</table>
-<br /><br />
-
-<h2><%:wifi Drahtlos%></h2>
-<br />
-<table cellspacing="0" cellpadding="6" class="smalltext">
-<tr>
-<th><%:name Name%></th>
-<th><%:protocol Protokoll%></th>
-<th><%:frequency Frequenz%></th>
-<th><%:power Leistung%></th>
-<th><%:bitrate Bitrate%></th>
-<th><%:rts RTS%></th>
-<th><%:frag Frag.%></th>
-<th><%:link Verb.%></th>
-<th><%:signal Signal%></th>
-<th><%:noise Rausch%></th>
-</tr>
-<%=ffluci.sys.httpget("http://127.0.0.1" .. controller .. "/sudo/status/iwconfig")%>
-</table>
-<br />
-<br />
-<h2><%:defroutes Standardrouten%></h2>
-<br />
-<table cellspacing="0" cellpadding="6" class="smalltext">
-<tr>
-<th><%:gateway Gateway%></th>
-<th><%:metric Metrik%></th>
-<th><%:iface Schnittstelle%></th>
-</tr>
-<%
-for i, rt in pairs(routes) do
-%>
-<tr>
-<td><%=ffluci.sys.net.hexip4(rt.Gateway)%></th>
-<td><%=rt.Metric%></th>
-<td><%=rt.Iface%></th>
-</tr>
-<% end %>
-</table>
-<%+footer%>
\ No newline at end of file
+++ /dev/null
-<%+header%>
-<h1><%:iwscan WLAN-Scan%></h1>
-<p><%:iwscan1 Drahtlosnetzwerke in der lokalen Umgebung des Routers:%></p>
-
-<br />
-<table cellspacing="0" cellpadding="6" class="smalltext">
-<tr>
-<th><%:interface Schnittstelle%></th>
-<th><%:essid ESSID%></th>
-<th><%:bssid BSSID%></th>
-<th><%:mode Modus%></th>
-<th><%:channel Kanal%></th>
-<th><%:encr Vers.%></th>
-<th><%:link Verb.%></th>
-<th><%:signal Signal%></th>
-<th><%:noise Rausch%></th>
-</tr>
-<%=ffluci.sys.httpget("http://127.0.0.1" .. controller .. "/sudo/status/iwscan")%>
-</table>
-<br />
-<%+footer%>
\ No newline at end of file
+++ /dev/null
-<%+header%>
-<h1><%:routes Routen%></h1>
-
-<br />
-<table cellspacing="0" cellpadding="6" class="smalltext">
-<tr>
-<th><%:target Ziel%></th>
-<th><%:netmask Netzmaske%></th>
-<th><%:gateway Gateway%></th>
-<th><%:metric Metrik%></th>
-<th><%:iface Schnittstelle%></th>
-</tr>
-<%
-local routes = ffluci.sys.net.routes()
-
-for i, r in pairs(routes) do
-%>
-<tr>
-<td><%=ffluci.sys.net.hexip4(r.Destination)%></td>
-<td><%=ffluci.sys.net.hexip4(r.Mask)%></td>
-<td><%=ffluci.sys.net.hexip4(r.Gateway)%></td>
-<td><%=r.Metric%></td>
-<td><%=r.Iface%></td>
-</tr>
-<% end %>
-</table>
-<br />
-<%+footer%>
\ No newline at end of file
+++ /dev/null
-<%
-ffluci.http.prepare_content("text/plain")
-for k, v in pairs(ffluci.sys.wifi.getiwconfig()) do
-%>
-<tr>
-<td rowspan="2"><%=k%></td>
-<td><%=v[1]%></td>
-<td><%=v.Frequency%></td>
-<td><%=v["Tx-Power"]%></td>
-<td><%=v["Bit Rate"]%></td>
-<td><%=v["RTS thr"]%></td>
-<td><%=v["Fragment thr"]%></td>
-<td><%=v["Link Quality"]%></td>
-<td><%=v["Signal level"]%></td>
-<td><%=v["Noise level"]%></td>
-</tr>
-<tr>
-<td colspan="4"><strong>ESSID: </strong><%=v.ESSID%></td>
-<td colspan="5"><strong>BSSID: </strong><%=(v.Cell or v["Access Point"])%></td>
-</tr>
-<%end%>
+++ /dev/null
-<%
-ffluci.http.prepare_content("text/plain")
-for iface, cells in pairs(ffluci.sys.wifi.iwscan()) do
- for i, cell in ipairs(cells) do
-%>
-<tr>
-<td><%=iface%></td>
-<td><%=cell.ESSID%></td>
-<td><%=cell.Address%></td>
-<td><%=cell.Mode%></td>
-<td><%=(cell.Channel or cell.Frequency or "")%></td>
-<td><%=cell["Encryption key"]%></td>
-<td><%=cell.Quality%></td>
-<td><%=cell["Signal level"]%></td>
-<td><%=cell["Noise level"]%></td>
-</tr>
-<%
- end
-end
-%>
-
-
+++ /dev/null
-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
+++ /dev/null
-module("ffluci.controller.rpc.luciinfo", package.seeall)
-
-function action_index()
- local uci = ffluci.model.uci.StateSession()
-
- ffluci.http.prepare_content("text/plain")
-
- -- General
- print("luciinfo.api=1")
- print("luciinfo.version=" .. tostring(ffluci.__version__))
-
- -- Sysinfo
- local s, m, r = ffluci.sys.sysinfo()
- local dr = ffluci.sys.net.defaultroute()
- dr = dr and ffluci.sys.net.hexip4(dr.Gateway) or ""
- local l1, l5, l15 = ffluci.sys.loadavg()
-
- print("sysinfo.system=" .. sanitize(s))
- print("sysinfo.cpu=" .. sanitize(m))
- print("sysinfo.ram=" .. sanitize(r))
- print("sysinfo.hostname=" .. sanitize(ffluci.sys.hostname()))
- print("sysinfo.load1=" .. tostring(l1))
- print("sysinfo.load5=" .. tostring(l5))
- print("sysinfo.load15=" .. tostring(l15))
- print("sysinfo.defaultgw=" .. dr)
-
-
- -- Freifunk
- local ff = uci:sections("freifunk") or {}
- for k, v in pairs(ff) do
- if k:sub(1, 1) ~= "." then
- for i, j in pairs(v) do
- print("freifunk." .. k .. "." .. i .. "=" .. j)
- end
- end
- end
-end
-
-function sanitize(val)
- return val:gsub("\n", "\t")
-end
\ No newline at end of file
--- /dev/null
+include ../../build/config.mk
+include ../../build/module.mk
\ No newline at end of file
--- /dev/null
+module("ffluci.controller.admin.index", package.seeall)
\ No newline at end of file
-contact = "Contact"
luci = "User Interface"
hello = "Hello!"
admin6 = "And now have fun with your router!"
team = "The FFLuCI Team"
-contact1 = [[This information will be available on the public contact page.
-As stated in the Picopeering Agreement you should at least enter your e-mail address.
-To display your router on any topography map, please enter your geographical coordinates or at least
-your street and house number in the location field.]]
-nickname = "Nickname"
-mail1 = "This field is essential!"
-phone = "Phone"
-location = "Location"
-coord = "Coordinates"
-coord1 = "Latitude;Longitude (e.g. 51.5;12.9)"
-note = "Note"
-
luci1 = "Here you can customize the settings and the functionality of FFLuCI."
language = "Language"
general = "General"
add("admin", "index", "Übersicht", 10)
-act("wizard", "Freifunkassistent")
-act("contact", "Kontakt")
act("luci", "Oberfläche")
-act("freifunk", "Freifunk")
add("admin", "system", "System", 30)
act("packages", "Paketverwaltung")
act("httpd", "HTTP-Server")
act("dropbear", "SSH-Server")
act("dnsmasq", "Dnsmasq")
-if isfile("/etc/config/luci_splash") then
- act("splash", "Client-Splash")
-end
add("admin", "network", "Netzwerk", 50)
act("vlan", "Switch")
act("dhcp", "DHCP-Server")
act("ptp", "PPPoE / PPTP")
act("routes", "Statische Routen")
-act("portfw", "Portweiterleitung")
-act("firewall", "Firewall")
if isfile("/etc/config/qos") then
act("qos", "Quality of Service")
end
--- /dev/null
+include ../../build/config.mk
+include ../../build/module.mk
\ No newline at end of file