I think that might be a working UpdatePostProcessor, now to figure out how to register it
This commit is contained in:
5
Makefile
5
Makefile
@ -37,6 +37,7 @@ src/I2P/config:
|
||||
|
||||
build/I2P/config: build/I2P
|
||||
cp -rv src/I2P/config build/I2P/config ; true
|
||||
cp -rv src/I2P/config build/I2P/.i2p ; true
|
||||
|
||||
#
|
||||
# Warning: a displayed license file of more than 28752 bytes
|
||||
@ -61,7 +62,7 @@ profile: build/profile/user.js build/profile/prefs.js build/profile/bookmarks.ht
|
||||
profile.tgz: profile
|
||||
$(eval PROFILE_VERSION := $(shell cat src/profile/version.txt))
|
||||
@echo "building profile tarball $(PROFILE_VERSION)"
|
||||
bash -c 'ls I2P && cp -rv I2P build/profile/I2P'; true
|
||||
bash -c 'ls I2P && cp -rv build/I2P build/profile/I2P'; true
|
||||
install -m755 src/unix/i2pbrowser.sh build/profile/i2pbrowser.sh
|
||||
cd build && tar -czf profile-$(PROFILE_VERSION).tgz profile && cp profile-$(PROFILE_VERSION).tgz ../
|
||||
|
||||
@ -87,7 +88,7 @@ app-profile: build/app-profile/user.js build/app-profile/prefs.js build/app-prof
|
||||
app-profile.tgz: app-profile
|
||||
$(eval PROFILE_VERSION := $(shell cat src/app-profile/version.txt))
|
||||
@echo "building app-profile tarball $(PROFILE_VERSION)"
|
||||
bash -c 'ls I2P && cp -rv I2P build/app-profile/I2P'; true
|
||||
bash -c 'ls I2P && cp -rv build/I2P build/app-profile/I2P'; true
|
||||
install -m755 src/unix/i2pconfig.sh build/app-profile/i2pconfig.sh
|
||||
cd build && tar -czf app-profile-$(PROFILE_VERSION).tgz app-profile && cp app-profile-$(PROFILE_VERSION).tgz ../
|
||||
|
||||
|
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 pkg || true
|
||||
|
||||
cd "$HERE"
|
||||
RES_DIR="$HERE/../i2p.i2p/installer/resources"
|
||||
|
@ -1,13 +1,15 @@
|
||||
#! /usr/bin/env sh
|
||||
|
||||
|
||||
#Comment this out to build from an alternate branch or
|
||||
# the tip of the master branch.
|
||||
#I2P_VERSION=0.9.50
|
||||
#export I2P_VERSION=0.9.50
|
||||
|
||||
#VERSION=i2p-$I2P_VERSION
|
||||
#export VERSION="$VERSION"
|
||||
|
||||
#Uncomment this to build from the tip of the master.
|
||||
I2P_VERSION=master
|
||||
export I2P_VERSION=master
|
||||
|
||||
VERSION=$I2P_VERSION
|
||||
export VERSION="$VERSION"
|
||||
|
@ -13,7 +13,6 @@ import java.lang.InterruptedException;
|
||||
|
||||
public class WindowsUpdatePostProcessor {
|
||||
protected static Router i2pRouter = null;
|
||||
Process updateProcess = null;
|
||||
public void updateDownloadedandVerified(UpdateType type, int fileType, String version, File file) throws IOException {
|
||||
if (fileType == 6) {
|
||||
if (runUpdate(file)) {
|
||||
@ -23,32 +22,35 @@ public class WindowsUpdatePostProcessor {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean runUpdate(File file){
|
||||
ProcessBuilder pb = new ProcessBuilder("cmd", "/c", file.getAbsolutePath());
|
||||
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;
|
||||
Process updateProcess = null;
|
||||
ProcessBuilder pb = new ProcessBuilder("cmd", "/c", file.getAbsolutePath());
|
||||
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() {
|
||||
i2pRouter.shutdownGracefully();
|
||||
ProcessBuilder pb = new ProcessBuilder("cmd", "/c", selectProgramFile().getAbsolutePath());
|
||||
while (i2pRouter.gracefulShutdownInProgress()){
|
||||
}
|
||||
if (i2pRouter.isFinalShutdownInProgress()){
|
||||
if (i2pRouter.isFinalShutdownInProgress()) {
|
||||
try {
|
||||
Process restartProcess = pb.start();
|
||||
} catch (IOException ex) {
|
||||
@ -72,4 +74,15 @@ public class WindowsUpdatePostProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
protected static File selectProgramFileExe() {
|
||||
File pfpath = selectProgramFile();
|
||||
if (SystemVersion.isWindows()) {
|
||||
File app = new File(pfpath, "I2P.exe");
|
||||
return app.getAbsoluteFile();
|
||||
} else {
|
||||
File app = new File(pfpath, "bin/I2P");
|
||||
return app.getAbsoluteFile();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user