diff options
Diffstat (limited to 'net/gnunet/files/gnunet.init')
-rw-r--r-- | net/gnunet/files/gnunet.init | 53 |
1 files changed, 45 insertions, 8 deletions
diff --git a/net/gnunet/files/gnunet.init b/net/gnunet/files/gnunet.init index 3d9fc1875..8b810d7b0 100644 --- a/net/gnunet/files/gnunet.init +++ b/net/gnunet/files/gnunet.init @@ -32,18 +32,42 @@ fix_libexec_permissions() { } prepare_config() { - mkdir -p $GNUNET_HOME - chown gnunet:gnunet $GNUNET_HOME - chmod 0750 $GNUNET_HOME + if [ ! -e "$GNUNET_HOME" ]; then + mkdir -p $GNUNET_HOME + chown gnunet:gnunet $GNUNET_HOME + chmod 0750 $GNUNET_HOME + fi touch $CONFIGFILE chown root:gnunet $CONFIGFILE chmod 0640 $CONFIGFILE gnunet-config -c $CONFIGFILE -s PATHS -o GNUNET_HOME -V $GNUNET_HOME - # enable gns2dns service - defaultservices=$( gnunet-config -c /tmp/run/gnunet/gnunet.conf -s arm -o DEFAULTSERVICES ) - defaultservices="$defaultservices dns2gns" + + # minimal persistency in /etc/gnunet + [ ! -d /etc/gnunet ] && { + mkdir -p /etc/gnunet + chown gnunet:gnunet /etc/gnunet + } + 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 + gnunet-config -c $CONFIGFILE -s revocation -o DATABASE -V /etc/gnunet/revocation.dat + 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 - gnunet-config -c $CONFIGFILE -s arm -o DEFAULTSERVICES -V "$defaultservices" transport_plugins=$(gnunet-config -c $CONFIGFILE -s transport -o PLUGINS) for transplug in /usr/lib/gnunet/libgnunet_plugin_transport_*.so; do transplug=$( echo $transplug | @@ -52,11 +76,24 @@ prepare_config() { transport_plugins="$transport_plugins $transplug" 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" } start_service() { fix_libexec_permissions - [ ! -e $GNUNET_HOME ] && prepare_config + prepare_config procd_open_instance procd_set_param user gnunet |