split display version from core version and check for beta block in update payload

auto-update
Zlatin Balevsky 2022-02-21 06:08:40 +00:00
parent 4a23b7ea8b
commit 3a96fa9606
No known key found for this signature in database
GPG Key ID: A72832072D525E41
3 changed files with 39 additions and 3 deletions

View File

@ -152,8 +152,31 @@ class UpdateClient {
} }
if (VersionComparator.comp(myVersion, payload.version) >= 0) { if (VersionComparator.comp(myVersion, payload.version) >= 0) {
log.info("no new version available")
return String beta = System.getProperty("beta")
if (beta == null) {
log.info("no new version available")
return
}
if (payload.beta == null) {
log.warning("no beta field in update payload")
return
}
payload = payload.beta
if (payload.version == null) {
log.warning("version missing in beta payload")
}
int myBeta = Integer.parseInt(beta)
int updateBeta = Integer.parseInt(payload.version)
if (myBeta >= updateBeta) {
log.info("no new beta version available")
return
}
} }
String infoHash String infoHash

View File

@ -39,6 +39,10 @@ class Ready extends AbstractLifecycleHandler {
@Override @Override
void execute() { void execute() {
log.info "starting core services" log.info "starting core services"
String beta = metadata["application.beta"]
if (beta != null && beta != "0")
System.setProperty("beta", beta)
def home = new File(application.getContext().getAsString("muwire-home")) def home = new File(application.getContext().getAsString("muwire-home"))
def props = new Properties() def props = new Properties()
@ -103,7 +107,7 @@ class Ready extends AbstractLifecycleHandler {
Core core Core core
try { try {
core = new Core(props, home, metadata["application.version"]) core = new Core(props, home, metadata["application.coreVversion"])
Runtime.getRuntime().addShutdownHook({ Runtime.getRuntime().addShutdownHook({
core.shutdown() core.shutdown()
}) })

View File

@ -1,6 +1,15 @@
application.name=MuWire application.name=MuWire
# this version is for display purposes only
application.version=0.8.12 application.version=0.8.12
# set this to 0 if this is not a beta
application.beta=2 application.beta=2
# this is the version the core gets initialized with
application.coreVersion=0.8.11
build.date=${build_date} build.date=${build_date}
build.time=${build_time} build.time=${build_time}
build.revision=${build_revision} build.revision=${build_revision}