summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Low <lostlogic@gentoo.org>2003-08-01 15:20:27 +0000
committerBrandon Low <lostlogic@gentoo.org>2003-08-01 15:20:27 +0000
commit6a32101321b052262759f61a49b570aa2a954768 (patch)
treef686595f47c16b83452f37736fc9798f126f9256 /net-p2p/freenet/files
parentAdd better logging / debugging support to the init script (diff)
downloadgentoo-2-6a32101321b052262759f61a49b570aa2a954768.tar.gz
gentoo-2-6a32101321b052262759f61a49b570aa2a954768.tar.bz2
gentoo-2-6a32101321b052262759f61a49b570aa2a954768.zip
Add better logging / debugging support to the init script
Diffstat (limited to 'net-p2p/freenet/files')
-rw-r--r--net-p2p/freenet/files/digest-freenet-0.5.2.1-r41
-rw-r--r--net-p2p/freenet/files/rc.freenet378
-rw-r--r--net-p2p/freenet/files/start-freenet.sh9
3 files changed, 88 insertions, 0 deletions
diff --git a/net-p2p/freenet/files/digest-freenet-0.5.2.1-r4 b/net-p2p/freenet/files/digest-freenet-0.5.2.1-r4
new file mode 100644
index 000000000000..a9b4651be0e9
--- /dev/null
+++ b/net-p2p/freenet/files/digest-freenet-0.5.2.1-r4
@@ -0,0 +1 @@
+MD5 59270ee48d889e0be9cae584b67d2743 freenet-0.5.2.1.tar.gz 2118774
diff --git a/net-p2p/freenet/files/rc.freenet3 b/net-p2p/freenet/files/rc.freenet3
new file mode 100644
index 000000000000..66e557100fde
--- /dev/null
+++ b/net-p2p/freenet/files/rc.freenet3
@@ -0,0 +1,78 @@
+#!/sbin/runscript
+# Gentoo freenet init.d-script
+#
+# This script requires the companion script start-freenet.sh to do it's
+# job. This script is needed to facilitate full logging of freenet.
+#
+# Also requires the /etc/conf.d/freenet file to be configured correctly.
+#
+# Gentoo Maintainer: Brandon Low <lostlogic@gentoo.org>
+# Authors: Per Wigren <wigren@home.se>
+# Brandon Low <lostlogic@gentoo.org>
+#
+
+depend() {
+ need net
+}
+
+check_config() {
+ if [ -z "${FREENET_NICENESS}" ] || [ -z "${JAVA_OPTIONS}" ]; then
+ eerror "Please set all options in /etc/conf.d/freenet"
+ return 1
+ fi
+ if [ ! -f /etc/freenet.conf ]; then
+ eerror "To configure freenet, please run:"
+ eerror "# ebuild /usr/portage/net-p2p/freenet/freenet-[version].ebuild"
+ return 1
+ fi
+ return 0
+}
+
+start() {
+ JAVA="$(java-config --java)"
+ #The JVMs don't support NPTL yet, so this is necessary
+ export LD_ASSUME_KERNEL=2.4.1
+
+ check_config || return 1
+
+ ebegin "Starting Freenet now"
+ if [ ! -f /usr/lib/freenet/freenet-ext.jar ]; then
+ ewarn "freenet-ext.jar not found. It can be downloaded from"
+ ewarn "http://freenetproject.org/snapshots/freenet-ext.jar"
+ eend 1
+ return 1
+ fi
+ if [ ! -f /var/freenet/seednodes.ref ]; then
+ ewarn "seednodes.ref not found, you can download some seeds"
+ ewarn "from http://hawk.freenetproject.org/~freenet4/seednodes.ref"
+ eend 1
+ return 1
+ fi
+
+ CLASSPATH=/usr/lib/freenet/freenet.jar:/usr/lib/freenet/freenet-ext.jar:$CLASSPATH
+
+ # if Sun JDK set -server option as suggested on mailing list
+ if [ ! -z "`${JAVA} -help 2>&1 | grep '[-]server'`" ]; then
+ JAVA_ARGS="-server"
+ else
+ JAVA_ARGS=""
+ fi
+ JAVA_ARGS="${JAVA_ARGS} ${JAVA_OPTIONS}"
+ ulimit -n 4096
+ # Had to change off of using start-stop-daemon to start it,
+ # because of suckage. This allows us to log the stdout and
+ # stderr of freenet.
+ export JAVA JAVA_ARGS CLASSPATH
+ echo "XXXXXX" > /var/freenet/freenet.pid
+ nice -n ${FREENET_NICENESS} su freenet -- /usr/bin/start-freenet.sh \
+ > /var/freenet/freenet.pid
+ sleep 1
+ ps ax|grep "^ *$(cat /var/freenet/freenet.pid)" > /dev/null
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping Freenet"
+ start-stop-daemon --stop --quiet --pidfile /var/freenet/freenet.pid
+ eend $?
+}
diff --git a/net-p2p/freenet/files/start-freenet.sh b/net-p2p/freenet/files/start-freenet.sh
new file mode 100644
index 000000000000..47960415b723
--- /dev/null
+++ b/net-p2p/freenet/files/start-freenet.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+# This script is a companion script to the Gentoo freenet init script.
+# Logs freenet's stdout and stderr for debugging needs.
+#
+# Author: Brandon Low <lostlogic@gentoo.org>
+#
+${JAVA} ${JAVA_ARGS} freenet.node.Main -p /etc/freenet.conf \
+ > /var/freenet/freenet.stdout.log 2> /var/freenet/freenet.stderr.log &
+echo $!