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

View File

@ -13,8 +13,7 @@ import java.util.Properties;
public class ConnectionAndMeta { public class ConnectionAndMeta {
public static final String BASE_URL_RELEASE = "https://github.com/rusefi/rusefi/releases/latest/download/"; 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 AUTOUPDATE = "/autoupdate/";
public static final String BASE_URL_LTS = "https://rusefi.com/build_server/lts/%s/autoupdate/";
private static final int BUFFER_SIZE = 32 * 1024; private static final int BUFFER_SIZE = 32 * 1024;
public static final int CENTUM = 100; public static final int CENTUM = 100;
@ -39,7 +38,11 @@ public class ConnectionAndMeta {
} }
String result = props.getProperty("auto_update_root_url"); String result = props.getProperty("auto_update_root_url");
System.out.println(ConnectionAndMeta.class + ": got [" + result + "]"); 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 { 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; import java.util.concurrent.atomic.AtomicReference;
public interface rusEFIVersion { public interface rusEFIVersion {
int CONSOLE_VERSION = 20240522; /**
* @see com.rusefi.autoupdate.Autoupdate#VERSION
*/
int CONSOLE_VERSION = 20240531;
AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A"); AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
static long classBuildTimeMillis() { static long classBuildTimeMillis() {

View File

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