aboutsummaryrefslogtreecommitdiff
path: root/security/i2p/files
diff options
context:
space:
mode:
authorMario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>2014-03-08 00:00:11 +0000
committerMario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>2014-03-08 00:00:11 +0000
commitb2ca7ee8a884a6135f5a739f6e3d7a5794747e05 (patch)
tree48e8fd4071804e892a55351ff5ab30290cf3a339 /security/i2p/files
parentb208c35c0d3f7d30a5ccace2d1e46cab7c9b5cf3 (diff)
Notes
Diffstat (limited to 'security/i2p/files')
-rw-r--r--security/i2p/files/i2p.in88
-rw-r--r--security/i2p/files/patch-installer__resources__clients.config11
-rw-r--r--security/i2p/files/patch-installer__resources__postinstall.sh11
-rw-r--r--security/i2p/files/wrapper.sh.in71
4 files changed, 181 insertions, 0 deletions
diff --git a/security/i2p/files/i2p.in b/security/i2p/files/i2p.in
new file mode 100644
index 000000000000..ffc192912fe7
--- /dev/null
+++ b/security/i2p/files/i2p.in
@@ -0,0 +1,88 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# Under a BSDL license. Copyright 2005. Mario S F Ferreira <lioux@FreeBSD.org>
+
+# PROVIDE: i2p
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable i2p:
+#
+# i2p_enable="YES"
+# i2p_user
+
+. /etc/rc.subr
+
+name="i2p"
+rcvar=i2p_enable
+command="%%PREFIX%%/sbin/i2prouter"
+extra_commands="install uninstall update"
+
+i2p_check_vars()
+{
+ if [ -z "${i2p_user}" ]; then
+ i2p_user=$(whoami)
+ fi
+
+ if [ "x${i2p_user}" = "xroot" ]; then
+ err 1 "You have to set i2p_user to a non-root user for security reasons"
+ fi
+}
+
+start_cmd="start_cmd"
+stop_cmd="stop_cmd"
+status_cmd="status_cmd"
+restart_cmd="restart_cmd"
+install_cmd="install_cmd"
+uninstall_cmd="uninstall_cmd"
+update_cmd="update_cmd"
+
+generic_cmd()
+{
+ i2p_check_vars
+ su -l ${i2p_user} -c "${command} ${1}"
+}
+
+start_cmd()
+{
+ generic_cmd start
+}
+
+stop_cmd()
+{
+ generic_cmd stop
+}
+
+status_cmd()
+{
+ generic_cmd status
+}
+
+restart_cmd()
+{
+ generic_cmd restart
+}
+
+install_cmd()
+{
+ generic_cmd install
+}
+
+uninstall_cmd()
+{
+ generic_cmd uninstall
+}
+
+update_cmd()
+{
+ generic_cmd update
+}
+
+load_rc_config "${name}"
+: ${i2p_enable="NO"}
+: ${i2p_user=""}
+
+run_rc_command "$1"
diff --git a/security/i2p/files/patch-installer__resources__clients.config b/security/i2p/files/patch-installer__resources__clients.config
new file mode 100644
index 000000000000..8f9b7b6ecbb3
--- /dev/null
+++ b/security/i2p/files/patch-installer__resources__clients.config
@@ -0,0 +1,11 @@
+--- installer/resources/clients.config.orig 2014-02-13 23:18:57.000000000 -0200
++++ installer/resources/clients.config 2014-02-13 23:19:16.000000000 -0200
+@@ -57,7 +57,7 @@
+ clientApp.4.name=Open Router Console in web browser at startup
+ clientApp.4.args=http://127.0.0.1:7657/
+ clientApp.4.delay=3
+-clientApp.4.startOnLoad=true
++clientApp.4.startOnLoad=false
+
+ # BOB bridge
+ clientApp.5.args=
diff --git a/security/i2p/files/patch-installer__resources__postinstall.sh b/security/i2p/files/patch-installer__resources__postinstall.sh
new file mode 100644
index 000000000000..7f3ed96b1528
--- /dev/null
+++ b/security/i2p/files/patch-installer__resources__postinstall.sh
@@ -0,0 +1,11 @@
+--- installer/resources/postinstall.sh.orig 2014-02-14 00:08:38.000000000 -0200
++++ installer/resources/postinstall.sh 2014-02-14 00:08:49.000000000 -0200
+@@ -72,7 +72,7 @@
+ wrapperpath="./lib/wrapper/freebsd64"
+ cp ${wrapperpath}/libwrapper.so ./lib/
+ # the 32bit libwrapper.so will be needed if a 32 bit jvm is used
+- cp ./lib/freebsd/libwrapper.so ./lib/libwrapper-freebsd-x86-32.so
++ cp ./lib/wrapper/freebsd/libwrapper.so ./lib/libwrapper-freebsd-x86-32.so
+ fi
+ ;;
+ osx )
diff --git a/security/i2p/files/wrapper.sh.in b/security/i2p/files/wrapper.sh.in
new file mode 100644
index 000000000000..e765ab2c0a56
--- /dev/null
+++ b/security/i2p/files/wrapper.sh.in
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+# Under a BSDL license. Copyright by Mario S F Ferreira <lioux@FreeBSD.org>
+# $FreeBSD$
+
+DATADIR="%%DATADIR%%"
+#
+I2P_HOME="${HOME}/i2p"
+I2P_RC_SCRIPT=i2prouter
+I2P_POSTINSTALL_SCRIPT=postinstall.sh
+#
+I2P_INSTALL_TARBALL=i2p.tar.bz2
+I2P_UPDATE_ZIP=i2pupdate.zip
+
+if [ -z "${HOME}" -o ! -d "${HOME}" ]; then
+ echo 'ERROR: Please, set HOME environment variable to a valid value!'
+ echo 'ERROR: You may LOSE data if the variable is pointed at an'
+ echo 'ERROR: incorrect location!'
+ exit 1
+fi
+
+case "$1" in
+ restart|start|status|stop)
+ echo "i2p ${1}"
+ if [ -f "${I2P_HOME}/${I2P_RC_SCRIPT}" ]; then
+ case "$1" in
+ restart|start)
+ echo 'To access i2p:'
+ echo 'Point your browser at http://localhost:7657/ to access configuration'
+ echo 'Point your browser proxy at http://localhost:4444/ to access i2p network'
+ ;;
+ esac
+ exec sh "${I2P_HOME}/${I2P_RC_SCRIPT}" ${1}
+ else
+ echo 'ERROR: i2p is not installed'
+ echo 'ERROR: Please install i2p first'
+ exit 2
+ fi
+ ;;
+ install)
+ echo "i2p ${1}"
+ if [ ! -d "${I2P_HOME}" ]; then
+ rm -Rf "${I2P_HOME}"
+ mkdir -p "${I2P_HOME}"
+ fi
+ cd "${HOME}" && \
+ tar -xvjf "${DATADIR}/${I2P_INSTALL_TARBALL}" && \
+ cd "${I2P_HOME}" && \
+ exec sh "${I2P_HOME}/${I2P_POSTINSTALL_SCRIPT}"
+ ;;
+ uninstall)
+ echo "i2p ${1}"
+ exec rm -Rf "${I2P_HOME}"
+ ;;
+ update)
+ echo "i2p ${1}"
+ if [ ! -d "${I2P_HOME}" ]; then
+ echo 'ERROR: i2p is not installed'
+ echo 'ERROR: Please install i2p before trying to update it'
+ exit 3
+ fi
+ cd "${I2P_HOME}" && \
+ exec unzip -o "${DATADIR}/${I2P_UPDATE_ZIP}"
+ ;;
+ *)
+ echo ""
+ echo "Usage: `basename $0` { start | stop | status | restart | install | uninstall | update }"
+ echo ""
+ exit 64
+ ;;
+esac