fix build issues, allow overriding i2p version with a file
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
build
|
||||
*.deb
|
||||
*.tgz
|
||||
./I2P/
|
||||
./I2P/
|
||||
i2pversion_override
|
||||
|
4
build.sh
4
build.sh
@ -3,6 +3,10 @@ set -e
|
||||
|
||||
. i2pversion
|
||||
|
||||
if [ -f i2pversion_override ]; then
|
||||
. i2pversion_override
|
||||
fi
|
||||
|
||||
JAVA=$(java --version | tr -d 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\n' | cut -d ' ' -f 2 | cut -d '.' -f 1 | tr -d '\n\t\- ')
|
||||
|
||||
if [ "$JAVA" -lt "14" ]; then
|
||||
|
@ -5,30 +5,33 @@ import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static net.i2p.update.UpdateType.*;
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.update.UpdateType;
|
||||
import net.i2p.update.UpdatePostProcessor;
|
||||
import net.i2p.util.Log;
|
||||
import net.i2p.util.SystemVersion;
|
||||
|
||||
import java.lang.ProcessBuilder;
|
||||
import java.lang.Process;
|
||||
import java.lang.InterruptedException;
|
||||
|
||||
|
||||
public class WindowsUpdatePostProcessor implements UpdatePostProcessor {
|
||||
private final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(WindowsUpdatePostProcessor.class);
|
||||
protected Router i2pRouter = null;
|
||||
|
||||
public void updateDownloadedandVerified(UpdateType type, int fileType, String version, File file) throws IOException {
|
||||
if (fileType == 6) {
|
||||
newFile = moveUpdateInstaller(file);
|
||||
File newFile = moveUpdateInstaller(file);
|
||||
runUpdateInstaller(newFile);
|
||||
}
|
||||
}
|
||||
|
||||
private File moveUpdateInstaller(File file){
|
||||
RouterContext i2pContext = i2prouter.getRouterContext();
|
||||
RouterContext i2pContext = i2pRouter.getContext();
|
||||
if (i2pContext != null) {
|
||||
File appDir = i2pContext.getAppDir();
|
||||
File newFile = new File(i2pContext.getAppDir().getAbsolutePath(), file.Name());
|
||||
File newFile = new File(i2pContext.getAppDir().getAbsolutePath(), file.getName());
|
||||
file.renameTo(newFile);
|
||||
return newFile;
|
||||
}
|
||||
@ -41,7 +44,7 @@ public class WindowsUpdatePostProcessor implements UpdatePostProcessor {
|
||||
pb.start();
|
||||
} catch (IOException ex) {
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("Unable to loop update-program in background. Update will fail." + xi2plocation);
|
||||
_log.warn("Unable to loop update-program in background. Update will fail.");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user