Desktop installer: release channel, saved choices, robust delete, logs
- Channel radio (Release / Master (Instabil)); master installs the rolling 'master' release from OmniNX/OmniNX-Master. Preselected from release_channel in the card's manifest.ini. - Variant, RAM (8gb) and Hekate-Pro choice are prefilled from the card (manifest.ini / config.ini) like the payload does, instead of silently switching users back to 4 GB / Standard. - Clear read-only attributes before deleting folders. - Remove leftover "OmniNX <Variant>" pack folders after installing. - Create empty folders from the pack. - Save every run's log to %LocalAppData%\OmniNX-Desktop-Installer\logs, plus a "Save log" button.
This commit is contained in:
1 parent
3e0d9c9950
commit
91133f7098
6 files changed
+207
-9
No files matched your search
@@ -17,9 +17,15 @@ public sealed class GiteaClient
|
||||
_baseUrl = (baseUrl ?? DefaultBaseUrl).TrimEnd('/');
|
||||
}
|
||||
|
||||
public async Task<ReleaseInfo> GetLatestReleaseAsync(CancellationToken cancellationToken = default)
|
||||
// Master builds: rolling release "master" in OmniNX/OmniNX-Master (built from main by CI).
|
||||
private const string MasterReleasePath = "/api/v1/repos/OmniNX/OmniNX-Master/releases/tags/master";
|
||||
private const string StableReleasePath = "/api/v1/repos/OmniNX/OmniNX/releases/latest";
|
||||
|
||||
public async Task<ReleaseInfo> GetLatestReleaseAsync(
|
||||
ReleaseChannel channel = ReleaseChannel.Release,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
var url = $"{_baseUrl}/api/v1/repos/OmniNX/OmniNX/releases/latest";
|
||||
var url = _baseUrl + (channel == ReleaseChannel.Master ? MasterReleasePath : StableReleasePath);
|
||||
var response = await _http.GetFromJsonAsync<GiteaReleaseDto>(url, cancellationToken)
|
||||
?? throw new InvalidOperationException("Empty release response from Gitea.");
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@ public sealed class InstallEngine
|
||||
await RunCleanAsync(driveRoot, staging, options, progress, cancellationToken);
|
||||
}
|
||||
|
||||
await Task.Run(() => RemovePackFoldersOnDrive(driveRoot, progress), cancellationToken);
|
||||
|
||||
Report(progress, options.Mode == InstallMode.Update
|
||||
? "Update completed successfully."
|
||||
: "Installation completed successfully.");
|
||||
@@ -177,6 +179,29 @@ public sealed class InstallEngine
|
||||
}
|
||||
}
|
||||
|
||||
// Same as the payload: pack folders copied to the card for the console installer
|
||||
// ("OmniNX Light/Standard/OC") are not needed after a desktop install.
|
||||
private static void RemovePackFoldersOnDrive(string driveRoot, IProgress<InstallProgressReport> progress)
|
||||
{
|
||||
foreach (var variant in new[] { OmniNxVariant.Light, OmniNxVariant.Standard, OmniNxVariant.Oc })
|
||||
{
|
||||
var folder = VariantHelper.GetStagingFolderName(variant);
|
||||
var path = Path.Combine(PathUtils.NormalizeDriveRoot(driveRoot), folder);
|
||||
if (!Directory.Exists(path))
|
||||
continue;
|
||||
|
||||
Report(progress, $"Removing leftover pack folder: {folder}");
|
||||
try
|
||||
{
|
||||
PathUtils.DeletePath(path);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Report(progress, $" Could not remove {folder}: {ex.Message}", isError: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void Report(IProgress<InstallProgressReport> progress, string message, bool isError = false)
|
||||
{
|
||||
progress.Report(new InstallProgressReport { Message = message, IsError = isError });
|
||||
|
||||
@@ -91,6 +91,11 @@ public static class PathUtils
|
||||
if (!Directory.Exists(src))
|
||||
return;
|
||||
|
||||
// Folders first, so empty folders from the pack exist on the SD as well.
|
||||
Directory.CreateDirectory(dst);
|
||||
foreach (var dir in Directory.GetDirectories(src, "*", SearchOption.AllDirectories))
|
||||
Directory.CreateDirectory(Path.Combine(dst, Path.GetRelativePath(src, dir)));
|
||||
|
||||
var files = Directory.GetFiles(src, "*", SearchOption.AllDirectories);
|
||||
var total = files.Length;
|
||||
var current = 0;
|
||||
@@ -115,7 +120,19 @@ public static class PathUtils
|
||||
}
|
||||
|
||||
if (Directory.Exists(path))
|
||||
Directory.Delete(path, recursive: true);
|
||||
{
|
||||
// Directory.Delete fails on read-only entries (common on cards from other packs or macOS).
|
||||
var root = new DirectoryInfo(path);
|
||||
foreach (var entry in root.EnumerateFileSystemInfos("*", SearchOption.AllDirectories))
|
||||
{
|
||||
if (entry.Attributes.HasFlag(FileAttributes.ReadOnly))
|
||||
entry.Attributes &= ~FileAttributes.ReadOnly;
|
||||
}
|
||||
if (root.Attributes.HasFlag(FileAttributes.ReadOnly))
|
||||
root.Attributes &= ~FileAttributes.ReadOnly;
|
||||
|
||||
root.Delete(recursive: true);
|
||||
}
|
||||
}
|
||||
|
||||
public static int CountItemsRecursive(string path)
|
||||
|
||||
@@ -14,6 +14,7 @@ public sealed class VersionDetectService
|
||||
|
||||
var variant = OmniNxVariant.None;
|
||||
var version = string.Empty;
|
||||
var channel = ReleaseChannel.Release;
|
||||
var inSection = false;
|
||||
|
||||
foreach (var rawLine in File.ReadLines(manifest))
|
||||
@@ -36,6 +37,10 @@ public sealed class VersionDetectService
|
||||
variant = VariantHelper.ParsePackName(val);
|
||||
else if (key.Equals("version", StringComparison.Ordinal))
|
||||
version = val;
|
||||
else if (key.Equals("release_channel", StringComparison.Ordinal))
|
||||
channel = val.Equals("master", StringComparison.OrdinalIgnoreCase)
|
||||
? ReleaseChannel.Master
|
||||
: ReleaseChannel.Release;
|
||||
}
|
||||
|
||||
return new OmniNxStatus
|
||||
@@ -43,6 +48,7 @@ public sealed class VersionDetectService
|
||||
IsInstalled = variant != OmniNxVariant.None,
|
||||
Variant = variant,
|
||||
Version = version,
|
||||
Channel = channel,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user