diff --git a/debian/patches/0001-path-substitution.patch b/debian/patches/0001-path-substitution.patch index 2998924366..bf12ab97fe 100644 --- a/debian/patches/0001-path-substitution.patch +++ b/debian/patches/0001-path-substitution.patch @@ -76,7 +76,7 @@ Index: b/installer/resources/i2prouter # Priority at which to run the wrapper. See "man nice" for valid priorities. # nice is only used if a priority is specified. -@@ -177,77 +168,8 @@ if [ ! -e "$WRAPPER_CONF" ]; then +@@ -180,77 +171,8 @@ if [ ! -e "$WRAPPER_CONF" ]; then exit 1 fi @@ -154,7 +154,7 @@ Index: b/installer/resources/i2prouter if [ -n "$FIXED_COMMAND" ] then COMMAND="$FIXED_COMMAND" -@@ -1068,7 +990,6 @@ startwait() { +@@ -1078,7 +1000,6 @@ startwait() { if [ "X$pid" = "X" ] then eval echo " `gettext 'WARNING: $APP_LONG_NAME may have failed to start.'`" @@ -162,7 +162,7 @@ Index: b/installer/resources/i2prouter else eval echo ' running: PID:$pid' fi -@@ -1871,7 +1792,7 @@ showUsage() { +@@ -1881,7 +1802,7 @@ showUsage() { } showsetusermesg() { @@ -171,7 +171,7 @@ Index: b/installer/resources/i2prouter } checkifstartingasroot() { -@@ -1879,7 +1800,7 @@ checkifstartingasroot() { +@@ -1889,7 +1810,7 @@ checkifstartingasroot() { echo "`gettext 'Running I2P as the root user is *not* recommended.'`" showsetusermesg echo @@ -180,7 +180,7 @@ Index: b/installer/resources/i2prouter exit 1 fi } -@@ -1946,24 +1867,10 @@ docommand() { +@@ -1981,24 +1902,10 @@ docommand() { status ;; diff --git a/installer/resources/i2prouter b/installer/resources/i2prouter index fb459fb679..16021fda33 100644 --- a/installer/resources/i2prouter +++ b/installer/resources/i2prouter @@ -127,6 +127,9 @@ WAIT_FOR_STARTED_TIMEOUT=120 # flag for using upstart when installing (rather than init.d rc.d) USE_UPSTART= +# Raise the soft open files soft ulimit to this value, if able +OPEN_FILES_ULIMIT=2048 + # Source the environment variables for the locale if $LANG isn't set # If you want to set custom locale variables for I2P, # you may comment out this block and set them yourself here. @@ -1891,6 +1894,28 @@ checkifstartingasroot() { fi } +raiseopenfilesulimit() { + OPEN_FILES_SOFT=`ulimit -S -n` 2> /dev/null || return + if [ "$OPEN_FILES_SOFT" != "unlimited" ] + then + if [ "$OPEN_FILES_ULIMIT" -gt "$OPEN_FILES_SOFT" ] + then + OPEN_FILES_HARD=`ulimit -H -n` 2> /dev/null || return + if [ "$OPEN_FILES_HARD" != "unlimited" ] + then + if [ "$OPEN_FILES_ULIMIT" -gt "$OPEN_FILES_HARD" ] + then + OPEN_FILES_ULIMIT="$OPEN_FILES_HARD" + fi + fi + if [ "$OPEN_FILES_ULIMIT" -gt "$OPEN_FILES_SOFT" ] + then + ulimit -S -n "$OPEN_FILES_ULIMIT" > /dev/null 2>&1 + fi + fi + fi +} + docommand() { case "$COMMAND" in 'console') @@ -1904,6 +1929,7 @@ docommand() { 'start') checkifstartingasroot + raiseopenfilesulimit if [ "$DIST_OS" = "macosx" -a -f "/Library/LaunchDaemons/${APP_PLIST}" ] ; then macosxstart elif [ "$DIST_OS" = "linux" -a -f "/etc/init/${APP_NAME}.conf" ] ; then @@ -1930,6 +1956,7 @@ docommand() { 'restart') checkifstartingasroot + raiseopenfilesulimit checkUser touchlock "$COMMAND" if [ ! -n "$FIXED_COMMAND" ] ; then shift @@ -1940,6 +1967,7 @@ docommand() { 'condrestart') checkifstartingasroot + raiseopenfilesulimit checkUser touchlock "$COMMAND" if [ ! -n "$FIXED_COMMAND" ] ; then shift