only: Autoupdate fix with LTS

This commit is contained in:
rusefillc 2024-05-31 21:38:09 -04:00
parent 8f598bf100
commit 57bba559b0
4 changed files with 17 additions and 9 deletions

View File

@ -22,9 +22,11 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
public class Autoupdate {
private static final int VERSION = 20240531;
private static final String LOGO_PATH = "/com/rusefi/";
private static final String LOGO = LOGO_PATH + "logo.png";
private static final String TITLE = "rusEFI Bundle Updater 20240401";
private static final String TITLE = "rusEFI Bundle Updater " + VERSION;
private static final String AUTOUPDATE_MODE = "autoupdate";
private static final String RUSEFI_CONSOLE_JAR = "rusefi_console.jar";
private static final String COM_RUSEFI_LAUNCHER = "com.rusefi.Launcher";
@ -66,9 +68,9 @@ public class Autoupdate {
if (mode != UpdateMode.NEVER) {
System.out.println("Snapshot requested");
if (branchName.equals("snapshot")) {
downloadAndUnzipAutoupdate(bundleInfo, mode, ConnectionAndMeta.getBaseUrl());
downloadAndUnzipAutoupdate(bundleInfo, mode, ConnectionAndMeta.getBaseUrl()+ ConnectionAndMeta.AUTOUPDATE);
} else {
downloadAndUnzipAutoupdate(bundleInfo, mode, String.format(ConnectionAndMeta.BASE_URL_LTS, branchName));
downloadAndUnzipAutoupdate(bundleInfo, mode, ConnectionAndMeta.getBaseUrl() + "/lts/" + branchName + ConnectionAndMeta.AUTOUPDATE);
}
} else {
System.out.println("Update mode: NEVER");

View File

@ -13,8 +13,7 @@ import java.util.Properties;
public class ConnectionAndMeta {
public static final String BASE_URL_RELEASE = "https://github.com/rusefi/rusefi/releases/latest/download/";
private static final String AUTOUPDATE = "/autoupdate/";
public static final String BASE_URL_LTS = "https://rusefi.com/build_server/lts/%s/autoupdate/";
public static final String AUTOUPDATE = "/autoupdate/";
private static final int BUFFER_SIZE = 32 * 1024;
public static final int CENTUM = 100;
@ -39,7 +38,11 @@ public class ConnectionAndMeta {
}
String result = props.getProperty("auto_update_root_url");
System.out.println(ConnectionAndMeta.class + ": got [" + result + "]");
return result + AUTOUPDATE;
return result;
}
public static String getDefaultAutoUpdateUrl() {
return getBaseUrl() + AUTOUPDATE;
}
public static void downloadFile(String localTargetFileName, ConnectionAndMeta connectionAndMeta, DownloadProgressListener listener) throws IOException {

View File

@ -6,7 +6,10 @@ import java.net.URL;
import java.util.concurrent.atomic.AtomicReference;
public interface rusEFIVersion {
int CONSOLE_VERSION = 20240522;
/**
* @see com.rusefi.autoupdate.Autoupdate#VERSION
*/
int CONSOLE_VERSION = 20240531;
AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
static long classBuildTimeMillis() {

View File

@ -77,7 +77,7 @@ public class Updater {
public void run() {
ConnectionAndMeta connectionAndMeta;
try {
connectionAndMeta = new ConnectionAndMeta(PLUGIN_BODY_JAR).invoke(ConnectionAndMeta.getBaseUrl());
connectionAndMeta = new ConnectionAndMeta(PLUGIN_BODY_JAR).invoke(ConnectionAndMeta.getDefaultAutoUpdateUrl());
} catch (Exception e) {
e.printStackTrace();
return;
@ -159,7 +159,7 @@ public class Updater {
});
try {
ConnectionAndMeta connectionAndMeta = new ConnectionAndMeta(PLUGIN_BODY_JAR).invoke(ConnectionAndMeta.getBaseUrl());
ConnectionAndMeta connectionAndMeta = new ConnectionAndMeta(PLUGIN_BODY_JAR).invoke(ConnectionAndMeta.getDefaultAutoUpdateUrl());
AutoupdateUtil.downloadAutoupdateFile(LOCAL_JAR_FILE_NAME, connectionAndMeta,
TITLE);