File freenet.sh of Package freenet

#!/bin/sh

# (C) 2013 Peter Conrad <conrad@quisquis.de>
#
# This file is licensed under the terms of the
# GNU General Public License Version 2 or later. A copy of these terms should
# be enclosed as "LICENSE" in the package containing this file.

if [ "$#" = 0 ]; then
    exec env LD_PRELOAD=libgmp.so.10 java -cp "`build-classpath JARS bcprov freenet`" $FREENET_JAVA_OPTS freenet.node.Node
fi
if [ "$1" = "-shutdown" ]; then
    ( echo ClientHello
      echo Name=test
      echo ExpectedVersion=2.0
      echo EndMessage
      sleep 1
      echo Shutdown
      echo EndMessage
      sleep 1
      echo Disconnect
      echo EndMessage
    ) | nc localhost `grep fcp.port freenet.ini | cut -d= -f 2`
else
    echo 1>&2 "Usage: $0 [-shutdown]"
    echo 1>&2 "Starts a freenet node in the current directory"
    exit 1
fi