mirror of
https://github.com/ninxsoft/Mist.git
synced 2025-05-19 01:35:24 -04:00
Fix support for legacy bootable installers
This commit is contained in:
parent
d2fb207499
commit
26b84e29c7
2 changed files with 13 additions and 6 deletions
|
@ -14,12 +14,19 @@ struct InstallMediaCreator {
|
||||||
/// Create the macOS Install Media at the specified mount point.
|
/// Create the macOS Install Media at the specified mount point.
|
||||||
///
|
///
|
||||||
/// - Parameters:
|
/// - Parameters:
|
||||||
/// - url: The URL of the `createinstallmedia` binary to execute.
|
/// - url: The URL of the `createinstallmedia` binary to execute.
|
||||||
/// - mountPoint: The URL of the mount point (target volume).
|
/// - mountPoint: The URL of the mount point (target volume).
|
||||||
|
/// - sierraOrOlder: `true` if the installer is macOS Sierra or older, otherwise `false`.
|
||||||
///
|
///
|
||||||
/// - Throws: An `Error` if the command failed to execute.
|
/// - Throws: An `Error` if the command failed to execute.
|
||||||
static func create(_ url: URL, mountPoint: URL) async throws {
|
static func create(_ url: URL, mountPoint: URL, sierraOrOlder: Bool) async throws {
|
||||||
let arguments: [String] = [url.path, "--volume", mountPoint.path, "--nointeraction"]
|
var arguments: [String] = [url.path, "--volume", mountPoint.path, "--nointeraction"]
|
||||||
|
|
||||||
|
if sierraOrOlder {
|
||||||
|
let applicationPath: String = url.deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent().path
|
||||||
|
arguments += ["--applicationpath", applicationPath]
|
||||||
|
}
|
||||||
|
|
||||||
let client: XPCClient = XPCClient.forMachService(named: .helperIdentifier)
|
let client: XPCClient = XPCClient.forMachService(named: .helperIdentifier)
|
||||||
let request: HelperToolCommandRequest = HelperToolCommandRequest(type: .createinstallmedia, arguments: arguments, environment: [:])
|
let request: HelperToolCommandRequest = HelperToolCommandRequest(type: .createinstallmedia, arguments: arguments, environment: [:])
|
||||||
let response: HelperToolCommandResponse = try await client.sendMessage(request, to: XPCRoute.commandRoute)
|
let response: HelperToolCommandResponse = try await client.sendMessage(request, to: XPCRoute.commandRoute)
|
||||||
|
|
|
@ -441,7 +441,7 @@ class TaskManager: ObservableObject {
|
||||||
try await DiskImageMounter.mount(temporaryImageURL, mountPoint: installer.temporaryISOMountPointURL)
|
try await DiskImageMounter.mount(temporaryImageURL, mountPoint: installer.temporaryISOMountPointURL)
|
||||||
},
|
},
|
||||||
MistTask(type: .create, description: "macOS Installer in temporary Disk Image") {
|
MistTask(type: .create, description: "macOS Installer in temporary Disk Image") {
|
||||||
try await InstallMediaCreator.create(createInstallMediaURL, mountPoint: installer.temporaryISOMountPointURL)
|
try await InstallMediaCreator.create(createInstallMediaURL, mountPoint: installer.temporaryISOMountPointURL, sierraOrOlder: installer.sierraOrOlder)
|
||||||
},
|
},
|
||||||
MistTask(type: .unmount, description: "temporary Disk Image") {
|
MistTask(type: .unmount, description: "temporary Disk Image") {
|
||||||
if FileManager.default.fileExists(atPath: installer.temporaryISOMountPointURL.path) {
|
if FileManager.default.fileExists(atPath: installer.temporaryISOMountPointURL.path) {
|
||||||
|
@ -513,7 +513,7 @@ class TaskManager: ObservableObject {
|
||||||
let mountPointURL: URL = URL(fileURLWithPath: volume.path)
|
let mountPointURL: URL = URL(fileURLWithPath: volume.path)
|
||||||
let tasks: [MistTask] = [
|
let tasks: [MistTask] = [
|
||||||
MistTask(type: .create, description: "Bootable Installer") {
|
MistTask(type: .create, description: "Bootable Installer") {
|
||||||
try await InstallMediaCreator.create(createInstallMediaURL, mountPoint: mountPointURL)
|
try await InstallMediaCreator.create(createInstallMediaURL, mountPoint: mountPointURL, sierraOrOlder: installer.sierraOrOlder)
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue