summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorskydrome2015-06-01 10:33:14 -0400
committerskydrome2015-06-01 10:33:14 -0400
commit4f80e83d25b3956f7d87e74f7fe053e6f4ade1a0 (patch)
tree01c7b0f1e7ce64a2fa9c0b939d2c8dce7763a0b3
downloadaur-4f80e83d25b3956f7d87e74f7fe053e6f4ade1a0.tar.gz
Initial commit
-rw-r--r--.SRCINFO31
-rwxr-xr-xPKGBUILD79
-rwxr-xr-xi2p.install22
-rwxr-xr-xi2prouter.service20
-rwxr-xr-xi2prouter.sh192
-rwxr-xr-xrouter.config9
-rwxr-xr-xwrapper.config162
7 files changed, 515 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..dbf03309a0c9
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,31 @@
+pkgbase = i2p-bin
+ pkgdesc = A distributed anonymous network (pre-compiled binary)
+ pkgver = 0.9.19
+ pkgrel = 1
+ url = http://www.i2p2.de
+ install = i2p.install
+ arch = any
+ license = GPL2
+ depends = java-runtime
+ depends = java-service-wrapper
+ optdepends = robert: I2P BitTorrent client
+ provides = i2p
+ conflicts = i2p
+ conflicts = i2p-dev
+ noextract = i2pinstall_0.9.19.jar
+ backup = opt/i2p/wrapper.config
+ source = https://launchpad.net/i2p/trunk/0.9.19/+download/i2pinstall_0.9.19.jar
+ source = https://launchpad.net/i2p/trunk/0.9.19/+download/i2pinstall_0.9.19.jar.sig
+ source = i2prouter.service
+ source = i2prouter.sh
+ source = wrapper.config
+ source = router.config
+ sha256sums = d16f68fff3a34d161843a09e90fff1ac5eae8ccb319a43257244ec0e764a11c1
+ sha256sums = SKIP
+ sha256sums = 842b529ae23bc82fd78e986dd7cc683bd7b671e93421de57f279dc3f4d5d0fd2
+ sha256sums = ea8f97e66461d591b1819eab39bbc40056b89ae12f7729b3dd9fd2ce088e5e53
+ sha256sums = a76e7b6ccd8f49b51d22012887e1f0101db3bfe6aeebe1bc416b48da4e206b27
+ sha256sums = c001f045e52ab82154b21125384dbc4f1d2437376fc65c5d83987051e42b5409
+
+pkgname = i2p-bin
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100755
index 000000000000..975d4c5634c0
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,79 @@
+# Maintainer: skydrome <skydrome@i2pmail.org>
+# Contributor: skydrome <skydrome@i2pmail.org>
+
+########[ OPTIONS ]########################################
+# Download sources from within i2p
+#_i2p_fetch=1
+###########################################################
+
+pkgname=i2p-bin
+pkgver=0.9.19
+pkgrel=1
+pkgdesc="A distributed anonymous network (pre-compiled binary)"
+url="http://www.i2p2.de"
+license=('GPL2')
+arch=('any')
+depends=('java-runtime' 'java-service-wrapper')
+optdepends=('robert: I2P BitTorrent client') #'gtk2: for rrd graphs'
+conflicts=('i2p' 'i2p-dev')
+provides=('i2p')
+backup=('opt/i2p/wrapper.config')
+install='i2p.install'
+noextract=("i2pinstall_${pkgver}.jar")
+
+#_url="https://googledrive.com/host/0B4jHEq5G7_EPWV9UeERwdGplZXc/${pkgver}"
+_url="https://launchpad.net/i2p/trunk/${pkgver}/+download"
+
+source=("${_url}/i2pinstall_${pkgver}.jar"
+ "${_url}/i2pinstall_${pkgver}.jar.sig"
+ 'i2prouter.service' 'i2prouter.sh' 'wrapper.config' 'router.config')
+
+[[ $_i2p_fetch ]] && {
+ export http_proxy=127.0.0.1:4444
+ source=("http://echelon.i2p/${pkgver}/i2pinstall_${pkgver}.jar"
+ "http://echelon.i2p/${pkgver}/i2pinstall_${pkgver}.jar.sig"
+ 'i2prouter.service' 'i2prouter.sh' 'wrapper.config' 'router.config')
+}
+
+sha256sums=('d16f68fff3a34d161843a09e90fff1ac5eae8ccb319a43257244ec0e764a11c1'
+ 'SKIP'
+ '842b529ae23bc82fd78e986dd7cc683bd7b671e93421de57f279dc3f4d5d0fd2'
+ 'ea8f97e66461d591b1819eab39bbc40056b89ae12f7729b3dd9fd2ce088e5e53'
+ 'a76e7b6ccd8f49b51d22012887e1f0101db3bfe6aeebe1bc416b48da4e206b27'
+ 'c001f045e52ab82154b21125384dbc4f1d2437376fc65c5d83987051e42b5409')
+
+# https://geti2p.net/en/get-involved/develop/release-signing-key
+validpgpkeys=('2D3D2D03910C6504C1210C65EE60C0C8EE7256A8')
+
+package() {
+ cd "$srcdir"
+ source /etc/profile.d/jre.sh
+
+ echo "INSTALL_PATH=${pkgdir}/opt/i2p" >install.properties
+ java -jar i2pinstall_${pkgver}.jar -options install.properties
+
+ install -dm755 "$pkgdir/usr/lib/tmpfiles.d"
+ install -dm755 "$pkgdir/usr/bin"
+ install -dm755 "$pkgdir/opt/i2p"
+
+ install -Dm644 "$srcdir/router.config" "$pkgdir/opt/i2p/router.config"
+ install -Dm755 "$srcdir/i2prouter.sh" "$pkgdir/opt/i2p/i2prouter"
+ install -Dm644 "$srcdir/i2prouter.service" "$pkgdir/usr/lib/systemd/system/i2prouter.service"
+ install -Dm644 "$pkgdir/opt/i2p/man/eepget.1" "$pkgdir/usr/share/man/man1/eepget.1"
+ install -Dm644 "$pkgdir/opt/i2p/LICENSE.txt" "$pkgdir/usr/share/licenses/i2p/LICENSE"
+ cp "$srcdir/wrapper.config" "$pkgdir/opt/i2p"
+ mv "$pkgdir"/opt/i2p/licenses/* "$pkgdir/usr/share/licenses/i2p/"
+
+ ln -s /opt/i2p/{eepget,i2prouter} "$pkgdir/usr/bin/"
+ chmod 755 "$pkgdir/opt/i2p"
+ chmod -x "$pkgdir"/opt/i2p/*.config
+
+ echo 'd /run/i2p 0700 i2p i2p -' >"$pkgdir/usr/lib/tmpfiles.d/i2prouter.conf"
+
+ sed -i "$pkgdir"/opt/i2p/eepget \
+ -e "s:$pkgdir/opt/i2p:/opt/i2p:g"
+ sed -i "$pkgdir"/opt/i2p/clients.config \
+ -e "s:clientApp.4.startOnLoad=.*:clientApp.4.startOnLoad=false:"
+ rm -r "$pkgdir"/opt/i2p/{Uninstaller,.installationinformation,INSTALL-headless.txt,LICENSE.txt,runplain.sh,licenses,man,i2psvc,lib/*wrapper*,scripts/home.i2p.i2prouter}
+
+}
diff --git a/i2p.install b/i2p.install
new file mode 100755
index 000000000000..e375465ba0bb
--- /dev/null
+++ b/i2p.install
@@ -0,0 +1,22 @@
+post_install() {
+ getent passwd i2p &>/dev/null || {
+ echo -n ">>> Creating i2p user... "
+ useradd --system --user-group --home /opt/i2p i2p
+ echo "done"
+ }
+ systemd-tmpfiles --create i2prouter.conf
+ chown -R i2p:i2p /opt/i2p
+}
+
+post_upgrade() {
+ systemd-tmpfiles --create i2prouter.conf
+ chown -R i2p:i2p /opt/i2p
+}
+
+pre_remove() {
+ getent passwd i2p &>/dev/null && {
+ echo -n ">>> Removing i2p user... "
+ userdel i2p
+ echo "done"
+ }
+}
diff --git a/i2prouter.service b/i2prouter.service
new file mode 100755
index 000000000000..ce1da03bc441
--- /dev/null
+++ b/i2prouter.service
@@ -0,0 +1,20 @@
+[Unit]
+Description=Invisible Internet Project
+After=network.target
+RequiresOverridable=tlsdate.service ntpd.service
+
+[Service]
+Type=forking
+User=i2p
+PIDFile=/run/i2p/i2p.pid
+Environment=WRAPPER_CONF=/opt/i2p/wrapper.config
+ExecStart=/usr/bin/java-service-wrapper ${WRAPPER_CONF} \
+ wrapper.name=i2prouter wrapper.syslog.ident=i2prouter \
+ wrapper.daemonize=TRUE
+SendSIGKILL=no
+ExecReload=/bin/kill -USR1 $MAINPID
+ExecStop=/bin/kill -TERM $MAINPID
+SuccessExitStatus=0 2 3
+
+[Install]
+WantedBy=multi-user.target
diff --git a/i2prouter.sh b/i2prouter.sh
new file mode 100755
index 000000000000..1af0a35b4cbb
--- /dev/null
+++ b/i2prouter.sh
@@ -0,0 +1,192 @@
+#!/bin/bash
+
+#-----------------------------------------------------------------------------
+I2P_USER="i2p"
+WRAPPER_CMD="/usr/bin/java-service-wrapper"
+WRAPPER_CONF="/opt/i2p/wrapper.config"
+PIDDIR="/run/i2p"
+PIDFILE="$PIDDIR/i2p.pid"
+TIMEOUT=30
+#-----------------------------------------------------------------------------
+
+fail() {
+ printf "\e[1;31m>>> ERROR:\033[0m %s\n" "$*"
+ exit 1
+}
+debug() {
+ printf "\e[1;33m>>> DEBUG:\033[0m %s\n" "$*"
+}
+
+check_user() {
+ if [[ "$(id -un)" != "$I2P_USER" ]]; then
+ #debug "current user: $(id -un) dropping to user: $I2P_USER"
+ if [[ ! -d "$PIDDIR" ]]; then
+ mkdir -p "$PIDDIR"
+ chown ${I2P_USER}:${I2P_USER} "$PIDDIR"
+ fi
+ SCRIPT_PATH="$(cd $(dirname $0) && pwd)/$(basename $0)"
+ su - "$I2P_USER" -c "${SCRIPT_PATH} $@"
+ exit $?
+ fi
+}
+
+init_vars() {
+ [[ ! -r "$WRAPPER_CONF" ]] &&
+ fail "Unable to read \$WRAPPER_CONF: ${WRAPPER_CONF}"
+ [[ ! -x "$WRAPPER_CMD" ]] &&
+ fail "Unable to find or execute \$WRAPPER_CMD: ${WRAPPER_CMD}"
+ [[ ! $(grep -E ^I2P_USER $0) && "$EUID" = "0" ]] &&
+ fail "Attempting to start as root! Please edit $(basename $0) and set the variable \$I2P_USER"
+ [[ "$(id -un "$I2P_USER")" != "$I2P_USER" ]] &&
+ fail "\$I2P_USER does not exist: $I2P_USER"
+ COMMAND_LINE="\"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"i2prouter\" wrapper.name=\"i2prouter\""
+}
+
+get_wrapper_pid() {
+ pgrep -u "$I2P_USER" -f 'wrapper.name=i2prouter'
+}
+get_pid() {
+ pgrep -u "$I2P_USER" -f 'jar'
+}
+
+check_if_running() {
+ unset pid
+ if [[ -f "$PIDFILE" ]]; then
+ if [[ -r "$PIDFILE" ]]; then
+ pid=$(cat "$PIDFILE")
+ #debug "pid:$pid get_pid:$(get_pid)"
+ if [[ ! "$pid" ]]; then
+ pid=$(get_pid)
+ if [[ ! "$pid" ]]; then
+ echo "Removing stale pid file: $PIDFILE"
+ rm -f "$PIDFILE"
+ fi
+ else
+ [[ "$pid" != "$(get_pid)" ]] &&
+ fail "\$PIDFILE $PIDFILE differs from what is actually running!"
+ fi
+ else
+ fail "Cannot read \$PIDFILE: $PIDFILE"
+ fi
+ fi
+}
+
+_console() {
+ if [[ ! "$pid" ]]; then
+ trap '' INT QUIT
+ eval $COMMAND_LINE
+ [[ $? != 0 ]] && fail "Failed to launch the wrapper!"
+ else
+ echo "I2P Service is already running"
+ fi
+}
+
+_start() {
+ if [[ ! "$pid" ]]; then
+ echo -n "Starting I2P Service"
+ COMMAND_LINE+=" wrapper.daemonize=TRUE"
+ eval $COMMAND_LINE
+ [[ $? != 0 ]] && fail "Failed to launch the wrapper!"
+ i=0
+ while [[ ! "$pid" || $i < $TIMEOUT ]]; do
+ echo -n "."
+ sleep 1
+ check_if_running
+ ((i++))
+ done
+ [[ $(get_pid) ]] &&
+ echo " done (pid $pid)" || fail "timeout: Failed to start wrapper!"
+ else
+ echo "I2P Service is already running"
+ fi
+}
+
+_restart() {
+ [[ "$pid" ]] &&
+ kill -USR1 $(get_wrapper_pid) || echo "I2P Service is not running"
+}
+
+_stop() {
+ if [[ "$pid" ]]; then
+ echo -n "Stopping I2P Service"
+ kill -TERM "$pid"
+ [[ $? != 0 ]] && fail "Unable to stop I2P Service: kill -TERM $pid"
+ i=0
+ while [[ "$pid" || $i > $TIMEOUT ]]; do
+ echo -n "."
+ sleep 1
+ [[ ! $(get_pid) ]] && unset pid
+ ((i++))
+ done
+ if [[ "$pid" ]]; then
+ fail "timeout: Failed to stop wrapper! (pid: $pid)"
+ else
+ echo " done"
+ [[ "$1" = 'start' ]] && _start
+ fi
+ else
+ echo "I2P Service is not running."
+ fi
+}
+
+_graceful() {
+ if [[ "$pid" ]]; then
+ echo "Stopping I2P Service gracefully..."
+ kill -HUP "$pid"
+ [[ $? != 0 ]] && fail "Unable to stop I2P Service."
+ else
+ echo "I2P Service is not running."
+ fi
+}
+
+_status() {
+ [[ "$pid" ]] &&
+ echo "I2P Service is running: PID:$pid" || echo "I2P Service is not running."
+}
+
+_dump() {
+ if [[ "$pid" ]]; then
+ echo "Dumping threads..."
+ kill -QUIT "$pid"
+ [[ $? != 0 ]] &&
+ fail "Failed to dump threads" || echo "Thread Dump is available in wrapper.log"
+ else
+ echo "I2P Service is not running."
+ fi
+}
+#-----------------------------------------------------------------------------
+
+check_user "$@"
+init_vars
+check_if_running
+
+case "$1" in
+ 'console') _console
+ ;;
+ 'start') _start
+ ;;
+ 'stop') _stop
+ ;;
+ 'graceful') _graceful
+ ;;
+ 'restart') _restart
+ ;;
+ 'status') _status
+ ;;
+ 'dump') _dump
+ ;;
+
+ *) echo "Usage: $(basename $0) [command]"
+ echo
+ echo "Commands:"
+ echo " console Launch in the current console"
+ echo " start Start in the background as a daemon process"
+ echo " stop Stop if running as a daemon or in another console"
+ echo " graceful Stop gracefully, may take up to 11 minutes for all tunnels to close"
+ echo " restart Restart the JVM"
+ echo " status Query the current status"
+ echo " dump Request a Java thread dump if running"
+ echo
+ ;;
+esac
+exit 0
diff --git a/router.config b/router.config
new file mode 100755
index 000000000000..cbce544071a7
--- /dev/null
+++ b/router.config
@@ -0,0 +1,9 @@
+# NOTE: This I2P config file must use UTF-8 encoding
+# * i2cp: allows java clients to communicate with I2P outside of the JVM. Disabled.
+# * IPv6: Disabled
+# * In-I2P Network Updates: Disabled
+i2cp.disableInterface=true
+i2np.ntcp.ipv6=false
+i2np.udp.ipv6=false
+router.updateDisabled=true
+routerconsole.advanced=true
diff --git a/wrapper.config b/wrapper.config
new file mode 100755
index 000000000000..4d54e65a668a
--- /dev/null
+++ b/wrapper.config
@@ -0,0 +1,162 @@
+#encoding=UTF-8
+#********************************************************************
+# Wrapper Properties
+#
+# WARNING - for any changes to take effect, you must completely
+# stop the router and the wrapper. Clicking 'Restart' on your
+# router console will NOT reread this file! You must
+# click "Shutdown", wait 11 minutes, then start i2p.
+#
+#********************************************************************
+# Java Application
+wrapper.java.command=/usr/lib/jvm/default/bin/java
+
+# Java Main class. This class must implement the WrapperListener interface
+# or guarantee that the WrapperManager class is initialized. Helper
+# classes are provided to do this for you. See the Integration section
+# of the documentation for details.
+wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
+
+# Java Classpath (include wrapper.jar) Add class path elements as
+# needed starting from 1
+# Be sure there are no other duplicate classes.
+wrapper.java.classpath.1=/opt/i2p/lib/*.jar
+wrapper.java.classpath.2=/usr/share/java/wrapper.jar
+
+# Java Library Path (location of libwrapper.so)
+wrapper.java.library.path.1=/opt/i2p
+wrapper.java.library.path.2=/opt/i2p/lib
+wrapper.java.library.path.3=/usr/lib/java-service-wrapper
+
+# Java Bits. On applicable platforms, tells the JVM to run in 32 or 64-bit mode.
+wrapper.java.additional.auto_bits=TRUE
+
+# Java Additional Parameters
+wrapper.java.additional.1=-DloggerFilenameOverride=logs/log-router-@.txt
+wrapper.java.additional.2=-Dorg.mortbay.http.Version.paranoid=true
+wrapper.java.additional.3=-Dorg.mortbay.xml.XmlParser.NotValidating=true
+wrapper.java.additional.4=-Di2p.dir.base="/opt/i2p"
+wrapper.java.additional.4.stripquotes=TRUE
+
+# On some IPv6 enabled systems, I2P and other network-enabled java applications
+# may fail to start. For examples see
+# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560044.
+# Two things that may help if you experience this issue
+# 1) "echo 0 > /proc/sys/net/ipv6/bindv6only" as root; or
+# 2) uncomment the next two lines:
+wrapper.java.additional.5=-Djava.net.preferIPv4Stack=true
+wrapper.java.additional.6=-Djava.net.preferIPv6Addresses=false
+
+# Initial Java Heap Size (in MB)
+# If a non-zero value is specified for this property then an appropriate -Xms
+# parameter will be added. The initial memory must be less than or equal to
+# the value set for the maxmemory property
+#wrapper.java.initmemory=4
+
+# Maximum Java Heap Size (in MB)
+# The JVM's default is 64MB, and I2P can work fine in that, but to handle
+# lots of I2PSnark activity in the same JVM, increasing the default max heap
+# size should help. Feel free to reduce this if not using I2PSnark in the jvm
+# High-bandwidth routers may need to increase to 256 or more.
+wrapper.java.maxmemory=128
+
+# Application parameters. Add parameters as needed starting from 1
+wrapper.app.parameter.1=net.i2p.router.Router
+
+#********************************************************************
+# Wrapper Logging Properties
+#********************************************************************
+# Enables Debug output from the Wrapper.
+# wrapper.debug=TRUE
+# Format of output for the console. (See docs for formats)
+wrapper.console.format=PM
+
+# Log Level for console output. (See docs for log levels)
+wrapper.console.loglevel=INFO
+
+# Log file to use for wrapper output logging.
+# You may wish to change this.
+wrapper.logfile=/opt/i2p/wrapper.log
+
+# Format of output for the log file.
+# The format consists of the tokens 'L' for log level, 'P' for prefix, 'D' for thread,
+# 'T' for time, 'Z' for millisecond time, and 'M' for message
+# Unfortunately the log timezone cannot be changed, see
+# http://www.nabble.com/Log-message-timezone-td23651317.html
+wrapper.logfile.format=TM
+
+# Log Level for log file output. (See docs for log levels)
+wrapper.logfile.loglevel=INFO
+
+# Maximum size that the log file will be allowed to grow to before
+# the log is rolled. Size is specified in bytes. The default value
+# of 0, disables log rolling. May abbreviate with the 'k' (kb) or
+# 'm' (mb) suffix. For example: 10m = 10 megabytes.
+wrapper.logfile.maxsize=1m
+
+# Maximum number of rolled log files which will be allowed before old
+# files are deleted. The default value of 0 implies no limit.
+wrapper.logfile.maxfiles=2
+
+# Log Level for sys/event log output. (See docs for log levels)
+wrapper.syslog.loglevel=NONE
+
+# these will shut down or crash the JVM
+wrapper.signal.mode.usr1=RESTART
+wrapper.signal.mode.usr2=IGNORE
+
+# choose what to do if the JVM kills itself based on the exit code
+wrapper.on_exit.default=SHUTDOWN
+wrapper.on_exit.0=SHUTDOWN
+wrapper.on_exit.1=SHUTDOWN
+# OOM
+wrapper.on_exit.10=RESTART
+# graceful shutdown
+wrapper.on_exit.2=SHUTDOWN
+# hard shutdown
+wrapper.on_exit.3=SHUTDOWN
+# hard restart
+wrapper.on_exit.4=RESTART
+# hard restart
+wrapper.on_exit.5=RESTART
+
+# the router may take a few seconds to save state, etc
+wrapper.jvm_exit.timeout=60
+
+# give the OS 60s to clear all the old sockets / etc before restarting
+# Let's change the default from 60 to 10 seconds and see if anyone moans..
+wrapper.restart.delay=10
+
+wrapper.ping.interval=300
+# The ping timeout must be at least 5 seconds longer than the value of wrapper.ping.interval.
+# Extend this if you are getting 'JVM appears hung' shutdowns.
+wrapper.ping.timeout=320
+
+# use the wrapper's internal timer thread. otherwise this would
+# force a restart of the router during daylight savings time as well
+# as any time that the OS clock changes
+wrapper.use_system_time=false
+
+# pid file for the JVM
+# If you plan to have multiple wrappers running on the same machine,
+# you should copy this file, change the location or file name,
+# and edit the i2prouter script to change the WRAPPER_CONF setting
+# to point to the new wrapper.config location.
+# Directory must exist or the wrapper will fail to start.
+wrapper.java.pidfile=/run/i2p/i2p.pid
+
+#********************************************************************
+# Wrapper General Properties
+#********************************************************************
+# Allow for the use of non-contiguous numbered properties
+wrapper.ignore_sequence_gaps=TRUE
+
+# Title to use when running as a console
+wrapper.console.title=I2P Service
+
+# Set permissions used when creating files
+# See http://wrapper.tanukisoftware.com/doc/english/prop-umask.html
+# for a detailed explanation of these settings.
+wrapper.umask=0022
+wrapper.java.umask=0022
+wrapper.logfile.umask=077