From 97d2558947d6eb42b43925131377252e948b1e03 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Mon, 2 Aug 2021 16:47:03 +0100 Subject: [PATCH] only restart i2p if user was restarting router --- bash/mac-update.sh | 6 ++++-- java/net/i2p/update/MacUpdateProcess.java | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/bash/mac-update.sh b/bash/mac-update.sh index 196bc01..a619fad 100755 --- a/bash/mac-update.sh +++ b/bash/mac-update.sh @@ -53,5 +53,7 @@ echo "unmounting and cleaning up" hdiutil detach mount_point rm -f I2P.cdr "${UPDATE_DMG}" -echo "launching I2P" -open "${BUNDLE_HOME}"/I2P.app +if [ ! -z $RESTART_I2P ]; then + echo "launching I2P" + open "${BUNDLE_HOME}"/I2P.app +fi diff --git a/java/net/i2p/update/MacUpdateProcess.java b/java/net/i2p/update/MacUpdateProcess.java index a58ad80..f780e81 100644 --- a/java/net/i2p/update/MacUpdateProcess.java +++ b/java/net/i2p/update/MacUpdateProcess.java @@ -26,6 +26,11 @@ class MacUpdateProcess implements Runnable { env.put("I2P_PID", System.getProperty("router.pid")); env.put("I2P_VERSION", version); env.put("BUNDLE_HOME", System.getProperty("mac.bundle.location")); + env.remove("RESTART_I2P"); + + int exitCode = ctx.router().scheduledGracefulExitCode(); + if (exitCode == Router.EXIT_HARD_RESTART || exitCode == Router.EXIT_GRACEFUL_RESTART) + env.put("RESTART_I2P","true"); try { var process = pb.