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

@ -17,51 +17,29 @@ public class WindowsUpdatePostProcessor implements UpdatePostProcessor {
protected Router i2pRouter = null;
public void updateDownloadedandVerified(UpdateType type, int fileType, String version, File file) throws IOException {
if (fileType == 6) {
if (runUpdate(file)) {
try {
if (!shutdownGracefullyAndRerun()) {
i2pRouter.cancelGracefulShutdown();
}
} catch (InterruptedException ie) {
i2pRouter.cancelGracefulShutdown();
}
if (!runUpdateInstaller(file)) {
i2pRouter.cancelGracefulShutdown();
}
}
}
private boolean runUpdate(File file){
private boolean runUpdateInstaller(File file){
i2pRouter.shutdownGracefully();
Process updateProcess = null;
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()) {
TimeUnit.MILLISECONDS.sleep(125);
try {
TimeUnit.MILLISECONDS.sleep(125);
} catch (InterruptedException ex) {
return false;
}
}
if (i2pRouter.isFinalShutdownInProgress()) {
try {
Process restartProcess = pb.start();
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;
}
return true;