update jpackages, remove debian dir, that will be merged from EXPERIMENTAL-debian
This commit is contained in:
2
build.sh
2
build.sh
@ -22,7 +22,7 @@ echo "cleaning"
|
||||
HERE="$PWD"
|
||||
cd "$HERE/../i2p.i2p/"
|
||||
git checkout "$VERSION"
|
||||
ant distclean pkg || true
|
||||
ant distclean preppkg-windows || true
|
||||
|
||||
cd "$HERE"
|
||||
RES_DIR="$HERE/../i2p.i2p/installer/resources"
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user