modules/freifunk: Move profiles and common files into seperate packages, this will enable us to build freifunk images without luci.
This commit is contained in:
parent
876b191b20
commit
c3a028c76c
44 changed files with 151 additions and 7 deletions
39
contrib/package/community-profiles/Makefile
Normal file
39
contrib/package/community-profiles/Makefile
Normal file
|
@ -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))
|
43
contrib/package/freifunk-common/Makefile
Normal file
43
contrib/package/freifunk-common/Makefile
Normal file
|
@ -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))
|
10
contrib/package/freifunk-common/files/usr/bin/ffdzero
Executable file
10
contrib/package/freifunk-common/files/usr/bin/ffdzero
Executable file
|
@ -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
|
3
contrib/package/freifunk-common/files/usr/bin/neigh.sh
Executable file
3
contrib/package/freifunk-common/files/usr/bin/neigh.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
wget -q -O - http://localhost:2006/neighbours|sed -e's/LinkQuality/LQ/;s/Hysteresis/Hyst./;s/Willingness/Will./'
|
29
contrib/package/freifunk-common/files/usr/sbin/ff_olsr_watchdog
Executable file
29
contrib/package/freifunk-common/files/usr/sbin/ff_olsr_watchdog
Executable file
|
@ -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
|
20
contrib/package/freifunk-common/files/usr/sbin/ff_rdate
Executable file
20
contrib/package/freifunk-common/files/usr/sbin/ff_rdate
Executable file
|
@ -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
|
6
contrib/package/freifunk-common/ipkg/postinst
Executable file
6
contrib/package/freifunk-common/ipkg/postinst
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
[ -n "${IPKG_INSTROOT}" ] || {
|
||||
/etc/init.d/freifunk enabled || /etc/init.d/freifunk enable
|
||||
exit 0
|
||||
}
|
|
@ -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))
|
||||
|
||||
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
uci set uhttpd.main.rfc1918_filter=0
|
||||
uci commit uhttpd
|
Loading…
Reference in a new issue