summaryrefslogtreecommitdiffhomepage
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/package/ffluci-splash/Makefile43
-rw-r--r--contrib/package/ffluci-splash/ipkg/conffiles1
-rw-r--r--contrib/package/ffluci-splash/src/luci-splash.lua176
-rw-r--r--contrib/package/ffluci-splash/src/luci-splash/htdocs/cgi-bin/index.cgi52
-rw-r--r--contrib/package/ffluci-splash/src/luci-splash/htdocs/index.html10
-rw-r--r--contrib/package/ffluci-splash/src/luci_splash.cron2
-rw-r--r--contrib/package/ffluci-splash/src/luci_splash.init85
-rw-r--r--contrib/package/ffluci-splash/src/luci_splash.uci2
-rw-r--r--contrib/package/ffluci-splash/src/luci_splash_httpd.conf1
-rw-r--r--contrib/package/ffluci-system-addons/Makefile32
-rw-r--r--contrib/package/ffluci/Makefile232
-rw-r--r--contrib/package/ffluci/ipkg/conffiles2
-rwxr-xr-xcontrib/package/ffluci/ipkg/ffluci-community-leipzig.postinst4
-rwxr-xr-xcontrib/package/ffluci/ipkg/ffluci-sgi-haserl.postinst (renamed from contrib/package/ffluci/ipkg/ffluci.postinst)0
-rw-r--r--contrib/package/luci-addons/Makefile37
-rw-r--r--contrib/package/luci-addons/dist/etc/crontabs/root (renamed from contrib/package/ffluci-system-addons/src/root.crontab)0
-rw-r--r--contrib/package/luci-addons/dist/etc/hotplug.d/iface/20-aliases (renamed from contrib/package/ffluci-system-addons/src/hotplug.d-20-aliases)0
-rw-r--r--contrib/package/luci-addons/dist/sbin/ffluci-flash88
-rw-r--r--contrib/package/luci-addons/dist/usr/bin/run-parts (renamed from contrib/package/ffluci-system-addons/src/run-parts)0
19 files changed, 308 insertions, 459 deletions
diff --git a/contrib/package/ffluci-splash/Makefile b/contrib/package/ffluci-splash/Makefile
deleted file mode 100644
index 3ea123ffd6..0000000000
--- a/contrib/package/ffluci-splash/Makefile
+++ /dev/null
@@ -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))
diff --git a/contrib/package/ffluci-splash/ipkg/conffiles b/contrib/package/ffluci-splash/ipkg/conffiles
deleted file mode 100644
index dcbe1ad373..0000000000
--- a/contrib/package/ffluci-splash/ipkg/conffiles
+++ /dev/null
@@ -1 +0,0 @@
-/etc/config/luci_splash \ No newline at end of file
diff --git a/contrib/package/ffluci-splash/src/luci-splash.lua b/contrib/package/ffluci-splash/src/luci-splash.lua
deleted file mode 100644
index 2fa6bdd4a9..0000000000
--- a/contrib/package/ffluci-splash/src/luci-splash.lua
+++ /dev/null
@@ -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) \ No newline at end of file
diff --git a/contrib/package/ffluci-splash/src/luci-splash/htdocs/cgi-bin/index.cgi b/contrib/package/ffluci-splash/src/luci-splash/htdocs/cgi-bin/index.cgi
deleted file mode 100644
index 3bff85ee51..0000000000
--- a/contrib/package/ffluci-splash/src/luci-splash/htdocs/cgi-bin/index.cgi
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/haserl --shell=luac
-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")
-
-local srv
-local net
-local ip = ffluci.http.remote_addr()
-for k, v in pairs(ffluci.model.uci.sections("network")) do
- if v[".type"] == "interface" and v.ipaddr then
- local p = ffluci.sys.net.mask4prefix(v.netmask)
- if ffluci.sys.net.belongs(ip, v.ipaddr, p) then
- net = k
- srv = v.ipaddr
- break
- end
- end
-end
-
-local stat = false
-for k, v in pairs(ffluci.model.uci.sections("luci_splash")) do
- if v[".type"] == "iface" and v.network == net then
- stat = true
- end
-end
-
-if not srv then
- ffluci.http.textheader()
- return print("Unable to detect network settings!")
-end
-
-if not stat then
- ffluci.http.redirect("http://" .. srv)
-end
-
-local action = "splash"
-
-local mac = ffluci.sys.net.ip4mac(ip)
-if not mac then
- action = "unknown"
-end
-
-local status = ffluci.sys.execl("luci-splash status "..mac)[1]
-
-if status == "whitelisted" or status == "lease" then
- action = "allowed"
-end
-
-ffluci.http.redirect("http://" .. srv .. "/cgi-bin/luci-splash/" .. action) \ No newline at end of file
diff --git a/contrib/package/ffluci-splash/src/luci-splash/htdocs/index.html b/contrib/package/ffluci-splash/src/luci-splash/htdocs/index.html
deleted file mode 100644
index 58387a5fec..0000000000
--- a/contrib/package/ffluci-splash/src/luci-splash/htdocs/index.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="refresh" content="0; URL=/cgi-bin/index.cgi" />
-</head>
-<body style="background-color: black">
-<a style="color: white; text-decoration: none" href="/cgi-bin/index.cgi">FFLuCI - Freifunk Lua Configuration Interface</a>
-</body>
-</html> \ No newline at end of file
diff --git a/contrib/package/ffluci-splash/src/luci_splash.cron b/contrib/package/ffluci-splash/src/luci_splash.cron
deleted file mode 100644
index eae4294741..0000000000
--- a/contrib/package/ffluci-splash/src/luci_splash.cron
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-[ "$(date +%M | cut -c2)" == "5" ] && luci-splash sync \ No newline at end of file
diff --git a/contrib/package/ffluci-splash/src/luci_splash.init b/contrib/package/ffluci-splash/src/luci_splash.init
deleted file mode 100644
index 20f7865fd4..0000000000
--- a/contrib/package/ffluci-splash/src/luci_splash.init
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/bin/sh /etc/rc.common
-START=70
-
-iface_add() {
- local cfg="$1"
-
- config_get net "$cfg" network
- [ -n "$net" ] || return 0
-
- config_get iface "$net" ifname
- [ -n "$iface" ] || return 0
- iface="${iface%%:*}"
-
- config_get ipaddr "$net" ipaddr
- [ -n "$ipaddr" ] || return 0
-
- config_get netmask "$net" netmask
- [ -n "$netmask" ] || return 0
-
- eval "$(ipcalc.sh $ipaddr $netmask)"
-
- iptables -t nat -A luci_splash -i "$iface" -s "$NETWORK/$PREFIX" -j luci_splash_portal
- iptables -t nat -A luci_splash_portal -i "$iface" -s "$NETWORK/$PREFIX" -d "$ipaddr" -p tcp -m multiport --dports 22,80,443 -j RETURN
-}
-
-blacklist_add() {
- local cfg="$1"
-
- config_get mac "$cfg" mac
- [ -n "$mac" ] && iptables -t nat -A luci_splash_portal -m mac --mac-source "$mac" -j DROP
-}
-
-whitelist_add() {
- local cfg="$1"
-
- config_get mac "$cfg" mac
- [ -n "$mac" ] && iptables -t nat -A luci_splash_portal -m mac --mac-source "$mac" -j RETURN
-}
-
-start() {
- ### Read chains from config
- include /lib/network
- scan_interfaces
- config_load luci_splash
-
- ### Create subchains
- iptables -t nat -N luci_splash
- iptables -t nat -N luci_splash_portal
- iptables -t nat -N luci_splash_leases
-
- ### Build the main and portal rule
- config_foreach blacklist_add blacklist
- config_foreach whitelist_add whitelist
- config_foreach iface_add iface
-
- ### Build the portal rule
- iptables -t nat -A luci_splash_portal -p udp --dport 53 -j RETURN
- iptables -t nat -A luci_splash_portal -j luci_splash_leases
-
- ### Build the leases rule
- iptables -t nat -A luci_splash_leases -p tcp --dport 80 -j REDIRECT --to-ports 8082
- iptables -t nat -A luci_splash_leases -j DROP
-
- ### Start the splash httpd
- httpd -c /etc/luci_splash_httpd.conf -p 8082 -h /usr/lib/luci-splash/htdocs
-
- ### Hook in the chain
- iptables -t nat -A prerouting_rule -j luci_splash
-}
-
-stop() {
- ### Hook out the chain
- iptables -t nat -D prerouting_rule -j luci_splash
-
- ### Clear subchains
- iptables -t nat -F luci_splash_leases
- iptables -t nat -F luci_splash_portal
- iptables -t nat -F luci_splash
-
- ### Delete subchains
- iptables -t nat -X luci_splash_leases
- iptables -t nat -X luci_splash_portal
- iptables -t nat -X luci_splash
-}
-
diff --git a/contrib/package/ffluci-splash/src/luci_splash.uci b/contrib/package/ffluci-splash/src/luci_splash.uci
deleted file mode 100644
index c4cfef5dd9..0000000000
--- a/contrib/package/ffluci-splash/src/luci_splash.uci
+++ /dev/null
@@ -1,2 +0,0 @@
-config core general
- option leasetime 1 \ No newline at end of file
diff --git a/contrib/package/ffluci-splash/src/luci_splash_httpd.conf b/contrib/package/ffluci-splash/src/luci_splash_httpd.conf
deleted file mode 100644
index 6007e80dba..0000000000
--- a/contrib/package/ffluci-splash/src/luci_splash_httpd.conf
+++ /dev/null
@@ -1 +0,0 @@
-E404:index.html \ No newline at end of file
diff --git a/contrib/package/ffluci-system-addons/Makefile b/contrib/package/ffluci-system-addons/Makefile
deleted file mode 100644
index 622871fca9..0000000000
--- a/contrib/package/ffluci-system-addons/Makefile
+++ /dev/null
@@ -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))
diff --git a/contrib/package/ffluci/Makefile b/contrib/package/ffluci/Makefile
index 1b0f80e6b6..32d82b500b 100644
--- a/contrib/package/ffluci/Makefile
+++ b/contrib/package/ffluci/Makefile
@@ -1,79 +1,205 @@
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
diff --git a/contrib/package/ffluci/ipkg/conffiles b/contrib/package/ffluci/ipkg/conffiles
deleted file mode 100644
index 098dbf9042..0000000000
--- a/contrib/package/ffluci/ipkg/conffiles
+++ /dev/null
@@ -1,2 +0,0 @@
-/etc/config/luci
-/etc/config/luci_fw \ No newline at end of file
diff --git a/contrib/package/ffluci/ipkg/ffluci-community-leipzig.postinst b/contrib/package/ffluci/ipkg/ffluci-community-leipzig.postinst
new file mode 100755
index 0000000000..26eace97d9
--- /dev/null
+++ b/contrib/package/ffluci/ipkg/ffluci-community-leipzig.postinst
@@ -0,0 +1,4 @@
+#!/bin/sh
+[ -n "${IPKG_INSTROOT}" ] || {
+ ( . /etc/uci-defaults/ffluci-community-leipzig ) && rm -f /etc/uci-defaults/ffluci-community-leipzig
+}
diff --git a/contrib/package/ffluci/ipkg/ffluci.postinst b/contrib/package/ffluci/ipkg/ffluci-sgi-haserl.postinst
index b6703dc06e..b6703dc06e 100755
--- a/contrib/package/ffluci/ipkg/ffluci.postinst
+++ b/contrib/package/ffluci/ipkg/ffluci-sgi-haserl.postinst
diff --git a/contrib/package/luci-addons/Makefile b/contrib/package/luci-addons/Makefile
new file mode 100644
index 0000000000..04562257c2
--- /dev/null
+++ b/contrib/package/luci-addons/Makefile
@@ -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)) \ No newline at end of file
diff --git a/contrib/package/ffluci-system-addons/src/root.crontab b/contrib/package/luci-addons/dist/etc/crontabs/root
index 6e2e417dcb..6e2e417dcb 100644
--- a/contrib/package/ffluci-system-addons/src/root.crontab
+++ b/contrib/package/luci-addons/dist/etc/crontabs/root
diff --git a/contrib/package/ffluci-system-addons/src/hotplug.d-20-aliases b/contrib/package/luci-addons/dist/etc/hotplug.d/iface/20-aliases
index b9986e3aaa..b9986e3aaa 100644
--- a/contrib/package/ffluci-system-addons/src/hotplug.d-20-aliases
+++ b/contrib/package/luci-addons/dist/etc/hotplug.d/iface/20-aliases
diff --git a/contrib/package/luci-addons/dist/sbin/ffluci-flash b/contrib/package/luci-addons/dist/sbin/ffluci-flash
new file mode 100644
index 0000000000..3ff478f0f5
--- /dev/null
+++ b/contrib/package/luci-addons/dist/sbin/ffluci-flash
@@ -0,0 +1,88 @@
+#!/bin/sh
+. /etc/functions.sh
+
+# initialize defaults
+RAMFS_COPY_BIN="" # extra programs for temporary ramfs root
+RAMFS_COPY_DATA="" # extra data files
+export KEEP_PATTERN=""
+export VERBOSE=1
+
+# parse options
+while [ -n "$1" ]; do
+ case "$1" in
+ -k)
+ shift
+ export KEEP_PATTERN="$1"
+ ;;
+ -*)
+ echo "Invalid option: $1"
+ exit 1
+ ;;
+ *) break;;
+ esac
+ shift;
+done
+
+export CONFFILES=/tmp/sysupgrade.conffiles
+export CONF_TAR=/tmp/sysupgrade.tgz
+
+[ -f $CONFFILES ] && rm $CONFFILES
+[ -f $CONF_TAR ] && rm $CONF_TAR
+
+export ARGV="$*"
+export ARGC="$#"
+
+[ -z "$ARGV" ] && {
+ cat <<EOF
+Usage: $0 [options] <image file or URL>
+
+Options:
+ -k <"file 1, file 2, ..."> Files to be kept
+EOF
+ exit 1
+}
+
+add_pattern_conffiles() {
+ local file="$1"
+ find $KEEP_PATTERN >> "$file" 2>/dev/null
+ return 0
+}
+
+# hooks
+sysupgrade_image_check="platform_check_image"
+sysupgrade_init_conffiles=""
+
+[ -n "$KEEP_PATTERN" ] && append sysupgrade_init_conffiles "add_pattern_conffiles"
+
+include /lib/upgrade
+
+do_save_conffiles() {
+ [ -z "$(rootfs_type)" ] && {
+ echo "Cannot save config while running from ramdisk."
+ exit 3
+ return 0
+ }
+ run_hooks "$CONFFILES" $sysupgrade_init_conffiles
+
+ v "Saving config files..."
+ [ "$VERBOSE" -gt 1 ] && TAR_V="v" || TAR_V=""
+ tar c${TAR_V}zf "$CONF_TAR" -T "$CONFFILES" 2>/dev/null
+}
+
+type platform_check_image >/dev/null 2>/dev/null || {
+ echo "Firmware upgrade is not implemented for this platform."
+ exit 1
+}
+
+for check in $sysupgrade_image_check; do
+ ( eval "$check \"\$ARGV\"" ) || {
+ echo "Image check '$check' failed."
+ exit 2
+ }
+done
+
+[ -n "$sysupgrade_init_conffiles" ] && do_save_conffiles
+run_hooks "" $sysupgrade_pre_upgrade
+
+v "Switching to ramdisk..."
+run_ramfs '. /etc/functions.sh; include /lib/upgrade; do_upgrade' \ No newline at end of file
diff --git a/contrib/package/ffluci-system-addons/src/run-parts b/contrib/package/luci-addons/dist/usr/bin/run-parts
index 0f0cbbdf5f..0f0cbbdf5f 100644
--- a/contrib/package/ffluci-system-addons/src/run-parts
+++ b/contrib/package/luci-addons/dist/usr/bin/run-parts