Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

launchpad: Choose a patch preset file with Other…

zqxwcee1eea00d4a91
diff --git a/Documents/Guides/launchpad-cli.md b/Documents/Guides/launchpad-cli.md
index 68f9dfae..ef991ab2 100644
--- a/Documents/Guides/launchpad-cli.md
+++ b/Documents/Guides/launchpad-cli.md
@@ -116,7 +116,7 @@ version while a machine is bound to it; rebind or delete those machines first.
| `vm list` | Machines in every library with run state, Core Bundle and log path. Only a VM process holding the disk (`vphone-vm`, or Virtualization's VM service) makes a machine `running`; any other process that has it open (`tail`, Spotlight, a backup tool) is listed in `diskOpenIn` (`12925 tail`) and leaves it `stopped` |
| `vm start <name> [--headless] [--wait]` / `vm stop <name>` | Launch with the machine's bundle, or stop; `--wait` waits for vphoned. Stop asks the guest to shut down (vphoned `system.shutdown`) and waits up to 30 s; when the guest cannot be asked or does not stop, it ends the virtual machine as before. Like `vphone-cli vm launch`, start is not refused by a process that only has the disk open; it prints a note naming it |
| `vm wait <name>` / `vm log <name> [--kind create\|dfu\|patch]` | Wait for vphoned; read a console log |
-| `vm create <name> [--bundle <version>] [...] [--device <product-type>] [--preset <preset>] [--ipsw <path>] [--kmutil-ssh <user@host>] [--block <patch>]... [--allow <patch>]... [--no-template \| --slim on\|off --trim … --keep-languages … --service-profile … --remove-apps … --keep-apps … --accounts-off] [--from <step>]` | The New Machine pipeline, bound to `--bundle` or the default: cloned from a template, built first when missing (2.9), or restored on its own with `--no-template`; the slimming switches are `vphone-cli vm create`'s, except that Apple Account goes with the trimmed service profile as in New Machine (`--accounts-off` is accepted and changes nothing). `--block`/`--allow` (repeatable) turn one patch of the preset off or on, as New Machine's patch list and `vphone-cli fw set-patches` do (see below). `--device` makes an iPad guest, or with `AppleTV5,3` an Apple TV HD guest, which is always restored on its own without slimming and takes the `tvos` preset unless `--preset` names another, and with `AppleTV14,1` an Apple TV 4K guest, the same with the `tvos-4k` preset and its userland from the catalog's OTA; `--preset minimal` (Minimal: a stock boot chain, kernel and TXM, with the system customised before the restore) is also restored on its own without slimming, and its `fw patch` runs as root through the helper; the kernelcache mix of a machine whose cloudOS has no vphone600 components (its release's own cloudOS, a watch, an iOS 18 guest) is staged with `fw kernelcache` and linked by the helper as root; `--ipsw` is optional and only passed on to a 2.12.0 bundle, which stages with it, as New Machine's ipsw field (a 2.12.1 bundle extracts natively); `--kmutil-ssh` names the Mac that links an iOS 18 guest's (`--device iPhone11,6`) kernel-first mix over ssh, as New Machine's macOS builder field, and takes the password for ssh and sudo there from the client's `VPHONE_KMUTIL_SSH_PASSWORD`, never from an argument; `--from` retries from a step (`findTemplate` … `firstBoot`) with the options the creation started with; the result names the template, whether this creation built it, and the patches it used |
+| `vm create <name> [--bundle <version>] [...] [--device <product-type>] [--preset <preset>] [--ipsw <path>] [--kmutil-ssh <user@host>] [--block <patch>]... [--allow <patch>]... [--no-template \| --slim on\|off --trim … --keep-languages … --service-profile … --remove-apps … --keep-apps … --accounts-off] [--from <step>]` | The New Machine pipeline, bound to `--bundle` or the default: cloned from a template, built first when missing (2.9), or restored on its own with `--no-template`; the slimming switches are `vphone-cli vm create`'s, except that Apple Account goes with the trimmed service profile as in New Machine (`--accounts-off` is accepted and changes nothing). `--preset` takes a preset name or the path of a preset plist (2.14), which the machine keeps a copy of. `--block`/`--allow` (repeatable) turn one patch of the preset off or on, as New Machine's patch list and `vphone-cli fw set-patches` do (see below). `--device` makes an iPad guest, or with `AppleTV5,3` an Apple TV HD guest, which is always restored on its own without slimming and takes the `tvos` preset unless `--preset` names another, and with `AppleTV14,1` an Apple TV 4K guest, the same with the `tvos-4k` preset and its userland from the catalog's OTA; `--preset minimal` (Minimal: a stock boot chain, kernel and TXM, with the system customised before the restore) is also restored on its own without slimming, and its `fw patch` runs as root through the helper; the kernelcache mix of a machine whose cloudOS has no vphone600 components (its release's own cloudOS, a watch, an iOS 18 guest) is staged with `fw kernelcache` and linked by the helper as root; `--ipsw` is optional and only passed on to a 2.12.0 bundle, which stages with it, as New Machine's ipsw field (a 2.12.1 bundle extracts natively); `--kmutil-ssh` names the Mac that links an iOS 18 guest's (`--device iPhone11,6`) kernel-first mix over ssh, as New Machine's macOS builder field, and takes the password for ssh and sudo there from the client's `VPHONE_KMUTIL_SSH_PASSWORD`, never from an argument; `--from` retries from a step (`findTemplate` … `firstBoot`) with the options the creation started with; the result names the template, whether this creation built it, and the patches it used |
| `vm set-bundle <name> <version> [--update-environment]` | Bind a machine to another installed version. `--update-environment` also redeploys that version's guest environment and needs a stopped machine; a disk another process has open refuses it, naming that process, before the binding changes. If the update itself fails, the machine stays bound to the new version and `vm list` still shows the old `guestEnvironmentBundle`: run `cfw update-environment` to finish |
| `vm leases [--release]` | DHCP leases on the shared NAT network and the machine that owns each. `--release` frees the ones no machine in any library uses, through the helper (see [Networking](networking.md#addresses-held-by-old-macs)) |
| `cfw install <name>` | Install CFW into a stopped machine with its own bundle, through the helper. The helper puts temporary work files on the VM library's external volume when applicable. It and the two updates below refuse a disk another process has open, naming it (`12925 tail`). |
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Control/VPhoneLaunchpadControlCommands.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Control/VPhoneLaunchpadControlCommands.swift
index 00a9bb6c..390c456a 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Control/VPhoneLaunchpadControlCommands.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Control/VPhoneLaunchpadControlCommands.swift
@@ -667,18 +667,26 @@ struct VPhoneLaunchpadControlCommands {
defaultPreset: String,
emit: Emit,
) async throws -> (VPhoneLaunchpadPatchSelection, guest: Set<String>) {
- var selection = VPhoneLaunchpadPatchSelection()
- selection.preset = request.option("preset") ?? defaultPreset
+ let preset = request.option("preset") ?? defaultPreset
+ var selection = VPhoneLaunchpadPatchSelection.isPresetFile(preset)
+ ? VPhoneLaunchpadPatchSelection(presetFile: preset)
+ : VPhoneLaunchpadPatchSelection(preset: preset)
let block = request.values("block")
let allow = request.values("allow")
+ guard !block.isEmpty || !allow.isEmpty || selection.presetFile != nil else {
+ return (selection, [])
+ }
+ // A preset file is read here too: its identifier and whether it
+ // customises the system before the restore come from the bundle.
+ let catalog = try await VPhoneLaunchpadPatchCatalog.read(using: commandLine, machine: nil, preset: selection.presetArgument)
+ selection.adoptFile(from: catalog)
guard !block.isEmpty || !allow.isEmpty else {
return (selection, [])
}
- let catalog = try await VPhoneLaunchpadPatchCatalog.read(using: commandLine, machine: nil, preset: selection.preset)
let overrides: VPhoneLaunchpadPatchOverrides
do {
overrides = try VPhoneLaunchpadPatchOverrides.requested(
- preset: selection.preset,
+ preset: selection.presetArgument,
block: block,
allow: allow,
declared: Set(catalog.patches.map(\.identifier)),
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPipeline.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPipeline.swift
index 8d83657e..0edcb0dc 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPipeline.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPipeline.swift
@@ -113,7 +113,7 @@ final class VPhoneLaunchpadCreationPipeline {
var patchOverrides: VPhoneLaunchpadPatchOverrides {
VPhoneLaunchpadPatchOverrides(
- preset: patches.preset,
+ preset: patches.presetArgument,
blocked: patches.blocked,
allowed: patches.allowed,
guestPatches: guestPatches,
@@ -126,7 +126,7 @@ final class VPhoneLaunchpadCreationPipeline {
iphoneSource: iphoneSource,
cloudOSSource: cloudOSSource,
device: device,
- preset: patches.preset,
+ preset: patches.presetArgument,
blocked: patchOverrides.bootChainBlocked,
allowed: patchOverrides.bootChainAllowed,
diskSizeGB: diskSizeGB,
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineAdvancedView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineAdvancedView.swift
index 064cc380..e32ffbe2 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineAdvancedView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineAdvancedView.swift
@@ -84,6 +84,21 @@ struct VPhoneLaunchpadNewMachineAdvancedView: View {
ForEach(patchCatalog.presets) { preset in
Text(verbatim: preset.displayTitle).tag(preset.identifier)
}
+ Divider()
+ Text("Other…").tag(VPhoneLaunchpadPatchSelection.otherPresetTag)
+ }
+ if let presetFile = patches.presetFile {
+ LabeledContent("Preset File") {
+ Text(verbatim: presetFile)
+ .lineLimit(1)
+ .truncationMode(.middle)
+ .help(presetFile)
+ }
+ }
+ if let patchCatalogError {
+ Label(patchCatalogError, systemImage: "exclamationmark.triangle")
+ .foregroundStyle(.secondary)
+ .textSelection(.enabled)
}
LabeledContent("Patches") {
Button("Patch Settings…") { showsPatchSettings = true }
@@ -144,6 +159,13 @@ struct VPhoneLaunchpadNewMachineAdvancedView: View {
Binding(
get: { patches.preset },
set: { identifier in
+ if identifier == VPhoneLaunchpadPatchSelection.otherPresetTag {
+ VPhoneLaunchpadPresetFilePanel.choose { path in
+ patches = VPhoneLaunchpadPatchSelection(presetFile: path)
+ reloadPatches()
+ }
+ return
+ }
guard identifier != patches.preset else {
return
}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift
index 7316df29..7b74fdf8 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift
@@ -872,7 +872,7 @@ struct VPhoneLaunchpadNewMachineView: View {
/// preset, and each version declares its own patches.
private func loadPatchCatalog() async {
let version = bundleVersion
- let requested = patches.preset
+ let requested = patches.presetArgument
do {
let catalog = try await VPhoneLaunchpadPatchCatalog.read(
using: version.flatMap(model.bundles.commandLine(version:)),
@@ -880,15 +880,24 @@ struct VPhoneLaunchpadNewMachineView: View {
preset: requested,
)
// A second switch may have overtaken this read.
- guard requested == patches.preset, version == bundleVersion else {
+ guard requested == patches.presetArgument, version == bundleVersion else {
return
}
+ patches.adoptFile(from: catalog)
// Overrides naming a patch this version does not declare are dropped.
patches.normalize(against: catalog)
patchCatalog = catalog
patchCatalogError = nil
} catch {
- guard requested == patches.preset, version == bundleVersion else {
+ guard requested == patches.presetArgument, version == bundleVersion else {
+ return
+ }
+ // A preset file the bundle cannot read: back to the device's
+ // preset, saying why.
+ if patches.presetFile != nil {
+ patches = VPhoneLaunchpadPatchSelection(preset: VPhoneLaunchpadPatchSelection.defaultPreset(forDevice: guestProductType))
+ await loadPatchCatalog()
+ patchCatalogError = VPhoneLaunchpadError.message(for: error)
return
}
// The first read after a version change: that version may not
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchCatalog.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchCatalog.swift
index 8820edaa..19398124 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchCatalog.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchCatalog.swift
@@ -12,11 +12,18 @@ nonisolated struct VPhoneLaunchpadPatchCatalog: Decodable, Sendable {
let identifier: String
let title: String
let summary: String
+ let patchSets: [String]?
var id: String {
identifier
}
+ /// Whether it merges the restore image, which only a root `fw patch`
+ /// before the restore does (`com.vphone.patchset.restore.image`).
+ var customisesRestoredSystem: Bool {
+ patchSets?.contains("com.vphone.patchset.restore.image") == true
+ }
+
/// The bundle writes its built-in presets in English. Launchpad
/// translates those two; any other preset shows its own text.
var displayTitle: String {
@@ -308,34 +315,59 @@ nonisolated struct VPhoneLaunchpadPatchSelection: Hashable, Sendable {
}
var preset = defaultPreset
+ /// A preset plist chosen with Other…, passed to `--preset` in place of
+ /// `preset`; `vphone-cli` keeps a copy in the machine. Once the bundle has
+ /// read it, `preset` is the identifier it declares (``adoptFile(from:)``).
+ var presetFile: String?
/// Patches the preset turns on that this VM leaves off.
var blocked: Set<String> = []
/// Patches the preset leaves off that this VM turns on.
var allowed: Set<String> = []
+ /// Whether the file's preset customises the system before the restore,
+ /// from the bundle's catalog.
+ var fileCustomisesRestoredSystem = false
+
+ /// `--preset <file>` for `vphone-cli` 2.14 and later.
+ static func isPresetFile(_ value: String) -> Bool {
+ value.contains("/") || value.hasSuffix(".plist")
+ }
var hasOverrides: Bool {
!blocked.isEmpty || !allowed.isEmpty
}
var isDefault: Bool {
- preset == Self.defaultPreset && !hasOverrides
+ presetFile == nil && preset == Self.defaultPreset && !hasOverrides
+ }
+
+ /// What `--preset` is given: the file, else the preset's identifier.
+ var presetArgument: String {
+ presetFile ?? preset
}
/// `fw set-patches` arguments, without the VM name or library root. Each run
/// writes the whole record, so an empty list clears that half of it.
var setPatchesArguments: [String] {
- ["--preset", preset]
+ ["--preset", presetArgument]
+ blocked.sorted().flatMap { ["--block", $0] }
+ allowed.sorted().flatMap { ["--allow", $0] }
}
- /// The `--preset` flag `fw patch` and `fw patches` carry, if any.
var customisesRestoredSystem: Bool {
- preset == Self.minimalPreset || preset == Self.watchOSPreset
+ presetFile != nil ? fileCustomisesRestoredSystem : preset == Self.minimalPreset || preset == Self.watchOSPreset
}
+ /// The `--preset` flag `fw patch` and `fw patches` carry, if any.
var presetArguments: [String] {
- preset == Self.defaultPreset ? [] : ["--preset", preset]
+ presetFile == nil && preset == Self.defaultPreset ? [] : ["--preset", presetArgument]
+ }
+
+ /// Takes what the bundle read from ``presetFile``: the identifier it
+ /// declares, and whether it customises the system before the restore.
+ mutating func adoptFile(from catalog: VPhoneLaunchpadPatchCatalog) {
+ guard presetFile != nil else { return }
+ preset = catalog.activePreset
+ fileCustomisesRestoredSystem = catalog.preset(catalog.activePreset)?.customisesRestoredSystem ?? false
}
func isOn(_ patch: VPhoneLaunchpadPatchCatalog.Patch) -> Bool {
@@ -373,6 +405,17 @@ nonisolated struct VPhoneLaunchpadPatchSelection: Hashable, Sendable {
}
/// So the inspector can present the editor with the choice it opens on.
+extension VPhoneLaunchpadPatchSelection {
+ /// The preset pickers' Other… item, which chooses a preset plist.
+ static let otherPresetTag = "\u{1}other"
+
+ /// A preset plist, with no overrides. `preset` holds the path until the
+ /// bundle has read the file.
+ init(presetFile: String) {
+ self.init(preset: presetFile, presetFile: presetFile)
+ }
+}
+
extension VPhoneLaunchpadPatchSelection: Identifiable {
var id: Self {
self
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchSettingsView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchSettingsView.swift
index 8f2519ee..87110030 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchSettingsView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchSettingsView.swift
@@ -45,6 +45,8 @@ struct VPhoneLaunchpadPatchSettingsView: View {
/// The selected rows; the detail pane reads the summary of one.
@State private var highlighted: Set<String> = []
@State private var confirmsBootEssential = false
+ /// Why the preset file chosen with Other… could not be read.
+ @State private var presetFileError: String?
/// What was on when the editor opened, so the status line can count what
/// an edit to an existing machine changes. Taken from the first read.
@State private var initiallyOn: Set<String>?
@@ -114,7 +116,15 @@ struct VPhoneLaunchpadPatchSettingsView: View {
} message: {
Text("The machine may not boot without \(essentialOff.map(\.identifier).joined(separator: ", ")).")
}
- .task { await load(preset: initial.preset) }
+ .alert(
+ "Unable to Use This Preset File",
+ isPresented: Binding(get: { presetFileError != nil }, set: { if !$0 { presetFileError = nil } }),
+ ) {
+ Button("OK") { presetFileError = nil }
+ } message: {
+ Text(verbatim: presetFileError ?? "")
+ }
+ .task { await load(preset: initial.presetArgument) }
}
// MARK: - Preset
@@ -127,6 +137,8 @@ struct VPhoneLaunchpadPatchSettingsView: View {
ForEach(catalog?.presets ?? []) { preset in
Text(verbatim: preset.displayTitle).tag(preset.identifier)
}
+ Divider()
+ Text("Other…").tag(VPhoneLaunchpadPatchSelection.otherPresetTag)
}
.fixedSize()
.disabled(catalog == nil || isLoading || isReadOnly)
@@ -149,6 +161,20 @@ struct VPhoneLaunchpadPatchSettingsView: View {
Binding(
get: { selection.preset },
set: { identifier in
+ if identifier == VPhoneLaunchpadPatchSelection.otherPresetTag {
+ VPhoneLaunchpadPresetFilePanel.choose { path in
+ let previous = selection
+ selection = VPhoneLaunchpadPatchSelection(presetFile: path)
+ Task {
+ // A file the bundle cannot read leaves the choice as it was.
+ if let error = await load(preset: path, showsError: false), selection.presetFile == path {
+ selection = previous
+ presetFileError = error
+ }
+ }
+ }
+ return
+ }
guard identifier != selection.preset else {
return
}
@@ -338,7 +364,10 @@ struct VPhoneLaunchpadPatchSettingsView: View {
// MARK: - Actions
- private func load(preset: String) async {
+ /// Returns why the read failed. `showsError` false leaves that to the
+ /// caller instead of replacing the list with it.
+ @discardableResult
+ private func load(preset: String, showsError: Bool = true) async -> String? {
isLoading = true
defer { isLoading = false }
do {
@@ -348,10 +377,14 @@ struct VPhoneLaunchpadPatchSettingsView: View {
preset: preset,
)
// A second switch of the picker may have overtaken this read.
- guard preset == selection.preset else {
- return
+ guard preset == selection.presetArgument else {
+ return nil
+ }
+ if selection.presetFile != nil {
+ selection.adoptFile(from: catalog)
+ } else {
+ selection.preset = catalog.activePreset
}
- selection.preset = catalog.activePreset
selection.normalize(against: catalog)
if initiallyOn == nil {
initiallyOn = Set(catalog.patches.filter { selection.isOn($0) }.map(\.identifier))
@@ -363,8 +396,13 @@ struct VPhoneLaunchpadPatchSettingsView: View {
highlighted = [first.identifier]
}
loadError = nil
+ return nil
} catch {
- loadError = VPhoneLaunchpadError.message(for: error)
+ let message = VPhoneLaunchpadError.message(for: error)
+ if showsError {
+ loadError = message
+ }
+ return message
}
}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPresetFilePanel.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPresetFilePanel.swift
new file mode 100644
index 00000000..54b6a2ce
--- /dev/null
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPresetFilePanel.swift
@@ -0,0 +1,17 @@
+import AppKit
+import UniformTypeIdentifiers
+
+/// The preset pickers' Other…: a preset plist, which `vphone-cli` reads as it
+/// reads a named preset and keeps a copy of in the machine.
+@MainActor
+enum VPhoneLaunchpadPresetFilePanel {
+ static func choose(_ choose: @escaping @MainActor (String) -> Void) {
+ let panel = NSOpenPanel()
+ panel.canChooseDirectories = false
+ panel.allowedContentTypes = [.propertyList]
+ panel.message = String(localized: "Choose a patch preset plist.")
+ panel.present { url in
+ choose(url.path)
+ }
+ }
+}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadControl.swift b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadControl.swift
index b7e7675d..4d52ac0b 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadControl.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadControl.swift
@@ -184,7 +184,7 @@ nonisolated struct VPhoneLaunchpadControlCommand: Sendable {
"root", "bundle", "iphone-source", "cloudos-source", "device", "cpu", "memory", "disk-size", "network", "preset", "from", "ipsw", "kmutil-ssh",
"slim", "trim", "keep-languages", "service-profile", "remove-apps", "keep-apps",
], flags: ["keep-artifacts", "no-wait", "no-template", "accounts-off"], repeated: ["block", "allow"],
- summary: "Create a machine through every step, as New Machine does, bound to --bundle (default: the default bundle): cloned from a template, built first when missing, or restored on its own with --no-template. --block and --allow turn one patch of --preset off or on, as New Machine's patch list and vphone-cli fw set-patches do: boot-chain ones go into the template, guest ones are applied to the clone. --slim, --trim, --keep-languages, --service-profile, --remove-apps, --keep-apps and --accounts-off shape the template, as in vphone-cli vm create. --ipsw <path> is the ipsw a 2.12.0 bundle stages a kernelcache mix with, as New Machine's ipsw field; a 2.12.1 bundle extracts natively and needs none. --kmutil-ssh <user@host> links an iOS 18 guest's kernel-first mix on that Mac over ssh, as New Machine's macOS builder field, with the password (for ssh and sudo there) from this tool's VPHONE_KMUTIL_SSH_PASSWORD. --from <step> retries a failed creation from that step, with the options it started with."),
+ summary: "Create a machine through every step, as New Machine does, bound to --bundle (default: the default bundle): cloned from a template, built first when missing, or restored on its own with --no-template. --preset takes a preset name or the path of a preset plist. --block and --allow turn one patch of --preset off or on, as New Machine's patch list and vphone-cli fw set-patches do: boot-chain ones go into the template, guest ones are applied to the clone. --slim, --trim, --keep-languages, --service-profile, --remove-apps, --keep-apps and --accounts-off shape the template, as in vphone-cli vm create. --ipsw <path> is the ipsw a 2.12.0 bundle stages a kernelcache mix with, as New Machine's ipsw field; a 2.12.1 bundle extracts natively and needs none. --kmutil-ssh <user@host> links an iOS 18 guest's kernel-first mix on that Mac over ssh, as New Machine's macOS builder field, with the password (for ssh and sudo there) from this tool's VPHONE_KMUTIL_SSH_PASSWORD. --from <step> retries a failed creation from that step, with the options it started with."),
Self(name: "vm.set-bundle", arguments: ["name", "version"], options: ["root"], flags: ["update-environment"],
summary: "Bind a machine to another installed version; its host programs change at the next start. --update-environment also redeploys that version's guest environment into the stopped machine. The boot chain stays as created."),
Self(name: "vm.leases", arguments: [], options: [], flags: ["release"],
@@ -325,6 +325,10 @@ extension VPhoneLaunchpadControlRequest {
if let root = request.options["root"] {
request.options["root"] = URL(fileURLWithPath: root).standardizedFileURL.path
}
+ // A preset file, as `VPhoneLaunchpadPatchSelection.isPresetFile` tells it from a name.
+ if let preset = request.options["preset"], preset.contains("/") || preset.hasSuffix(".plist") {
+ request.options["preset"] = URL(fileURLWithPath: (preset as NSString).expandingTildeInPath).standardizedFileURL.path
+ }
request.arguments = positional
if !repeated.isEmpty {
request.repeated = repeated