summaryrefslogtreecommitdiffstats
path: root/net-p2p/freenet05/files/freenet.sh
diff options
context:
space:
mode:
Diffstat (limited to 'net-p2p/freenet05/files/freenet.sh')
-rw-r--r--net-p2p/freenet05/files/freenet.sh67
1 files changed, 67 insertions, 0 deletions
diff --git a/net-p2p/freenet05/files/freenet.sh b/net-p2p/freenet05/files/freenet.sh
new file mode 100644
index 0000000..50c1e47
--- /dev/null
+++ b/net-p2p/freenet05/files/freenet.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# Under a BSDL license. Copyright 2005. Mario S F Ferreira <lioux@FreeBSD.org>
+
+# PROVIDE: freenet
+# REQUIRE: NETWORKING
+# KEYWORD: FreeBSD shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable freenet:
+#
+#freenet_enable="YES"
+#freenet_user=""
+#
+
+. /etc/rc.subr
+
+name="freenet"
+rcvar=`set_rcvar`
+command="%%PREFIX%%/bin/${name}"
+extra_commands="configure"
+
+freenet_check_vars()
+{
+ if [ -z "${freenet_user}" ]; then
+ freenet_user=$(whoami)
+ fi
+
+ if [ "x${freenet_user}" = "xroot" ]; then
+ err 1 "You have to set freenet_user to a non-root user for security reasons"
+ fi
+}
+
+configure_cmd="configure_cmd"
+configure_cmd()
+{
+ freenet_check_vars
+ su -l ${freenet_user} -c "${command} -c"
+}
+
+start_cmd="start_cmd"
+start_cmd()
+{
+ freenet_check_vars
+ su -l ${freenet_user} -c "${command} -i"
+}
+
+stop_cmd="stop_cmd"
+stop_cmd()
+{
+ freenet_check_vars
+ su -l ${freenet_user} -c "${command} -o"
+}
+
+status_cmd="status_cmd"
+status_cmd()
+{
+ echo "Can't check ${name} status"
+}
+
+load_rc_config "${name}"
+: ${freenet_enable="NO"}
+: ${freenet_user=""}
+
+run_rc_command "$1"
OpenPOWER on IntegriCloud