aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2015-08-03 10:18:10 +0200
committerDaniel Golle <daniel@makrotopia.org>2015-08-03 15:51:22 +0200
commita9258527c398b607c73c048c236f56a5c65a32d7 (patch)
tree9abdbeb6477e4428bd75e1c4b893f0931c7c3dcb
parent4d23d296ac50654b66c5203e5328432d7557d549 (diff)
gnunet: update source, read config from UCI, add defaults
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-rw-r--r--net/gnunet/Makefile4
-rw-r--r--net/gnunet/files/gnunet.defaults40
-rw-r--r--net/gnunet/files/gnunet.init48
3 files changed, 66 insertions, 26 deletions
diff --git a/net/gnunet/Makefile b/net/gnunet/Makefile
index 9660a314f..898b8d394 100644
--- a/net/gnunet/Makefile
+++ b/net/gnunet/Makefile
@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gnunet
-PKG_SOURCE_VERSION:=36139
+PKG_SOURCE_VERSION:=36190
PKG_VERSION:=0.10.1-svn$(PKG_SOURCE_VERSION)
PKG_RELEASE:=1
@@ -167,6 +167,8 @@ define Package/gnunet/install
$(INSTALL_BIN) ./files/gnunet.init $(1)/etc/init.d/gnunet
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
$(INSTALL_DATA) ./files/gnunet.upgrade $(1)/lib/upgrade/keep.d/gnunet
+ $(INSTALL_DIR) $(1)/etc/uci-defaults
+ $(INSTALL_BIN) ./files/gnunet.defaults $(1)/etc/uci-defaults/gnunet
endef
define Build/InstallDev
diff --git a/net/gnunet/files/gnunet.defaults b/net/gnunet/files/gnunet.defaults
new file mode 100644
index 000000000..dbb505066
--- /dev/null
+++ b/net/gnunet/files/gnunet.defaults
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+[ -e /etc/config/gnunet ] && exit 0
+
+touch /etc/config/gnunet
+
+uci set gnunet.datastore=gnunet-config
+uci set gnunet.datastore.DATABASE=heap
+uci set gnunet.datastore.QUOTA="4 MB"
+
+uci set gnunet.fs=gnunet-config
+uci set gnunet.fs.CONTENT_PUSHING=NO
+uci set gnunet.fs.CONTENT_CACHING=NO
+
+# limit dhtcache memory usage to 4 MB
+uci set gnunet.dhtcache=gnunet-config
+uci set gnunet.dhtcache.QUOTA="4 MB"
+
+# enable dns2gns
+uci set gnunet.dns2gns=gnunet-config
+uci set gnunet.dns2gns.AUTOSTART=YES
+uci set gnunet.dns2gns.FORCESTART=YES
+
+# enable v4/v6 protocol translation for EXIT/VPN
+uci set gnunet.pt=gnunet-config
+uci set gnunet.pt.FORCESTART=YES
+
+uci set gnunet.exit=gnunet-config
+uci set gnunet.exit.AUTOSTART=YES
+uci set gnunet.exit.FORCESTART=YES
+uci set gnunet.exit.EXIT_IPV4=YES
+uci set gnunet.exit.EXIT_RANGE_IPV4_POLICY="169.254.86.1:7;169.254.86.1:5201;"
+
+# iperf (TCP) and echo (UDP) for battlemesh
+uci set gnunet.iperf=gnunet-exit-service
+uci set gnunet.iperf.TCP_REDIRECTS="5201:169.254.86.1:5201"
+uci set gnunet.echo=gnunet-exit-service
+uci set gnunet.echo.UDP_REDIRECTS="7:169.254.86.1:7"
+
+uci commit gnunet
diff --git a/net/gnunet/files/gnunet.init b/net/gnunet/files/gnunet.init
index 8b810d7b0..aa8742295 100644
--- a/net/gnunet/files/gnunet.init
+++ b/net/gnunet/files/gnunet.init
@@ -47,6 +47,8 @@ prepare_config() {
mkdir -p /etc/gnunet
chown gnunet:gnunet /etc/gnunet
}
+
+ # defaults paths
gnunet-config -c $CONFIGFILE -s PATHS -o GNUNET_CONFIG_HOME -V /etc/gnunet
gnunet-config -c $CONFIGFILE -s PEER -o PRIVATE_KEY -V /etc/gnunet/private_key.ecc
gnunet-config -c $CONFIGFILE -s identity -o EGODIR -V /etc/gnunet/identity/egos
@@ -54,19 +56,6 @@ prepare_config() {
gnunet-config -c $CONFIGFILE -s nse -o PROOFFILE -V /etc/gnunet/proof.dat
gnunet-config -c $CONFIGFILE -s namestore-sqlite -o FILENAME -V /etc/gnunet/namestore.sqlite
- # minimal datastore (todo: make this configurable)
- gnunet-config -c $CONFIGFILE -s datastore -o DATABASE -V heap
- gnunet-config -c $CONFIGFILE -s datastore -o QUOTA -V "4 MB"
- gnunet-config -c $CONFIGFILE -s fs -o CONTENT_PUSHING -V NO
- gnunet-config -c $CONFIGFILE -s fs -o CONTENT_CACHING -V NO
-
- # limit dhtcache memory usage to 4 MB
- gnunet-config -c $CONFIGFILE -s dhtcache -o QUOTA -V "4 MB"
-
- # enable dns2gns
- gnunet-config -c $CONFIGFILE -s dns2gns -o AUTOSTART -V YES
- gnunet-config -c $CONFIGFILE -s dns2gns -o FORCESTART -V YES
-
# enable all installed transport plugins
transport_plugins=$(gnunet-config -c $CONFIGFILE -s transport -o PLUGINS)
for transplug in /usr/lib/gnunet/libgnunet_plugin_transport_*.so; do
@@ -77,18 +66,27 @@ prepare_config() {
done
gnunet-config -c $CONFIGFILE -s transport -o PLUGINS -V "$transport_plugins"
- gnunet-config -c $CONFIGFILE -s pt -o FORCESTART -V YES
- gnunet-config -c $CONFIGFILE -s exit -o AUTOSTART -V YES
- gnunet-config -c $CONFIGFILE -s exit -o FORCESTART -V YES
- gnunet-config -c $CONFIGFILE -s exit -o EXIT_IPV4 -V YES
- # ssh and www services
-# gnunet-config -c $CONFIGFILE -s exit -o EXIT_RANGE_IPV4_POLICY -V "169.254.86.1:22;169.254.86.1:80;"
-# gnunet-config -c $CONFIGFILE -s ssh.gnunet. -o TCP_REDIRECTS -V "22:169.254.86.1:22"
-# gnunet-config -c $CONFIGFILE -s www.gnunet. -o TCP_REDIRECTS -V "80:169.254.86.1:80"
- # iperf (TCP) and echo (UDP) for battlemesh
- gnunet-config -c $CONFIGFILE -s exit -o EXIT_RANGE_IPV4_POLICY -V "169.254.86.1:7;169.254.86.1:5201;"
- gnunet-config -c $CONFIGFILE -s iperf.gnunet. -o TCP_REDIRECTS -V "5201:169.254.86.1:5201"
- gnunet-config -c $CONFIGFILE -s echo.gnunet. -o UDP_REDIRECTS -V "7:169.254.86.1:7"
+ # apply config from UCI
+ _gnunet_section=""
+ config_cb()
+ {
+ # $1 "Type"
+ # $2 "Name"
+ local __TYPE="$1"
+ local __NAME="$2"
+ [ "${__TYPE}" = "gnunet-config" ] && _gnunet_section="${__NAME}"
+ [ "${__TYPE}" = "gnunet-exit-service" ] && _gnunet_section="${__NAME}.gnunet."
+ }
+ option_cb() {
+ # $1 name of variable
+ # $2 value
+ local __OPT="$1"
+ local __VAL="$2"
+ gnunet-config -c $CONFIGFILE -s ${_gnunet_section} -o ${__OPT} -V "${__VAL}"
+ }
+ config_load gnunet
+
+ return 0
}
start_service() {