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
|
build/I2P/config: build/I2P
|
||||||
cp -rv src/I2P/config build/I2P/config ; true
|
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
|
# 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
|
profile.tgz: profile
|
||||||
$(eval PROFILE_VERSION := $(shell cat src/profile/version.txt))
|
$(eval PROFILE_VERSION := $(shell cat src/profile/version.txt))
|
||||||
@echo "building profile tarball $(PROFILE_VERSION)"
|
@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
|
install -m755 src/unix/i2pbrowser.sh build/profile/i2pbrowser.sh
|
||||||
cd build && tar -czf profile-$(PROFILE_VERSION).tgz profile && cp profile-$(PROFILE_VERSION).tgz ../
|
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
|
app-profile.tgz: app-profile
|
||||||
$(eval PROFILE_VERSION := $(shell cat src/app-profile/version.txt))
|
$(eval PROFILE_VERSION := $(shell cat src/app-profile/version.txt))
|
||||||
@echo "building app-profile tarball $(PROFILE_VERSION)"
|
@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
|
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 ../
|
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"
|
HERE="$PWD"
|
||||||
cd "$HERE/../i2p.i2p/"
|
cd "$HERE/../i2p.i2p/"
|
||||||
git checkout "$VERSION"
|
git checkout "$VERSION"
|
||||||
#ant distclean pkg || true
|
ant distclean pkg || true
|
||||||
|
|
||||||
cd "$HERE"
|
cd "$HERE"
|
||||||
RES_DIR="$HERE/../i2p.i2p/installer/resources"
|
RES_DIR="$HERE/../i2p.i2p/installer/resources"
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
#! /usr/bin/env sh
|
#! /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
|
#I2P_VERSION=0.9.50
|
||||||
#export I2P_VERSION=0.9.50
|
#export I2P_VERSION=0.9.50
|
||||||
|
|
||||||
#VERSION=i2p-$I2P_VERSION
|
#VERSION=i2p-$I2P_VERSION
|
||||||
#export VERSION="$VERSION"
|
#export VERSION="$VERSION"
|
||||||
|
|
||||||
|
#Uncomment this to build from the tip of the master.
|
||||||
I2P_VERSION=master
|
I2P_VERSION=master
|
||||||
export I2P_VERSION=master
|
export I2P_VERSION=master
|
||||||
|
|
||||||
VERSION=$I2P_VERSION
|
VERSION=$I2P_VERSION
|
||||||
export VERSION="$VERSION"
|
export VERSION="$VERSION"
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import java.lang.InterruptedException;
|
|||||||
|
|
||||||
public class WindowsUpdatePostProcessor {
|
public class WindowsUpdatePostProcessor {
|
||||||
protected static Router i2pRouter = null;
|
protected static Router i2pRouter = null;
|
||||||
Process updateProcess = 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 (runUpdate(file)) {
|
||||||
@@ -23,32 +22,35 @@ public class WindowsUpdatePostProcessor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean runUpdate(File file){
|
private boolean runUpdate(File file){
|
||||||
ProcessBuilder pb = new ProcessBuilder("cmd", "/c", file.getAbsolutePath());
|
Process updateProcess = null;
|
||||||
try {
|
ProcessBuilder pb = new ProcessBuilder("cmd", "/c", file.getAbsolutePath());
|
||||||
updateProcess = pb.start();
|
try {
|
||||||
} catch (IOException ex) {
|
updateProcess = pb.start();
|
||||||
// At this point a failure is harmless, but it's also not at all important to
|
} catch (IOException ex) {
|
||||||
// restart the router. Return false.
|
// At this point a failure is harmless, but it's also not at all important to
|
||||||
return false;
|
// restart the router. Return false.
|
||||||
}
|
return false;
|
||||||
try {
|
}
|
||||||
updateProcess.waitFor();
|
try {
|
||||||
} catch (InterruptedException ex) {
|
updateProcess.waitFor();
|
||||||
// if the NSIS installer process got interrupted here, it's possible that the
|
} catch (InterruptedException ex) {
|
||||||
// install was left in a broken state. I think we should direct the uses to
|
// if the NSIS installer process got interrupted here, it's possible that the
|
||||||
// re-run the installer if this happens. TODO: java dialog boxes. That should be
|
// install was left in a broken state. I think we should direct the uses to
|
||||||
// easy.
|
// re-run the installer if this happens. TODO: java dialog boxes. That should be
|
||||||
return false;
|
// easy.
|
||||||
}
|
return false;
|
||||||
return true;
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shutdownGracefullyAndRerun() {
|
private boolean shutdownGracefullyAndRerun() {
|
||||||
i2pRouter.shutdownGracefully();
|
i2pRouter.shutdownGracefully();
|
||||||
ProcessBuilder pb = new ProcessBuilder("cmd", "/c", selectProgramFile().getAbsolutePath());
|
ProcessBuilder pb = new ProcessBuilder("cmd", "/c", selectProgramFile().getAbsolutePath());
|
||||||
while (i2pRouter.gracefulShutdownInProgress()){
|
while (i2pRouter.gracefulShutdownInProgress()){
|
||||||
}
|
}
|
||||||
if (i2pRouter.isFinalShutdownInProgress()){
|
if (i2pRouter.isFinalShutdownInProgress()) {
|
||||||
try {
|
try {
|
||||||
Process restartProcess = pb.start();
|
Process restartProcess = pb.start();
|
||||||
} catch (IOException ex) {
|
} 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