update jpackages, remove debian dir, that will be merged from EXPERIMENTAL-debian

This commit is contained in:
idk
2021-07-06 13:57:23 -04:00
parent 59dc5d65e0
commit b5de7de981
2 changed files with 13 additions and 35 deletions

View File

@@ -22,7 +22,7 @@ echo "cleaning"
HERE="$PWD" HERE="$PWD"
cd "$HERE/../i2p.i2p/" cd "$HERE/../i2p.i2p/"
git checkout "$VERSION" git checkout "$VERSION"
ant distclean pkg || true ant distclean preppkg-windows || true
cd "$HERE" cd "$HERE"
RES_DIR="$HERE/../i2p.i2p/installer/resources" RES_DIR="$HERE/../i2p.i2p/installer/resources"

View File

@@ -17,51 +17,29 @@ public class WindowsUpdatePostProcessor implements UpdatePostProcessor {
protected Router i2pRouter = null; protected Router i2pRouter = null;
public void updateDownloadedandVerified(UpdateType type, int fileType, String version, File file) throws IOException { public void updateDownloadedandVerified(UpdateType type, int fileType, String version, File file) throws IOException {
if (fileType == 6) { if (fileType == 6) {
if (runUpdate(file)) { if (!runUpdateInstaller(file)) {
try { i2pRouter.cancelGracefulShutdown();
if (!shutdownGracefullyAndRerun()) {
i2pRouter.cancelGracefulShutdown();
}
} catch (InterruptedException ie) {
i2pRouter.cancelGracefulShutdown();
}
} }
} }
} }
private boolean runUpdate(File file){ private boolean runUpdateInstaller(File file){
i2pRouter.shutdownGracefully();
Process updateProcess = null; Process updateProcess = null;
ProcessBuilder pb = new ProcessBuilder("cmd", "/c", file.getAbsolutePath(), "/S"); ProcessBuilder pb = new ProcessBuilder("cmd", "/c", file.getAbsolutePath(), "/S");
try {
updateProcess = pb.start();
} catch (IOException ex) {
// At this point a failure is harmless, but it's also not at all important to
// restart the router. Return false.
return false;
}
try {
updateProcess.waitFor();
} catch (InterruptedException ex) {
// if the NSIS installer process got interrupted here, it's possible that the
// install was left in a broken state. I think we should direct the uses to
// re-run the installer if this happens. TODO: java dialog boxes. That should be
// easy.
return false;
}
return true;
}
private boolean shutdownGracefullyAndRerun() throws InterruptedException {
i2pRouter.shutdownGracefully();
ProcessBuilder pb = new ProcessBuilder("cmd", "/c", selectProgramFileExe().getAbsolutePath());
while (i2pRouter.gracefulShutdownInProgress()) { while (i2pRouter.gracefulShutdownInProgress()) {
TimeUnit.MILLISECONDS.sleep(125); try {
TimeUnit.MILLISECONDS.sleep(125);
} catch (InterruptedException ex) {
return false;
}
} }
if (i2pRouter.isFinalShutdownInProgress()) { if (i2pRouter.isFinalShutdownInProgress()) {
try { try {
Process restartProcess = pb.start(); updateProcess = pb.start();
} catch (IOException ex) { } catch (IOException ex) {
// // At this point a failure is harmless, but it's also not at all important to
// restart the router. Return false.
return false; return false;
} }
return true; return true;