diff --git a/debian/patches/0001-path-substitution.patch b/debian/patches/0001-path-substitution.patch index b468c5250dee28da8ef06c812859996b38ba334e..e4cb1fcacac79dc65c9faae900a9d7f011538287 100644 --- a/debian/patches/0001-path-substitution.patch +++ b/debian/patches/0001-path-substitution.patch @@ -147,7 +147,7 @@ Debian wrapper.config to try to prevent confusion. if [ -n "$FIXED_COMMAND" ] then COMMAND="$FIXED_COMMAND" -@@ -1055,7 +979,6 @@ +@@ -1058,7 +982,6 @@ if [ "X$pid" = "X" ] then eval echo " `gettext 'WARNING: $APP_LONG_NAME may have failed to start.'`" @@ -155,7 +155,7 @@ Debian wrapper.config to try to prevent confusion. else eval echo ' running: PID:$pid' fi -@@ -1858,7 +1781,7 @@ +@@ -1861,7 +1784,7 @@ } showsetusermesg() { @@ -164,7 +164,7 @@ Debian wrapper.config to try to prevent confusion. } checkifstartingasroot() { -@@ -1866,7 +1789,7 @@ +@@ -1869,7 +1792,7 @@ echo "`gettext 'Running I2P as the root user is *not* recommended.'`" showsetusermesg echo @@ -173,7 +173,7 @@ Debian wrapper.config to try to prevent confusion. exit 1 fi } -@@ -1931,24 +1854,10 @@ +@@ -1934,24 +1857,10 @@ status ;; @@ -214,7 +214,7 @@ Debian wrapper.config to try to prevent confusion. +I2PTEMP="/tmp" # Having IPv6 enabled can cause problems with certain configurations. Changing the - # next value to true may help. + # next value to true may help. --- a/installer/resources/wrapper.config +++ b/installer/resources/wrapper.config @@ -8,22 +8,13 @@ diff --git a/installer/resources/runplain.sh b/installer/resources/runplain.sh index 27d79c8eb9919607121c92da8331db533e4dd0c4..f1bf81d81034306dfef0e6b0d4bb5887f7e7cce5 100644 --- a/installer/resources/runplain.sh +++ b/installer/resources/runplain.sh @@ -15,16 +15,40 @@ I2P="%INSTALL_PATH" I2PTEMP="%SYSTEM_java_io_tmpdir" # Having IPv6 enabled can cause problems with certain configurations. Changing the -# next value to true may help. +# next value to true may help. PREFERv4="false" CP= -for jars in `ls ${I2P}/lib/*.jar`; do CP=${CP}:${jars}; done -JAVA=java +# 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) -if [ "`uname -s`" = "Darwin" ]; then +if [ -z $JAVA ] || [ ! -x $JAVA ]; then + echo "Error: Cannot find java." >&2 + exit 1 +fi + +for jar in `ls ${I2P}/lib/*.jar`; do + if [ ! -z $CP ]; then + CP=${CP}:${jar}; + else + CP=${jar} + fi +done + +if [ $(uname -s) = "Darwin" ]; then 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 & -echo $! > "${I2PTEMP}/router.pid" +( + 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