Skip to content

Commit

Permalink
config(qemu): fix UEFI check when option is disabled
Browse files Browse the repository at this point in the history
Fixes #4265
  • Loading branch information
osy committed Aug 6, 2022
1 parent 44f746a commit 4b90a44
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions Configuration/UTMQemuConfigurationQEMU.swift
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ extension UTMQemuConfigurationQEMU {

extension UTMQemuConfigurationQEMU {
@MainActor mutating func saveData(to dataURL: URL, for system: UTMQemuConfigurationSystem) async throws -> [URL] {
guard hasUefiBoot else {
return []
}
let fileManager = FileManager.default
// save EFI variables
let resourceURL = Bundle.main.url(forResource: "qemu", withExtension: nil)!
Expand All @@ -172,16 +175,13 @@ extension UTMQemuConfigurationQEMU {
} else {
throw UTMQemuConfigurationError.uefiNotSupported
}
if hasUefiBoot {
let varsURL = dataURL.appendingPathComponent(QEMUPackageFileName.efiVariables.rawValue)
if !fileManager.fileExists(atPath: varsURL.path) {
try await Task.detached {
try fileManager.copyItem(at: templateVarsURL, to: varsURL)
}.value
}
efiVarsURL = varsURL
return [varsURL]
let varsURL = dataURL.appendingPathComponent(QEMUPackageFileName.efiVariables.rawValue)
if !fileManager.fileExists(atPath: varsURL.path) {
try await Task.detached {
try fileManager.copyItem(at: templateVarsURL, to: varsURL)
}.value
}
return []
efiVarsURL = varsURL
return [varsURL]
}
}

0 comments on commit 4b90a44

Please sign in to comment.