diff --git a/pkgs/tools/networking/i2p/default.nix b/pkgs/tools/networking/i2p/default.nix index b5ef06c34eaa..1ef159131af2 100644 --- a/pkgs/tools/networking/i2p/default.nix +++ b/pkgs/tools/networking/i2p/default.nix @@ -1,12 +1,13 @@ { stdenv, procps, coreutils, fetchurl, jdk, jre, ant, gettext, which }: stdenv.mkDerivation rec { - name = "i2p-0.9.19"; + name = "i2p-0.9.20"; src = fetchurl { url = "https://github.com/i2p/i2p.i2p/archive/${name}.tar.gz"; - sha256 = "1q9sda1a708laxf452qnzbfv7bwfwyam5n1giw2n3z3ar602i936"; + sha256 = "10rynkl9dbnfl67ck3d7wdwz52h7354r7nbwcypsjnng4f1dmj5s"; }; buildInputs = [ jdk ant gettext which ]; + patches = [ ./i2p.patch ]; buildPhase = '' export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8" ant preppkg-linux-only @@ -17,15 +18,15 @@ stdenv.mkDerivation rec { cp -r pkg-temp/* $out cp installer/lib/wrapper/linux64/* $out sed -i $out/i2prouter -i $out/runplain.sh \ - -e "s#%INSTALL_PATH#$out#" \ + -e "s#uname#${coreutils}/bin/uname#" \ + -e "s#which#${which}/bin/which#" \ + -e "s#%gettext%#${gettext}/bin/gettext#" \ -e "s#/usr/ucb/ps#${procps}/bin/ps#" \ -e "s#/usr/bin/tr#${coreutils}/bin/tr#" \ + -e "s#%INSTALL_PATH#$out#" \ -e 's#%USER_HOME#$HOME#' \ -e "s#%SYSTEM_java_io_tmpdir#/tmp#" \ - -e 's#JAVA=java#JAVA=${jre}/bin/java#' - sed -i $out/runplain.sh \ - -e "s#nohup \(.*Launch\) .*#\1#" \ - -e "s#echo \$\! .*##" + -e "s#%JAVA%#${jre}/bin/java#" mv $out/runplain.sh $out/bin/i2prouter-plain mv $out/man $out/share/ chmod +x $out/bin/* $out/i2psvc diff --git a/pkgs/tools/networking/i2p/i2p.patch b/pkgs/tools/networking/i2p/i2p.patch new file mode 100644 index 000000000000..2ae6446ed286 --- /dev/null +++ b/pkgs/tools/networking/i2p/i2p.patch @@ -0,0 +1,39 @@ +--- a/installer/resources/runplain.sh ++++ b/installer/resources/runplain.sh +@@ -21,7 +21,7 @@ + + # Try using the Java binary that I2P was installed with. + # If it's not found, try looking in the system PATH. +-JAVA=$(which %JAVA_HOME/bin/java || which java) ++JAVA=%JAVA% + + if [ -z $JAVA ] || [ ! -x $JAVA ]; then + echo "Error: Cannot find java." >&2 +@@ -40,15 +40,4 @@ + export JAVA_TOOL_OPTIONS="-Djava.awt.headless=true" + fi + JAVAOPTS="-Djava.net.preferIPv4Stack=${PREFERv4} -Djava.library.path=${I2P}:${I2P}/lib -Di2p.dir.base=${I2P} -DloggerFilenameOverride=logs/log-router-@.txt" +-( +- nohup ${JAVA} -cp \"${CP}\" ${JAVAOPTS} net.i2p.router.RouterLaunch > /dev/null 2>&1 +-) & +-PID=$! +- +-if [ ! -z $PID ] && kill -0 $PID > /dev/null 2>&1 ; then +- echo "I2P started [$PID]" >&2 +- echo $PID > "${I2PTEMP}/router.pid" +-else +- echo "I2P failed to start." >&2 +- exit 1 +-fi ++${JAVA} -cp \"${CP}\" ${JAVAOPTS} net.i2p.router.RouterLaunch +--- a/installer/resources/i2prouter ++++ b/installer/resources/i2prouter +@@ -49,7 +49,7 @@ + + # gettext - we look for it in the path + # fallback to echo is below, we can't set it to echo here. +-GETTEXT=$(which gettext > /dev/null 2>&1) ++GETTEXT=%gettext% + + # Where to install the systemd service + SYSTEMD_SERVICE="/etc/systemd/system/${APP_NAME}.service"