From 50070eef1fe94ac11e3cedc5f632f756c8ecb6e9 Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Mon, 30 Oct 2023 13:14:01 -0700 Subject: [PATCH 1/2] add logic to compare os version and package version and download appropriate mpak --- source/Meadow.Core/Update/UpdateService.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/Meadow.Core/Update/UpdateService.cs b/source/Meadow.Core/Update/UpdateService.cs index 9e1efbf8..6c1b93e0 100644 --- a/source/Meadow.Core/Update/UpdateService.cs +++ b/source/Meadow.Core/Update/UpdateService.cs @@ -431,7 +431,14 @@ public void RetrieveUpdate(UpdateInfo updateInfo) private async Task DownloadProc(UpdateMessage message) { + Resolver.Log.Trace($"Device OS Version: {Resolver.Device.PlatformOS.OSVersion}, Update OS Version: {message.OsVersion}"); + var destination = message.MpakDownloadUrl; + + if (Resolver.Device.PlatformOS.OSVersion != message.OsVersion) + { + destination = message.MpakWithOsDownloadUrl; + } if (!destination.StartsWith("http")) { From 9a6952ead3be2723167761068be6ccdb1d5b46ff Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Mon, 30 Oct 2023 13:21:24 -0700 Subject: [PATCH 2/2] add empty check --- source/Meadow.Core/Update/UpdateService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/Meadow.Core/Update/UpdateService.cs b/source/Meadow.Core/Update/UpdateService.cs index 6c1b93e0..cf915dd0 100644 --- a/source/Meadow.Core/Update/UpdateService.cs +++ b/source/Meadow.Core/Update/UpdateService.cs @@ -435,7 +435,8 @@ private async Task DownloadProc(UpdateMessage message) var destination = message.MpakDownloadUrl; - if (Resolver.Device.PlatformOS.OSVersion != message.OsVersion) + if (!string.IsNullOrEmpty(message.OsVersion) + && Resolver.Device.PlatformOS.OSVersion != message.OsVersion) { destination = message.MpakWithOsDownloadUrl; }