modules/freifunk: Move profiles and common files into seperate packages, this will...
authorManuel Munz <redacted>
Wed, 28 Sep 2011 00:20:56 +0000 (00:20 +0000)
committerManuel Munz <redacted>
Wed, 28 Sep 2011 00:20:56 +0000 (00:20 +0000)
44 files changed:
contrib/package/community-profiles/Makefile [new file with mode: 0644]
contrib/package/community-profiles/files/etc/config/profile_Freifunk [moved from modules/freifunk/root/etc/config/profile_Freifunk with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_aachen [moved from modules/freifunk/root/etc/config/profile_aachen with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_augsburg [moved from modules/freifunk/root/etc/config/profile_augsburg with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_bayreuth [moved from modules/freifunk/root/etc/config/profile_bayreuth with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_bensheim [moved from modules/freifunk/root/etc/config/profile_bensheim with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_bergischesland [moved from modules/freifunk/root/etc/config/profile_bergischesland with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_berlin [moved from modules/freifunk/root/etc/config/profile_berlin with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_carbodebit [moved from modules/freifunk/root/etc/config/profile_carbodebit with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_dresden [moved from modules/freifunk/root/etc/config/profile_dresden with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_duesseldorf [moved from modules/freifunk/root/etc/config/profile_duesseldorf with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_evernet [moved from modules/freifunk/root/etc/config/profile_evernet with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_gadow [moved from modules/freifunk/root/etc/config/profile_gadow with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_guifibages [moved from modules/freifunk/root/etc/config/profile_guifibages with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_halle [moved from modules/freifunk/root/etc/config/profile_halle with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_hamburg [moved from modules/freifunk/root/etc/config/profile_hamburg with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_hannover [moved from modules/freifunk/root/etc/config/profile_hannover with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_heppenheim [moved from modules/freifunk/root/etc/config/profile_heppenheim with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_jena [moved from modules/freifunk/root/etc/config/profile_jena with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_kiberpipa [moved from modules/freifunk/root/etc/config/profile_kiberpipa with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_l59 [moved from modules/freifunk/root/etc/config/profile_l59 with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_leipzig [moved from modules/freifunk/root/etc/config/profile_leipzig with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_mainz [moved from modules/freifunk/root/etc/config/profile_mainz with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_marburg [moved from modules/freifunk/root/etc/config/profile_marburg with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_neuss [moved from modules/freifunk/root/etc/config/profile_neuss with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_oldenburg [moved from modules/freifunk/root/etc/config/profile_oldenburg with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_openwireless_bern [moved from modules/freifunk/root/etc/config/profile_openwireless_bern with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_pberg [moved from modules/freifunk/root/etc/config/profile_pberg with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_piraten_dresden [moved from modules/freifunk/root/etc/config/profile_piraten_dresden with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_potsdam [moved from modules/freifunk/root/etc/config/profile_potsdam with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_rosbach [moved from modules/freifunk/root/etc/config/profile_rosbach with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_seefeld [moved from modules/freifunk/root/etc/config/profile_seefeld with 100% similarity]
contrib/package/community-profiles/files/etc/config/profile_wlanljubljana [moved from modules/freifunk/root/etc/config/profile_wlanljubljana with 100% similarity]
contrib/package/freifunk-common/Makefile [new file with mode: 0644]
contrib/package/freifunk-common/files/etc/config/freifunk [moved from modules/freifunk/root/etc/config/freifunk with 100% similarity]
contrib/package/freifunk-common/files/etc/init.d/freifunk [moved from modules/freifunk/root/etc/init.d/freifunk with 100% similarity]
contrib/package/freifunk-common/files/etc/rc.local.d/01-config-migration [moved from modules/freifunk/root/etc/rc.local.d/01-config-migration with 100% similarity]
contrib/package/freifunk-common/files/usr/bin/ffdzero [new file with mode: 0755]
contrib/package/freifunk-common/files/usr/bin/neigh.sh [new file with mode: 0755]
contrib/package/freifunk-common/files/usr/sbin/ff_olsr_watchdog [new file with mode: 0755]
contrib/package/freifunk-common/files/usr/sbin/ff_rdate [new file with mode: 0755]
contrib/package/freifunk-common/ipkg/postinst [new file with mode: 0755]
contrib/package/luci/Makefile
modules/freifunk/root/etc/uci-defaults/freifunk [deleted file]

diff --git a/contrib/package/community-profiles/Makefile b/contrib/package/community-profiles/Makefile
new file mode 100644 (file)
index 0000000..439b683
--- /dev/null
@@ -0,0 +1,39 @@
+# Copyright (C) 2011 Manuel Munz <freifunk at somakoma de>
+# This is free software, licensed under the Apache 2.0 license.
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=community-profiles
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/community-profiles
+  SECTION:=luci
+  CATEGORY:=LuCI
+  SUBMENU:=Freifunk
+  TITLE:=Community profiles
+  DEPENDS:=freifunk-common
+endef
+
+define Package/community-profiles/description
+  These community profiles set defaults for various free network/freifunk communities and are used by wizards like ffwizard and meshwizard.
+endef
+
+define Build/Prepare
+       mkdir -p $(PKG_BUILD_DIR)
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+define Package/community-profiles/install
+       $(CP) ./files/* $(1)/
+endef
+
+$(eval $(call BuildPackage,community-profiles))
diff --git a/contrib/package/freifunk-common/Makefile b/contrib/package/freifunk-common/Makefile
new file mode 100644 (file)
index 0000000..9c05ed4
--- /dev/null
@@ -0,0 +1,43 @@
+# Copyright (C) 2011 Manuel Munz <freifunk at somakoma de>
+# This is free software, licensed under the Apache 2.0 license.
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=freifunk-common
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/freifunk-common
+  SECTION:=luci
+  CATEGORY:=LuCI
+  SUBMENU:=Freifunk
+  TITLE:=Freifunk common files
+  DEPENDS:=freifunk-common
+endef
+
+define Package/freifunk-common/description
+  Common files and scripts that are needed to run free wireless mesh networks.
+endef
+
+define Package/luci-mod-freifunk/conffiles
+/etc/config/freifunk
+endef
+
+define Build/Prepare
+       mkdir -p $(PKG_BUILD_DIR)
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+define Package/freifunk-common/install
+       $(CP) ./files/* $(1)/
+endef
+
+$(eval $(call BuildPackage,freifunk-common))
diff --git a/contrib/package/freifunk-common/files/usr/bin/ffdzero b/contrib/package/freifunk-common/files/usr/bin/ffdzero
new file mode 100755 (executable)
index 0000000..24e8c2e
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+test "$1" = "-h" && echo -e "Usage:\n\t$0 -h\n\t$0 [ { ip | hostname } ]" >&2 && exit 1
+
+host="${1:-leipzig.freifunk.net}"
+
+wget -O /dev/null http://$host/cgi-bin-dev-zero.bin
+test "$?" = "1" && wget -O /dev/null http://$host/cgi-bin/dev-zero.bin
+test "$?" = "1" && wget -O /dev/null http://$host/cgi-bin/luci/freifunk/status/zeroes
+test "$?" = "1" && echo "$host: no zero download found..." && exit 1
diff --git a/contrib/package/freifunk-common/files/usr/bin/neigh.sh b/contrib/package/freifunk-common/files/usr/bin/neigh.sh
new file mode 100755 (executable)
index 0000000..723b813
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+wget -q -O - http://localhost:2006/neighbours|sed -e's/LinkQuality/LQ/;s/Hysteresis/Hyst./;s/Willingness/Will./'
diff --git a/contrib/package/freifunk-common/files/usr/sbin/ff_olsr_watchdog b/contrib/package/freifunk-common/files/usr/sbin/ff_olsr_watchdog
new file mode 100755 (executable)
index 0000000..aa8de61
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/lua
+
+require "os"
+require "io"
+require "uci"
+local fs = require "nixio.fs"
+
+if fs.access("/var/run/olsrd.pid") then
+       local stamp, intv
+       local x = uci.cursor()
+
+       x:foreach("olsrd", "LoadPlugin",
+               function(s)
+                       if s.library == "olsrd_watchdog.so.0.1" then
+                               intv  = tonumber(s.interval)
+                               stamp = s.file
+                       end
+               end)
+
+       if intv and fs.access(stamp) then
+               local systime = os.time()
+               local wdgtime = tonumber(io.lines(stamp)())
+
+               if not wdgtime or ( systime - wdgtime ) > ( intv * 2 ) then
+                       os.execute("logger -t 'OLSR watchdog' 'Process died - restarting!'")
+                       os.execute("/etc/init.d/olsrd restart")
+               end
+       end
+end
diff --git a/contrib/package/freifunk-common/files/usr/sbin/ff_rdate b/contrib/package/freifunk-common/files/usr/sbin/ff_rdate
new file mode 100755 (executable)
index 0000000..dc2c7b2
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+uci_get_one() {
+       for var in "$@"; do
+               uci -P /var/state get "$var" 2>/dev/null && break
+       done
+}
+
+local servers="$(uci_get_one 'network.wan.lease_timesrv') $(uci show timeserver | sed -ne 's/.*hostname=//p')"
+
+if [ -n "$servers" ]; then
+       for server in $servers; do
+               rdate -s $server >/dev/null 2>/dev/null && \
+                       logger -t rdate "Synced with $server" && break
+
+               logger -t rdate "Failed to sync with $server"
+       done
+else
+       logger -t rdate "No usable time server found"
+fi
diff --git a/contrib/package/freifunk-common/ipkg/postinst b/contrib/package/freifunk-common/ipkg/postinst
new file mode 100755 (executable)
index 0000000..52bedb2
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+[ -n "${IPKG_INSTROOT}" ] || {
+       /etc/init.d/freifunk enabled || /etc/init.d/freifunk enable
+       exit 0
+}
index 5595db8f90bb81133ba7a879f7f471877d6a9a8b..8226124ac8bb4c61f6d552a3fa56a0a3ca50f05f 100644 (file)
@@ -246,15 +246,11 @@ define Package/luci-mod-admin-core/extra-install
        touch $(1)/etc/init.d/luci_fixtime || true
 endef
 
-define Package/luci-mod-freifunk/conffiles
-/etc/config/freifunk
-endef
-
 $(eval $(call module,admin-core,Web UI Core module,+luci-lib-web +luci-i18n-english))
 $(eval $(call module,admin-mini,LuCI Essentials - stripped down and user-friendly,+luci-mod-admin-core @BROKEN))
 $(eval $(call module,admin-full,LuCI Administration - full-featured for full control,+luci-mod-admin-core +luci-lib-ipkg))
 $(eval $(call module,rpc,LuCI RPC - JSON-RPC API,+luci-lib-json))
-$(eval $(call module,freifunk,LuCI Freifunk module,+luci-mod-admin-full +luci-lib-json +PACKAGE_luci-mod-freifunk:freifunk-firewall))
+$(eval $(call module,freifunk,LuCI Freifunk module,+luci-mod-admin-full +luci-lib-json +PACKAGE_luci-mod-freifunk:freifunk-firewall +freifunk-common +community-profiles))
 $(eval $(call module,niu,NIU - Next Generation Interface,+luci-mod-admin-core @BROKEN))
 
 
diff --git a/modules/freifunk/root/etc/uci-defaults/freifunk b/modules/freifunk/root/etc/uci-defaults/freifunk
deleted file mode 100644 (file)
index fe6586c..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-uci set uhttpd.main.rfc1918_filter=0
-uci commit uhttpd
git clone https://git.99rst.org/PROJECT