Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Clone with a new identity and keep disk snapshots in Launchpad

Jackyd898718e8a18
diff --git a/Documents/Downloads/README.md b/Documents/Downloads/README.md
index e4a11102..2992b4ba 100644
--- a/Documents/Downloads/README.md
+++ b/Documents/Downloads/README.md
@@ -30,6 +30,7 @@ Use a `VPhone.bundle` from the same series as Launchpad. The series is the first
| Launchpad | VPhone.bundle |
| --- | --- |
+| 2.7.x | 2.7.x |
| 2.6.x | 2.6.x |
| 2.5.x | 2.5.x |
| 2.4.x | 2.4.x |
diff --git a/VPhoneExecutable/VPhoneVirtualization/Resources/Info.plist b/VPhoneExecutable/VPhoneVirtualization/Resources/Info.plist
index 0baa1ca1..3dd181fc 100644
--- a/VPhoneExecutable/VPhoneVirtualization/Resources/Info.plist
+++ b/VPhoneExecutable/VPhoneVirtualization/Resources/Info.plist
@@ -11,7 +11,7 @@
<key>CFBundleVersion</key>
<string>33</string>
<key>CFBundleShortVersionString</key>
- <string>2.6.1</string>
+ <string>2.7.0</string>
<key>NSMicrophoneUsageDescription</key>
<string>Shares this Mac's microphone with the virtual iPhone so apps running inside it can record.</string>
</dict>
diff --git a/VPhoneLaunchpad/Configuration/Version.xcconfig b/VPhoneLaunchpad/Configuration/Version.xcconfig
index cbab6793..a159028d 100644
--- a/VPhoneLaunchpad/Configuration/Version.xcconfig
+++ b/VPhoneLaunchpad/Configuration/Version.xcconfig
@@ -1,4 +1,4 @@
-MARKETING_VERSION = 2.6.0
+MARKETING_VERSION = 2.7.0
// Bump whenever the helper changes. The app blesses the helper again when the
// installed helper's version or bytes differ from the copy it embeds.
CURRENT_PROJECT_VERSION = 13
diff --git a/VPhoneLaunchpad/Tests/BundleNamesTests.swift b/VPhoneLaunchpad/Tests/BundleNamesTests.swift
index 38960f1b..c9d1a738 100644
--- a/VPhoneLaunchpad/Tests/BundleNamesTests.swift
+++ b/VPhoneLaunchpad/Tests/BundleNamesTests.swift
@@ -17,14 +17,14 @@ struct BundleNamesTests {
// `-local` (legacy), `-local.<8+ lowercase hex>` or `-ci.<7+ hex>`.
// Anything else is kept whole, so it never parses as a version.
let expectations: [Expectation] = [
- Expectation(name: "2.6.2", bundleVersion: "2.6.2", isLocalBuild: false, isCompatible: true, isValid: true),
- Expectation(name: "2.6.2-local", bundleVersion: "2.6.2", isLocalBuild: true, isCompatible: true, isValid: true),
- Expectation(name: "2.6.2-local.ab12cd34", bundleVersion: "2.6.2", isLocalBuild: true, isCompatible: true, isValid: true),
+ Expectation(name: "2.7.2", bundleVersion: "2.7.2", isLocalBuild: false, isCompatible: true, isValid: true),
+ Expectation(name: "2.7.2-local", bundleVersion: "2.7.2", isLocalBuild: true, isCompatible: true, isValid: true),
+ Expectation(name: "2.7.2-local.ab12cd34", bundleVersion: "2.7.2", isLocalBuild: true, isCompatible: true, isValid: true),
// The build identifier is lowercase hex; uppercase is no build.
- Expectation(name: "2.6.2-local.AB12CD34", bundleVersion: "2.6.2-local.AB12CD34", isLocalBuild: false, isCompatible: false, isValid: true),
- Expectation(name: "2.6.2-local.ab12", bundleVersion: "2.6.2-local.ab12", isLocalBuild: false, isCompatible: false, isValid: true),
- Expectation(name: "2.6.2-ci.abcdef1", bundleVersion: "2.6.2", isLocalBuild: false, isCompatible: true, isValid: true),
- Expectation(name: "2.5.9-local.ab12cd34", bundleVersion: "2.5.9", isLocalBuild: true, isCompatible: false, isValid: true),
+ Expectation(name: "2.7.2-local.AB12CD34", bundleVersion: "2.7.2-local.AB12CD34", isLocalBuild: false, isCompatible: false, isValid: true),
+ Expectation(name: "2.7.2-local.ab12", bundleVersion: "2.7.2-local.ab12", isLocalBuild: false, isCompatible: false, isValid: true),
+ Expectation(name: "2.7.2-ci.abcdef1", bundleVersion: "2.7.2", isLocalBuild: false, isCompatible: true, isValid: true),
+ Expectation(name: "2.6.9-local.ab12cd34", bundleVersion: "2.6.9", isLocalBuild: true, isCompatible: false, isValid: true),
Expectation(name: "../x", bundleVersion: "../x", isLocalBuild: false, isCompatible: false, isValid: false),
Expectation(name: "", bundleVersion: "", isLocalBuild: false, isCompatible: false, isValid: false),
]
diff --git a/VPhoneLaunchpad/Tests/MachineSnapshotsTests.sh b/VPhoneLaunchpad/Tests/MachineSnapshotsTests.sh
new file mode 100755
index 00000000..fc6475f4
--- /dev/null
+++ b/VPhoneLaunchpad/Tests/MachineSnapshotsTests.sh
@@ -0,0 +1,20 @@
+#!/bin/zsh
+set -euo pipefail
+
+launchpad="${0:a:h:h}"
+temporary="$(/usr/bin/mktemp -d)"
+trap '/bin/rm -rf "$temporary"' EXIT
+
+/usr/bin/xcrun swiftc -swift-version 6 -strict-concurrency=complete \
+ -parse-as-library \
+ "$launchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swift" \
+ "$launchpad/VPhoneLaunchpadShared/VPhoneLaunchpadLineReader.swift" \
+ "$launchpad/VPhoneLaunchpadShared/VPhoneLaunchpadLauncherPolicy.swift" \
+ "$launchpad/VPhoneLaunchpad/Command/VPhoneLaunchpadChildProcess.swift" \
+ "$launchpad/VPhoneLaunchpad/Command/VPhoneLaunchpadCommandLine.swift" \
+ "$launchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachine.swift" \
+ "$launchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineBinding.swift" \
+ "$launchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineSnapshot.swift" \
+ "$launchpad/Tests/MachineSnapshotsTests.swift" \
+ -o "$temporary/machine-snapshots-tests"
+"$temporary/machine-snapshots-tests" "$@"
diff --git a/VPhoneLaunchpad/Tests/MachineSnapshotsTests.swift b/VPhoneLaunchpad/Tests/MachineSnapshotsTests.swift
new file mode 100644
index 00000000..febd4d7a
--- /dev/null
+++ b/VPhoneLaunchpad/Tests/MachineSnapshotsTests.swift
@@ -0,0 +1,147 @@
+import Foundation
+
+@main
+struct MachineSnapshotsTests {
+ static func main() throws {
+ try snapshotList()
+ defaultNames()
+ arguments()
+ try bindingSidecar()
+ }
+
+ // MARK: - vm snapshot list --json
+
+ static func snapshotList() throws {
+ // The shape `vm snapshot list --json` prints: one line, keys sorted,
+ // `.iso8601` dates, no `note` when there is none.
+ let json = #"[{"created":"2026-10-06T14:30:00Z","name":"fresh","note":"before frida"},{"created":"2026-10-06T15:00:00Z","name":"second"}]"#
+ let snapshots = try VPhoneLaunchpadMachineSnapshot.list(from: Data(json.utf8))
+ precondition(snapshots.map(\.name) == ["fresh", "second"], "The list keeps the CLI's order")
+ precondition(snapshots[0].note == "before frida", "A note is read")
+ precondition(snapshots[1].note == nil, "A missing note is nil")
+ precondition(snapshots[0].created == Date(timeIntervalSince1970: 1_791_297_000), "created is \(snapshots[0].created)")
+ precondition(snapshots[0].id == "fresh", "A snapshot is identified by its name")
+
+ let empty = try VPhoneLaunchpadMachineSnapshot.list(from: Data("[]".utf8))
+ precondition(empty.isEmpty, "An empty list decodes")
+
+ // Fractional seconds and offsets are ISO 8601 too.
+ precondition(VPhoneLaunchpadMachineSnapshot.date(from: "2026-10-06T14:30:00.250Z")
+ == Date(timeIntervalSince1970: 1_791_297_000.25), "Fractional seconds")
+ precondition(VPhoneLaunchpadMachineSnapshot.date(from: "2026-10-06T22:30:00+08:00")
+ == Date(timeIntervalSince1970: 1_791_297_000), "A time zone offset")
+ precondition(VPhoneLaunchpadMachineSnapshot.date(from: "yesterday") == nil, "Not a date")
+
+ for bad in [
+ #"[{"created":"yesterday","name":"x"}]"#,
+ #"[{"created":"2026-10-06T14:30:00Z"}]"#,
+ #"{"name":"x"}"#,
+ ] {
+ precondition((try? VPhoneLaunchpadMachineSnapshot.list(from: Data(bad.utf8))) == nil, "Rejected list: \(bad)")
+ }
+
+ // Through the same path `vm list` takes: warnings on stderr come first
+ // in the merged output, and the document is the last line opening one.
+ let result = VPhoneLaunchpadCommandResult(status: 0, lines: ["warning: something", json])
+ let afterWarning = try VPhoneLaunchpadMachineSnapshot.list(from: result.jsonData!)
+ precondition(afterWarning.count == 2, "JSON after a warning line")
+ print("Snapshot list tests passed")
+ }
+
+ // MARK: - Default names
+
+ static func defaultNames() {
+ var calendar = Calendar(identifier: .gregorian)
+ calendar.timeZone = TimeZone(identifier: "Asia/Shanghai")!
+ let date = Date(timeIntervalSince1970: 1_791_297_000) // 22:30 in Shanghai
+ let name = VPhoneLaunchpadMachineSnapshot.defaultName(at: date, taken: [], calendar: calendar)
+ precondition(name == "2026-10-06-2230", "Default name is \(name)")
+ precondition(VPhoneLaunchpadNames.isValidMachineName(name), "The default name follows the name rules")
+ let next = VPhoneLaunchpadMachineSnapshot.defaultName(at: date, taken: ["2026-10-06-2230", "2026-10-06-2230-2"], calendar: calendar)
+ precondition(next == "2026-10-06-2230-3", "A taken name gains a counter: \(next)")
+ print("Snapshot default name tests passed")
+ }
+
+ // MARK: - Arguments
+
+ static func arguments() {
+ let machine = VPhoneLaunchpadMachinePath(libraryRoot: "/Volumes/Lab/machines", name: "frida-lab")
+ let library = ["--library-root", "/Volumes/Lab/machines"]
+
+ precondition(machine.cloneArguments(as: "frida-lab-clone", newIdentity: true)
+ == ["vm", "clone", "frida-lab", "frida-lab-clone", "--new-identity"] + library, "Clone with a new identity")
+ precondition(machine.cloneArguments(as: "frida-lab-clone", newIdentity: false)
+ == ["vm", "clone", "frida-lab", "frida-lab-clone"] + library, "Clone as the same device")
+
+ precondition(machine.snapshotListArguments == ["vm", "snapshot", "list", "frida-lab", "--json"] + library, "List")
+ precondition(machine.snapshotCreateArguments("fresh", note: nil)
+ == ["vm", "snapshot", "create", "frida-lab", "fresh"] + library, "Create without a note")
+ precondition(machine.snapshotCreateArguments("fresh", note: " \n ")
+ == ["vm", "snapshot", "create", "frida-lab", "fresh"] + library, "A blank note is left out")
+ precondition(machine.snapshotCreateArguments("fresh", note: " -before frida ")
+ == ["vm", "snapshot", "create", "frida-lab", "fresh", "--note=-before frida"] + library,
+ "A note is trimmed and joined to its option")
+ precondition(machine.snapshotRevertArguments("fresh")
+ == ["vm", "snapshot", "revert", "frida-lab", "fresh", "--force"] + library, "Revert")
+ precondition(machine.snapshotDeleteArguments("fresh")
+ == ["vm", "snapshot", "delete", "frida-lab", "fresh", "--force"] + library, "Delete")
+ print("Clone and snapshot argument tests passed")
+ }
+
+ // MARK: - Binding saved with a snapshot
+
+ static func bindingSidecar() throws {
+ let fileManager = FileManager.default
+ let root = fileManager.temporaryDirectory.appendingPathComponent("machine-snapshots-\(UUID().uuidString)", isDirectory: true)
+ defer { try? fileManager.removeItem(at: root) }
+ let machine = VPhoneLaunchpadMachinePath(libraryRoot: root.path, name: "research-01")
+ let snapshots = machine.url.appendingPathComponent("Snapshots", isDirectory: true)
+ try fileManager.createDirectory(at: machine.url, withIntermediateDirectories: true)
+
+ let taken = VPhoneLaunchpadMachineBinding(bundle: "2.7.0", bootChain: "2.6.0", guestEnvironment: "2.6.1")
+
+ // vphone-cli makes the folder; without it nothing is written.
+ precondition(VPhoneLaunchpadMachineBinding.url(for: machine, snapshot: "fresh") == nil, "No folder, no sidecar")
+ precondition((try? taken.save(to: machine, snapshot: "fresh")) == nil, "Saving needs the snapshot's folder")
+
+ try fileManager.createDirectory(at: snapshots.appendingPathComponent("fresh"), withIntermediateDirectories: true)
+ try taken.save(to: machine, snapshot: "fresh")
+ let sidecar = snapshots.appendingPathComponent("fresh/launchpad.json")
+ precondition(fileManager.fileExists(atPath: sidecar.path), "The binding is saved in the snapshot's folder")
+ precondition(VPhoneLaunchpadMachineBinding.load(machine, snapshot: "fresh") == taken, "The saved binding loads back")
+ precondition(VPhoneLaunchpadMachineBinding.load(machine) == nil, "The machine's own binding is untouched")
+
+ // After the revert: boot chain and guest environment from the
+ // snapshot, the bundle chosen now.
+ let current = VPhoneLaunchpadMachineBinding(bundle: "2.7.1-local.ab12cd34", bootChain: "2.7.0", guestEnvironment: "2.7.1-local.ab12cd34")
+ let reverted = current.reverted(to: taken)
+ precondition(reverted == VPhoneLaunchpadMachineBinding(bundle: "2.7.1-local.ab12cd34", bootChain: "2.6.0", guestEnvironment: "2.6.1"),
+ "Reverted binding: \(reverted)")
+ precondition(reverted.hasMixedVersions, "The older guest environment shows as mixed")
+ // A snapshot from before Launchpad knew the guest environment leaves it unknown.
+ precondition(current.reverted(to: VPhoneLaunchpadMachineBinding(bundle: "2.7.0")).guestEnvironment == nil,
+ "An unknown guest environment stays unknown")
+
+ // The sidecar is checked like the machine's own binding.
+ try Data(#"{"bundle":"2.7.0","guestEnvironment":"../evil"}"#.utf8).write(to: sidecar)
+ precondition(VPhoneLaunchpadMachineBinding.load(machine, snapshot: "fresh") == nil, "An invalid sidecar is rejected")
+
+ // Names outside the rules, and folders that are links, are refused.
+ for name in ["", ".", "..", "../research-02", "a/b", ".hidden"] {
+ precondition(VPhoneLaunchpadMachineBinding.url(for: machine, snapshot: name) == nil, "Rejected snapshot name: \(name)")
+ }
+ let elsewhere = root.appendingPathComponent("elsewhere", isDirectory: true)
+ try fileManager.createDirectory(at: elsewhere, withIntermediateDirectories: true)
+ try fileManager.createSymbolicLink(at: snapshots.appendingPathComponent("linked"), withDestinationURL: elsewhere)
+ precondition(VPhoneLaunchpadMachineBinding.url(for: machine, snapshot: "linked") == nil, "A linked snapshot folder is refused")
+ precondition((try? taken.save(to: machine, snapshot: "linked")) == nil, "Nothing is written through a linked folder")
+ precondition(!fileManager.fileExists(atPath: elsewhere.appendingPathComponent("launchpad.json").path), "The link's target is untouched")
+
+ let otherMachine = VPhoneLaunchpadMachinePath(libraryRoot: root.path, name: "research-02")
+ try fileManager.createDirectory(at: otherMachine.url, withIntermediateDirectories: true)
+ try fileManager.createSymbolicLink(at: otherMachine.url.appendingPathComponent("Snapshots"), withDestinationURL: snapshots)
+ precondition(VPhoneLaunchpadMachineBinding.url(for: otherMachine, snapshot: "fresh") == nil, "A linked Snapshots folder is refused")
+ print("Snapshot binding tests passed: save, load, revert, invalid sidecar, names, links")
+ }
+}
+
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift
index 0846342e..d437b24a 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift
@@ -131,6 +131,14 @@
.environment(model)
}
await sheet(.clone(labMachine), "10-clone", suffix)
+ await sheet(.snapshots(labMachine), "10a-snapshots", suffix)
+ await sheet(.snapshots(path("research-01")), "10b-snapshots-running", suffix)
+ snapshots = []
+ await sheet(.snapshots(labMachine), "10c-snapshots-empty", suffix)
+ snapshots = sampleSnapshots
+ await standalone("10d-take-snapshot", suffix, size: NSSize(width: 420, height: 330)) {
+ VPhoneLaunchpadTakeSnapshotSheet(machine: labMachine, taken: Set(sampleSnapshots.map(\.name))) { _, _ in }
+ }
await sheet(.export([labMachine]), "11-export", suffix)
await sheet(.console(path("research-01")), "12-console", suffix)
}
@@ -225,6 +233,19 @@
)
}
+ /// Stands in for `vm snapshot list --json`. The sheet reads this one, so
+ /// the driver can empty it.
+ static var snapshots = sampleSnapshots
+
+ static let sampleSnapshots: [VPhoneLaunchpadMachineSnapshot] = {
+ let json = """
+ [{"created":"2026-09-30T08:12:44Z","name":"fresh-install","note":"Setup Assistant skipped, nothing installed"},
+ {"created":"2026-10-03T14:05:10Z","name":"frida-17.2","note":"frida-server 17.2 from the package manager, before the Stalker patch test"},
+ {"created":"2026-10-06T14:30:00Z","name":"2026-10-06-2230"}]
+ """
+ return (try? VPhoneLaunchpadMachineSnapshot.list(from: Data(json.utf8))) ?? []
+ }()
+
static let artifacts: [VPhoneLaunchpadArtifact] = [
artifact(1, "cd013c2a5e8f41b7d09c3e6a2f14b85d7c90e3a1", "2026-09-28T02:14:00Z"),
artifact(2, "374a2c5f0b1e9d8c7a6b5d4e3f2a1b0c9d8e7f6a", "2026-09-27T16:40:00Z"),
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings b/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings
index ffe754d7..533e7385 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings
@@ -13459,6 +13459,258 @@
"vi" : { "stringUnit" : { "state" : "translated", "value" : "vphoned và các thư viện hook trong máy khách." } },
"zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "客户机中的 vphoned 和 hook 库。" } }
}
+ },
+ "New device identity" : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "New device identity" } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "新しいデバイス ID" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "새 기기 식별 정보" } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Danh tính thiết bị mới" } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "新的设备身份" } }
+ }
+ },
+ "The clone gets its own ECID, UDID and MAC address, so it can run alongside the original. The guest asks to trust this Mac again the first time it connects." : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "The clone gets its own ECID, UDID and MAC address, so it can run alongside the original. The guest asks to trust this Mac again the first time it connects." } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "複製には独自の ECID、UDID、MAC アドレスが割り当てられるため、元のマシンと同時に実行できます。初めて接続するとき、ゲストはこの Mac を信頼するかどうかを再度確認します。" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "복제본은 고유한 ECID, UDID 및 MAC 주소를 받으므로 원본과 함께 실행할 수 있습니다. 처음 연결할 때 게스트가 이 Mac을 신뢰할지 다시 묻습니다." } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Bản sao nhận ECID, UDID và địa chỉ MAC riêng nên có thể chạy cùng lúc với máy gốc. Ở lần kết nối đầu tiên, máy khách sẽ hỏi lại có tin cậy máy Mac này không." } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "克隆会获得自己的 ECID、UDID 和 MAC 地址,因此可以与原虚拟机同时运行。首次连接时,客户机会再次询问是否信任这台 Mac。" } }
+ }
+ },
+ "The clone is the same device as the original. Run only one of them at a time." : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "The clone is the same device as the original. Run only one of them at a time." } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "複製は元のマシンと同じデバイスです。同時に実行できるのはどちらか一方だけです。" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "복제본은 원본과 같은 기기입니다. 한 번에 하나만 실행하십시오." } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Bản sao là cùng một thiết bị với máy gốc. Mỗi lúc chỉ chạy một trong hai máy." } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "克隆与原虚拟机是同一台设备。两者同一时间只能运行一个。" } }
+ }
+ },
+ "Snapshots…" : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Snapshots…" } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "スナップショット…" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "스냅샷…" } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Ảnh chụp nhanh…" } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "快照…" } }
+ }
+ },
+ "Unable to List Snapshots" : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Unable to List Snapshots" } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "スナップショットを一覧表示できません" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "스냅샷 목록을 가져올 수 없음" } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Không thể liệt kê ảnh chụp nhanh" } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "无法列出快照" } }
+ }
+ },
+ "Taking snapshot…" : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Taking snapshot…" } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "スナップショットを作成中…" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "스냅샷 생성 중…" } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Đang tạo ảnh chụp nhanh…" } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "正在拍摄快照…" } }
+ }
+ },
+ "Reverting to snapshot…" : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Reverting to snapshot…" } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "スナップショットに復元中…" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "스냅샷으로 되돌리는 중…" } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Đang hoàn nguyên về ảnh chụp nhanh…" } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "正在恢复到快照…" } }
+ }
+ },
+ "Deleting snapshot…" : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Deleting snapshot…" } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "スナップショットを削除中…" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "스냅샷 삭제 중…" } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Đang xóa ảnh chụp nhanh…" } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "正在删除快照…" } }
+ }
+ },
+ "%@ Snapshots" : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "%@ Snapshots" } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "%@ のスナップショット" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "%@ 스냅샷" } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Ảnh chụp nhanh của %@" } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "%@ 的快照" } }
+ }
+ },
+ "Take Snapshot…" : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Take Snapshot…" } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "スナップショットを作成…" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "스냅샷 생성…" } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Tạo ảnh chụp nhanh…" } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "拍摄快照…" } }
+ }
+ },
+ "Save the machine's disk, SEP storage and NVRAM as they are now." : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Save the machine's disk, SEP storage and NVRAM as they are now." } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "マシンのディスク、SEP ストレージ、NVRAM を現在の状態で保存します。" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "머신의 디스크, SEP 저장소 및 NVRAM을 현재 상태 그대로 저장합니다." } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Lưu ổ đĩa, bộ nhớ SEP và NVRAM của máy ảo ở trạng thái hiện tại." } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "按当前状态保存虚拟机的磁盘、SEP 存储和 NVRAM。" } }
+ }
+ },
+ "Revert…" : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Revert…" } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "復元…" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "되돌리기…" } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Hoàn nguyên…" } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "恢复…" } }
+ }
+ },
+ "Revert %@ to “%@”?" : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Revert %@ to “%@”?" } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "%1$@ を「%2$@」に復元しますか?" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "%1$@을(를) “%2$@”(으)로 되돌리겠습니까?" } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Hoàn nguyên %1$@ về “%2$@”?" } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "将 %1$@ 恢复到“%2$@”?" } }
+ }
+ },
+ "Revert" : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Revert" } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "復元" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "되돌리기" } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Hoàn nguyên" } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "恢复" } }
+ }
+ },
+ "The machine's current disk, SEP storage and NVRAM are replaced with the snapshot's. Anything changed since then is lost unless you take a snapshot first." : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "The machine's current disk, SEP storage and NVRAM are replaced with the snapshot's. Anything changed since then is lost unless you take a snapshot first." } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "マシンの現在のディスク、SEP ストレージ、NVRAM がスナップショットのものに置き換えられます。先にスナップショットを作成しておかないと、それ以降の変更はすべて失われます。" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "머신의 현재 디스크, SEP 저장소 및 NVRAM이 스냅샷의 것으로 대체됩니다. 먼저 스냅샷을 생성하지 않으면 그 이후의 변경 사항은 모두 사라집니다." } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Ổ đĩa, bộ nhớ SEP và NVRAM hiện tại của máy ảo sẽ được thay bằng của ảnh chụp nhanh. Mọi thay đổi kể từ đó sẽ mất, trừ khi bạn tạo ảnh chụp nhanh trước." } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "虚拟机当前的磁盘、SEP 存储和 NVRAM 将被替换为快照中的版本。除非先拍摄快照,否则此后的所有更改都会丢失。" } }
+ }
+ },
+ "Delete Snapshot “%@”?" : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Delete Snapshot “%@”?" } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "スナップショット「%@」を削除しますか?" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "스냅샷 “%@”을(를) 삭제하겠습니까?" } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Xóa ảnh chụp nhanh “%@”?" } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "删除快照“%@”?" } }
+ }
+ },
+ "The snapshot's files are removed. The machine itself is not changed. This cannot be undone." : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "The snapshot's files are removed. The machine itself is not changed. This cannot be undone." } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "スナップショットのファイルが削除されます。マシン自体は変更されません。この操作は取り消せません。" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "스냅샷의 파일이 제거됩니다. 머신 자체는 변경되지 않습니다. 이 작업은 실행 취소할 수 없습니다." } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Các tệp của ảnh chụp nhanh sẽ bị xóa. Bản thân máy ảo không thay đổi. Không thể hoàn tác thao tác này." } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "快照的文件将被移除,虚拟机本身不受影响。此操作无法撤销。" } }
+ }
+ },
+ "No Snapshots" : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "No Snapshots" } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "スナップショットなし" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "스냅샷 없음" } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Không có ảnh chụp nhanh" } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "没有快照" } }
+ }
+ },
+ "Take a snapshot before you change the guest, so you can put it back later. A snapshot keeps the disk, SEP storage and NVRAM; settings and the Core Bundle are not part of it." : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Take a snapshot before you change the guest, so you can put it back later. A snapshot keeps the disk, SEP storage and NVRAM; settings and the Core Bundle are not part of it." } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "ゲストを変更する前にスナップショットを作成しておくと、あとで元の状態に戻せます。スナップショットにはディスク、SEP ストレージ、NVRAM が含まれます。設定とコアバンドルは含まれません。" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "게스트를 변경하기 전에 스냅샷을 생성해 두면 나중에 되돌릴 수 있습니다. 스냅샷에는 디스크, SEP 저장소 및 NVRAM이 포함되며, 설정과 코어 번들은 포함되지 않습니다." } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Hãy tạo ảnh chụp nhanh trước khi thay đổi máy khách để có thể khôi phục sau này. Ảnh chụp nhanh giữ ổ đĩa, bộ nhớ SEP và NVRAM; cài đặt và Bundle lõi không nằm trong đó." } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "在更改客户机之前拍摄快照,以后就能恢复回来。快照包含磁盘、SEP 存储和 NVRAM,不包含设置和核心 Bundle。" } }
+ }
+ },
+ "Try Again" : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Try Again" } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "再試行" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "다시 시도" } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Thử lại" } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "重试" } }
+ }
+ },
+ "Date Created" : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Date Created" } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "作成日" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "생성일" } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Ngày tạo" } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "创建日期" } }
+ }
+ },
+ "Note" : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Note" } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "メモ" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "메모" } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Ghi chú" } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "备注" } }
+ }
+ },
+ "Stop the machine to take, revert to or delete a snapshot." : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Stop the machine to take, revert to or delete a snapshot." } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "スナップショットを作成、復元、削除するには、マシンを停止してください。" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "스냅샷을 생성, 되돌리기 또는 삭제하려면 머신을 중지하십시오." } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Hãy dừng máy để tạo, hoàn nguyên hoặc xóa ảnh chụp nhanh." } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "停止虚拟机后才能拍摄、恢复或删除快照。" } }
+ }
+ },
+ "Take Snapshot of %@" : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Take Snapshot of %@" } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "%@ のスナップショットを作成" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "%@ 스냅샷 생성" } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Tạo ảnh chụp nhanh của %@" } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "为 %@ 拍摄快照" } }
+ }
+ },
+ "A snapshot with this name already exists." : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "A snapshot with this name already exists." } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "この名前のスナップショットはすでに存在します。" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "이 이름의 스냅샷이 이미 있습니다." } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Đã có ảnh chụp nhanh mang tên này." } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "已存在同名快照。" } }
+ }
+ },
+ "Optional" : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Optional" } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "任意" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "선택 사항" } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Không bắt buộc" } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "可选" } }
+ }
+ },
+ "The snapshot keeps the machine's disk, SEP storage and NVRAM as they are now. Its settings and Core Bundle are not part of it." : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "The snapshot keeps the machine's disk, SEP storage and NVRAM as they are now. Its settings and Core Bundle are not part of it." } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "スナップショットには、マシンのディスク、SEP ストレージ、NVRAM が現在の状態で保存されます。設定とコアバンドルは含まれません。" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "스냅샷은 머신의 디스크, SEP 저장소 및 NVRAM을 현재 상태 그대로 보관합니다. 설정과 코어 번들은 포함되지 않습니다." } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Ảnh chụp nhanh giữ ổ đĩa, bộ nhớ SEP và NVRAM của máy ảo ở trạng thái hiện tại. Cài đặt và Bundle lõi không nằm trong đó." } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "快照会按当前状态保存虚拟机的磁盘、SEP 存储和 NVRAM,不包含其设置和核心 Bundle。" } }
+ }
+ },
+ "Take Snapshot" : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Take Snapshot" } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "スナップショットを作成" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "스냅샷 생성" } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Tạo ảnh chụp nhanh" } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "拍摄快照" } }
+ }
}
},
"version" : "1.0"
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineBinding.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineBinding.swift
index 1ad3bf40..f4b2b6f0 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineBinding.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineBinding.swift
@@ -50,7 +50,10 @@ nonisolated struct VPhoneLaunchpadMachineBinding: Codable, Equatable, Sendable {
/// Launchpad wrote. Every version is checked, since the file is in a
/// folder the user owns and a version becomes a path in the store.
static func load(_ machine: VPhoneLaunchpadMachinePath) -> VPhoneLaunchpadMachineBinding? {
- let url = url(for: machine)
+ load(from: url(for: machine))
+ }
+
+ private static func load(from url: URL) -> VPhoneLaunchpadMachineBinding? {
guard let values = try? url.resourceValues(forKeys: [.isRegularFileKey, .isSymbolicLinkKey]),
values.isRegularFile == true, values.isSymbolicLink != true,
let data = try? Data(contentsOf: url),
@@ -66,8 +69,67 @@ nonisolated struct VPhoneLaunchpadMachineBinding: Codable, Equatable, Sendable {
/// Atomic, so a `launchpad.json` that is a symbolic link is replaced
/// rather than written through.
func save(to machine: VPhoneLaunchpadMachinePath) throws {
+ try write(to: Self.url(for: machine))
+ }
+
+ private func write(to url: URL) throws {
let encoder = JSONEncoder()
encoder.outputFormatting = [.prettyPrinted, .sortedKeys]
- try encoder.encode(self).write(to: Self.url(for: machine), options: .atomic)
+ try encoder.encode(self).write(to: url, options: .atomic)
+ }
+
+ // MARK: - Snapshots
+
+ /// A snapshot (`vm snapshot create`) copies the disk, the SEP storage and
+ /// the NVRAM, and leaves `launchpad.json` alone: vphone-cli never reads
+ /// it. Launchpad keeps a copy of the binding as it was beside the
+ /// snapshot's files, in `Snapshots/<name>/launchpad.json`, which
+ /// vphone-cli keeps with the snapshot and deletes with it.
+ ///
+ /// Nil for a name that is not one path component vphone-cli accepts, or
+ /// when `Snapshots` or the snapshot's folder is anything but a real
+ /// directory, so the copy is never written or read through a link.
+ static func url(for machine: VPhoneLaunchpadMachinePath, snapshot name: String) -> URL? {
+ guard VPhoneLaunchpadNames.isValidMachineName(name) else {
+ return nil
+ }
+ let snapshots = machine.url.appendingPathComponent("Snapshots", isDirectory: true)
+ let folder = snapshots.appendingPathComponent(name, isDirectory: true)
+ for directory in [snapshots, folder] {
+ guard let values = try? directory.resourceValues(forKeys: [.isDirectoryKey, .isSymbolicLinkKey]),
+ values.isDirectory == true, values.isSymbolicLink != true
+ else {
+ return nil
+ }
+ }
+ return folder.appendingPathComponent(fileName)
+ }
+
+ /// The binding saved with a snapshot, checked as `load` checks a
+ /// machine's own.
+ static func load(_ machine: VPhoneLaunchpadMachinePath, snapshot name: String) -> VPhoneLaunchpadMachineBinding? {
+ url(for: machine, snapshot: name).flatMap(load(from:))
+ }
+
+ func save(to machine: VPhoneLaunchpadMachinePath, snapshot name: String) throws {
+ guard let url = Self.url(for: machine, snapshot: name) else {
+ throw CocoaError(.fileNoSuchFile, userInfo: [
+ NSFilePathErrorKey: machine.url.appendingPathComponent("Snapshots").appendingPathComponent(name).path,
+ ])
+ }
+ try write(to: url)
+ }
+
+ /// This binding after its machine is reverted to a snapshot taken with
+ /// `snapshot` as the binding. The guest environment and the boot chain
+ /// live on the disk and in the NVRAM the revert put back, so they are
+ /// whatever they were when the snapshot was taken. The host programs are
+ /// not part of the machine's files: the bundle stays the one chosen now.
+ func reverted(to snapshot: VPhoneLaunchpadMachineBinding) -> VPhoneLaunchpadMachineBinding {
+ VPhoneLaunchpadMachineBinding(
+ bundle: bundle,
+ bootChain: snapshot.bootChain,
+ guestEnvironment: snapshot.guestEnvironment,
+ )
}
}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swift
index ea8ea523..9b7e2bdf 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swift
@@ -671,8 +671,10 @@ final class VPhoneLaunchpadMachineLibrary {
}
}
- func clone(_ machine: Path, as newName: String) async {
- if await perform(String(localized: "Cloning…"), on: machine, ["vm", "clone", machine.name, newName] + machine.libraryArguments) {
+ /// With `newIdentity` the clone gets its own ECID, UDID and MAC address,
+ /// so both machines can run at once; a plain clone is the same device.
+ func clone(_ machine: Path, as newName: String, newIdentity: Bool) async {
+ if await perform(String(localized: "Cloning…"), on: machine, machine.cloneArguments(as: newName, newIdentity: newIdentity)) {
selection = [Path(libraryRoot: machine.libraryRoot, name: newName)]
}
}
@@ -763,14 +765,31 @@ final class VPhoneLaunchpadMachineLibrary {
_ arguments: [String],
onProgress: (@Sendable (Double) -> Void)? = nil,
) async -> Bool {
+ do {
+ try await performChecked(activity, on: machine, arguments, onProgress: onProgress)
+ return true
+ } catch {
+ if !(error is CancellationError) {
+ actionError = error as? VPhoneLaunchpadError
+ ?? VPhoneLaunchpadError(String(localized: "Unable to Complete Action"), detail: error.localizedDescription)
+ }
+ return false
+ }
+ }
+
+ /// `perform` for a sheet that reports its own errors: throws what failed,
+ /// or `CancellationError` when the command was cancelled.
+ private func performChecked(
+ _ activity: String,
+ on machine: Path?,
+ _ arguments: [String],
+ onProgress: (@Sendable (Double) -> Void)? = nil,
+ ) async throws {
guard let commandLine = machine.map(commandLine(for:)) ?? bundles.commandLine() else {
if let machine {
- actionError = VPhoneLaunchpadError(
- String(localized: "Unable to Complete Action"),
- detail: String(localized: "The Core Bundle of \(machine.name) is not installed. Choose another Core Bundle for it."),
- )
+ throw Self.missingBundle(machine)
}
- return false
+ throw CancellationError()
}
if let machine {
activities[machine] = activity
@@ -787,19 +806,80 @@ final class VPhoneLaunchpadMachineLibrary {
do {
try await commandLine.runChecked(arguments, onProgress: onProgress)
await refresh()
- return true
} catch {
+ await refresh()
if error is CancellationError || Task.isCancelled {
- await refresh()
- return false
+ throw CancellationError()
}
- actionError = error as? VPhoneLaunchpadError
- ?? VPhoneLaunchpadError(String(localized: "Unable to Complete Action"), detail: error.localizedDescription)
- await refresh()
- return false
+ throw error
}
}
+ private static func missingBundle(_ machine: Path) -> VPhoneLaunchpadError {
+ VPhoneLaunchpadError(
+ String(localized: "Unable to Complete Action"),
+ detail: String(localized: "The Core Bundle of \(machine.name) is not installed. Choose another Core Bundle for it."),
+ )
+ }
+
+ // MARK: - Snapshots
+
+ /// The machine's snapshots, oldest first, from its own bundle's
+ /// `vm snapshot list --json`. Errors go to the caller, the Snapshots
+ /// sheet, which shows them itself.
+ func snapshots(of machine: Path) async throws -> [VPhoneLaunchpadMachineSnapshot] {
+ guard let commandLine = commandLine(for: machine) else {
+ throw Self.missingBundle(machine)
+ }
+ let result = try await commandLine.run(machine.snapshotListArguments, recordInHistory: false)
+ guard result.succeeded, let data = result.jsonData else {
+ throw VPhoneLaunchpadError(String(localized: "Unable to List Snapshots"), detail: result.tail)
+ }
+ return try VPhoneLaunchpadMachineSnapshot.list(from: data)
+ }
+
+ /// Takes a snapshot of a stopped machine, then saves its binding with it
+ /// so a revert can tell which bundles built what the snapshot holds.
+ func createSnapshot(of machine: Path, name: String, note: String?) async throws {
+ try await performChecked(
+ String(localized: "Taking snapshot…"),
+ on: machine,
+ machine.snapshotCreateArguments(name, note: note),
+ )
+ // The snapshot is taken either way; without the copy a revert only
+ // leaves the binding as it is then.
+ if let binding = VPhoneLaunchpadMachineBinding.load(machine) ?? bindings[machine] {
+ try? binding.save(to: machine, snapshot: name)
+ }
+ }
+
+ /// Puts a snapshot's disk, SEP storage and NVRAM back in place of the
+ /// machine's own. What was there is gone unless it was snapshotted too.
+ func revertSnapshot(of machine: Path, to name: String) async throws {
+ try await performChecked(
+ String(localized: "Reverting to snapshot…"),
+ on: machine,
+ machine.snapshotRevertArguments(name),
+ )
+ // The guest environment and the boot chain are on the disk and in
+ // the NVRAM the revert just replaced, so the binding takes them from
+ // the copy saved with the snapshot. The bundle is not on the disk:
+ // the machine keeps running with the one chosen now.
+ if let saved = VPhoneLaunchpadMachineBinding.load(machine, snapshot: name),
+ let current = VPhoneLaunchpadMachineBinding.load(machine) ?? bindings[machine]
+ {
+ try? bind(machine, current.reverted(to: saved))
+ }
+ }
+
+ func deleteSnapshot(of machine: Path, name: String) async throws {
+ try await performChecked(
+ String(localized: "Deleting snapshot…"),
+ on: machine,
+ machine.snapshotDeleteArguments(name),
+ )
+ }
+
// MARK: - Create
func create(_ options: VPhoneLaunchpadCreationPipeline.Options) -> VPhoneLaunchpadCreationPipeline {
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineSheets.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineSheets.swift
index 5d0b785a..1ccfcd30 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineSheets.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineSheets.swift
@@ -392,16 +392,35 @@ struct VPhoneLaunchpadMachineSettingsView: View {
// MARK: - Rename and clone
-struct VPhoneLaunchpadNameSheet: View {
+/// A new name for a machine, and for a clone whatever else it takes, in
+/// sections of `options` under the name.
+struct VPhoneLaunchpadNameSheet<Options: View>: View {
let title: LocalizedStringKey
let action: LocalizedStringKey
let initial: String
/// The machine renamed or cloned. The new name stays in its library.
let machine: VPhoneLaunchpadMachinePath
+ @ViewBuilder let options: Options
let onConfirm: (String) -> Void
@Environment(\.dismiss) private var dismiss
@State private var name = ""
+ init(
+ title: LocalizedStringKey,
+ action: LocalizedStringKey,
+ initial: String,
+ machine: VPhoneLaunchpadMachinePath,
+ @ViewBuilder options: () -> Options,
+ onConfirm: @escaping (String) -> Void,
+ ) {
+ self.title = title
+ self.action = action
+ self.initial = initial
+ self.machine = machine
+ self.options = options()
+ self.onConfirm = onConfirm
+ }
+
private var fitsLocation: Bool {
VPhoneLaunchpadMachineLocations.socketPathFits(root: machine.libraryRoot, name: name)
}
@@ -424,6 +443,7 @@ struct VPhoneLaunchpadNameSheet: View {
.foregroundStyle(.red)
}
}
+ options
}
.formStyle(.grouped)
} actions: {
@@ -442,6 +462,47 @@ struct VPhoneLaunchpadNameSheet: View {
}
}
+extension VPhoneLaunchpadNameSheet where Options == EmptyView {
+ init(
+ title: LocalizedStringKey,
+ action: LocalizedStringKey,
+ initial: String,
+ machine: VPhoneLaunchpadMachinePath,
+ onConfirm: @escaping (String) -> Void,
+ ) {
+ self.init(title: title, action: action, initial: initial, machine: machine, options: { EmptyView() }, onConfirm: onConfirm)
+ }
+}
+
+/// Clone, with the choice of a device of its own. A new identity is the
+/// default: a clone that keeps the original's ECID, UDID and MAC cannot run
+/// at the same time as it, and the host sees them as one device.
+struct VPhoneLaunchpadCloneSheet: View {
+ let machine: VPhoneLaunchpadMachinePath
+ let onConfirm: (_ name: String, _ newIdentity: Bool) -> Void
+ @State private var newIdentity = true
+
+ var body: some View {
+ VPhoneLaunchpadNameSheet(
+ title: "Clone \(machine.name)",
+ action: "Clone",
+ initial: "\(machine.name)-clone",
+ machine: machine,
+ ) {
+ Section {
+ Toggle("New device identity", isOn: $newIdentity)
+ } footer: {
+ Text(newIdentity
+ ? "The clone gets its own ECID, UDID and MAC address, so it can run alongside the original. The guest asks to trust this Mac again the first time it connects."
+ : "The clone is the same device as the original. Run only one of them at a time.")
+ .foregroundStyle(.secondary)
+ }
+ } onConfirm: { name in
+ onConfirm(name, newIdentity)
+ }
+ }
+}
+
// MARK: - Export
/// One machine offers the archive options. Several are written with the
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineSnapshot.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineSnapshot.swift
new file mode 100644
index 00000000..b7cc673f
--- /dev/null
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineSnapshot.swift
@@ -0,0 +1,88 @@
+import Foundation
+
+// MARK: - vm snapshot list
+
+/// One entry of `vphone-cli vm snapshot list <vm> --json`: a copy of the
+/// machine's disk, SEP storage and NVRAM taken while it was stopped. The list
+/// comes oldest first.
+nonisolated struct VPhoneLaunchpadMachineSnapshot: Decodable, Hashable, Identifiable, Sendable {
+ let name: String
+ let created: Date
+ let note: String?
+
+ var id: String {
+ name
+ }
+
+ /// Decodes the array `vm snapshot list --json` prints. `created` is
+ /// ISO 8601, with or without fractional seconds.
+ static func list(from data: Data) throws -> [Self] {
+ let decoder = JSONDecoder()
+ decoder.dateDecodingStrategy = .custom { decoder in
+ let container = try decoder.singleValueContainer()
+ let text = try container.decode(String.self)
+ guard let date = date(from: text) else {
+ throw DecodingError.dataCorruptedError(in: container, debugDescription: "Not an ISO 8601 date: \(text)")
+ }
+ return date
+ }
+ return try decoder.decode([Self].self, from: data)
+ }
+
+ static func date(from text: String) -> Date? {
+ (try? Date(text, strategy: .iso8601))
+ ?? (try? Date(text, strategy: Date.ISO8601FormatStyle(includingFractionalSeconds: true)))
+ }
+
+ /// The name Take Snapshot offers: the local date and time to the minute,
+ /// `2026-10-06-2230`, with `-2`, `-3`… when that is taken. It follows the
+ /// machine name rules, which snapshot names share.
+ static func defaultName(at date: Date, taken: Set<String>, calendar: Calendar = .current) -> String {
+ let parts = calendar.dateComponents([.year, .month, .day, .hour, .minute], from: date)
+ let base = String(
+ format: "%04d-%02d-%02d-%02d%02d",
+ parts.year ?? 0, parts.month ?? 0, parts.day ?? 0, parts.hour ?? 0, parts.minute ?? 0,
+ )
+ var name = base
+ var counter = 2
+ while taken.contains(name) {
+ name = "\(base)-\(counter)"
+ counter += 1
+ }
+ return name
+ }
+}
+
+// MARK: - Arguments
+
+/// The `vphone-cli` arguments for clone and snapshots, kept apart from the
+/// library so they can be checked without running anything.
+nonisolated extension VPhoneLaunchpadMachinePath {
+ /// `--new-identity` gives the clone its own ECID, UDID and MAC, so it can
+ /// run beside this machine.
+ func cloneArguments(as newName: String, newIdentity: Bool) -> [String] {
+ ["vm", "clone", name, newName] + (newIdentity ? ["--new-identity"] : []) + libraryArguments
+ }
+
+ var snapshotListArguments: [String] {
+ ["vm", "snapshot", "list", name, "--json"] + libraryArguments
+ }
+
+ /// A blank note is left out. The note is joined to its option, so one
+ /// that starts with a hyphen is not read as another option.
+ func snapshotCreateArguments(_ snapshot: String, note: String?) -> [String] {
+ var arguments = ["vm", "snapshot", "create", name, snapshot]
+ if let note = note?.trimmingCharacters(in: .whitespacesAndNewlines), !note.isEmpty {
+ arguments.append("--note=\(note)")
+ }
+ return arguments + libraryArguments
+ }
+
+ func snapshotRevertArguments(_ snapshot: String) -> [String] {
+ ["vm", "snapshot", "revert", name, snapshot, "--force"] + libraryArguments
+ }
+
+ func snapshotDeleteArguments(_ snapshot: String) -> [String] {
+ ["vm", "snapshot", "delete", name, snapshot, "--force"] + libraryArguments
+ }
+}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift
index a0ee7635..99c0c931 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift
@@ -12,6 +12,7 @@ struct VPhoneLaunchpadMachinesView: View {
case rename(MachinePath)
case clone(MachinePath)
case export([MachinePath])
+ case snapshots(MachinePath)
case console(MachinePath)
var id: String {
@@ -23,6 +24,7 @@ struct VPhoneLaunchpadMachinesView: View {
case let .rename(machine): "rename-\(machine.url.path)"
case let .clone(machine): "clone-\(machine.url.path)"
case let .export(machines): "export-\(machines.map(\.url.path).joined(separator: "|"))"
+ case let .snapshots(machine): "snapshots-\(machine.url.path)"
case let .console(machine): "console-\(machine.url.path)"
}
}
@@ -307,6 +309,10 @@ struct VPhoneLaunchpadMachinesView: View {
.disabled(!isStopped)
Button("Export…") { sheet = .export([machine.path]) }
.disabled(!isStopped)
+ // Open while the machine runs too, to read the list; taking,
+ // reverting and deleting wait for it to stop.
+ Button("Snapshots…") { sheet = .snapshots(machine.path) }
+ .disabled(library.creations[machine.path]?.isRunning == true)
Button("Install Custom Firmware") {
Task { await library.installCustomFirmware(machine.path) }
}
@@ -456,16 +462,13 @@ struct VPhoneLaunchpadMachinesView: View {
Task { await library.rename(path, to: newName) }
}
case let .clone(path):
- VPhoneLaunchpadNameSheet(
- title: "Clone \(path.name)",
- action: "Clone",
- initial: "\(path.name)-clone",
- machine: path,
- ) { newName in
- Task { await library.clone(path, as: newName) }
+ VPhoneLaunchpadCloneSheet(machine: path) { newName, newIdentity in
+ Task { await library.clone(path, as: newName, newIdentity: newIdentity) }
}
case let .export(paths):
VPhoneLaunchpadExportView(machines: paths)
+ case let .snapshots(path):
+ VPhoneLaunchpadSnapshotsView(machine: path)
case let .console(path):
VPhoneLaunchpadConsoleView(title: "\(path.name) Console", url: VPhoneLaunchpadMachineLibrary.consoleLog(path))
}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadSnapshotsView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadSnapshotsView.swift
new file mode 100644
index 00000000..a63d1003
--- /dev/null
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadSnapshotsView.swift
@@ -0,0 +1,280 @@
+import SwiftUI
+
+// MARK: - Snapshots
+
+/// One machine's disk snapshots, from `vm snapshot list --json`, with Take,
+/// Revert and Delete. The list can be read while the machine runs; the
+/// actions wait for it to stop, since the disk, SEP storage and NVRAM are
+/// copied or replaced together. The sheet reports its own errors.
+struct VPhoneLaunchpadSnapshotsView: View {
+ let machine: VPhoneLaunchpadMachinePath
+ @Environment(VPhoneLaunchpadModel.self) private var model
+ @Environment(\.dismiss) private var dismiss
+ /// Nil until the first list answers.
+ @State private var snapshots: [VPhoneLaunchpadMachineSnapshot]?
+ @State private var listError: String?
+ @State private var selection: VPhoneLaunchpadMachineSnapshot.ID?
+ @State private var takesSnapshot = false
+ @State private var reversion: VPhoneLaunchpadMachineSnapshot?
+ @State private var deletion: VPhoneLaunchpadMachineSnapshot?
+ @State private var actionError: VPhoneLaunchpadError?
+
+ private var library: VPhoneLaunchpadMachineLibrary {
+ model.machines
+ }
+
+ private var state: VPhoneLaunchpadMachineLibrary.RunState {
+ library.state(of: machine)
+ }
+
+ private var isStopped: Bool {
+ state == .stopped
+ }
+
+ private var selected: VPhoneLaunchpadMachineSnapshot? {
+ snapshots?.first { $0.id == selection }
+ }
+
+ var body: some View {
+ VPhoneLaunchpadSheet(Text("\(machine.name) Snapshots")) {
+ VStack(spacing: 0) {
+ list
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ if !isStopped {
+ Divider()
+ status
+ .font(.callout)
+ .foregroundStyle(.secondary)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(.horizontal, 16)
+ .padding(.vertical, 8)
+ }
+ }
+ } accessory: {
+ Button("Take Snapshot…") { takesSnapshot = true }
+ .disabled(!isStopped || snapshots == nil)
+ .help("Save the machine's disk, SEP storage and NVRAM as they are now.")
+ Button("Revert…") { reversion = selected }
+ .disabled(!isStopped || selected == nil)
+ Button("Delete…") { deletion = selected }
+ .disabled(!isStopped || selected == nil)
+ } actions: {
+ Button("Done") { dismiss() }
+ .keyboardShortcut(.defaultAction)
+ }
+ .frame(width: 640, height: 420)
+ .task { await reload() }
+ .sheet(isPresented: $takesSnapshot) {
+ VPhoneLaunchpadTakeSnapshotSheet(
+ machine: machine,
+ taken: Set((snapshots ?? []).map(\.name)),
+ ) { name, note in
+ run { try await library.createSnapshot(of: machine, name: name, note: note) }
+ selection = name
+ }
+ }
+ .confirmationDialog(
+ "Revert \(machine.name) to “\(reversion?.name ?? "")”?",
+ isPresented: Binding(get: { reversion != nil }, set: {
+ if !$0 {
+ reversion = nil
+ }
+ }),
+ presenting: reversion,
+ ) { snapshot in
+ Button("Revert", role: .destructive) {
+ run { try await library.revertSnapshot(of: machine, to: snapshot.name) }
+ }
+ } message: { _ in
+ Text("The machine's current disk, SEP storage and NVRAM are replaced with the snapshot's. Anything changed since then is lost unless you take a snapshot first.")
+ }
+ .confirmationDialog(
+ "Delete Snapshot “\(deletion?.name ?? "")”?",
+ isPresented: Binding(get: { deletion != nil }, set: {
+ if !$0 {
+ deletion = nil
+ }
+ }),
+ presenting: deletion,
+ ) { snapshot in
+ Button("Delete", role: .destructive) {
+ run { try await library.deleteSnapshot(of: machine, name: snapshot.name) }
+ }
+ } message: { _ in
+ Text("The snapshot's files are removed. The machine itself is not changed. This cannot be undone.")
+ }
+ .errorAlert($actionError)
+ }
+
+ // MARK: - List
+
+ @ViewBuilder
+ private var list: some View {
+ if let snapshots {
+ if snapshots.isEmpty {
+ ContentUnavailableView {
+ Label("No Snapshots", systemImage: "clock.arrow.circlepath")
+ } description: {
+ Text("Take a snapshot before you change the guest, so you can put it back later. A snapshot keeps the disk, SEP storage and NVRAM; settings and the Core Bundle are not part of it.")
+ }
+ } else {
+ table(snapshots)
+ }
+ } else if let listError {
+ ContentUnavailableView {
+ Label("Unable to List Snapshots", systemImage: "exclamationmark.triangle")
+ } description: {
+ Text(listError)
+ } actions: {
+ Button("Try Again") { Task { await reload() } }
+ }
+ } else {
+ ProgressView()
+ .controlSize(.small)
+ }
+ }
+
+ private func table(_ snapshots: [VPhoneLaunchpadMachineSnapshot]) -> some View {
+ Table(snapshots, selection: $selection) {
+ TableColumn("Name") { snapshot in
+ Text(verbatim: snapshot.name)
+ .lineLimit(1)
+ .truncationMode(.middle)
+ .help(snapshot.name)
+ }
+ .width(min: 100, ideal: 140, max: 180)
+ TableColumn("Date Created") { snapshot in
+ Text(snapshot.created.formatted(date: .abbreviated, time: .shortened))
+ .monospacedDigit()
+ }
+ .width(min: 140, ideal: 170, max: 190)
+ TableColumn("Note") { snapshot in
+ Text(verbatim: snapshot.note ?? "")
+ .lineLimit(1)
+ .truncationMode(.tail)
+ .help(snapshot.note ?? "")
+ }
+ }
+ .contextMenu(forSelectionType: VPhoneLaunchpadMachineSnapshot.ID.self) { names in
+ let snapshot = names.count == 1 ? snapshots.first { names.contains($0.id) } : nil
+ Button("Revert…") { reversion = snapshot }
+ .disabled(!isStopped || snapshot == nil)
+ Button("Delete…", role: .destructive) { deletion = snapshot }
+ .disabled(!isStopped || snapshot == nil)
+ }
+ }
+
+ /// What the actions are waiting for: the command under way, or the
+ /// machine to stop.
+ @ViewBuilder
+ private var status: some View {
+ switch state {
+ case let .busy(activity):
+ HStack(spacing: 6) {
+ ProgressView()
+ .controlSize(.small)
+ Text(activity)
+ }
+ case .running:
+ Label("Stop the machine to take, revert to or delete a snapshot.", systemImage: "info.circle")
+ case .stopped:
+ EmptyView()
+ }
+ }
+
+ // MARK: - Actions
+
+ private func reload() async {
+ #if DEBUG
+ if VPhoneLaunchpadPreview.isActive {
+ snapshots = VPhoneLaunchpadPreview.snapshots
+ selection = snapshots?.last?.id
+ return
+ }
+ #endif
+ do {
+ let loaded = try await library.snapshots(of: machine)
+ snapshots = loaded
+ listError = nil
+ if let selection, !loaded.contains(where: { $0.id == selection }) {
+ self.selection = nil
+ }
+ } catch {
+ listError = VPhoneLaunchpadError.message(for: error)
+ }
+ }
+
+ /// Runs one snapshot command, then reads the list again whatever it did.
+ private func run(_ action: @escaping @MainActor () async throws -> Void) {
+ Task {
+ do {
+ try await action()
+ } catch is CancellationError {
+ } catch {
+ actionError = error as? VPhoneLaunchpadError
+ ?? VPhoneLaunchpadError(String(localized: "Unable to Complete Action"), detail: error.localizedDescription)
+ }
+ await reload()
+ }
+ }
+}
+
+// MARK: - Take Snapshot
+
+/// A name for the new snapshot, by default the date and time, and an
+/// optional note. Names follow the machine name rules.
+struct VPhoneLaunchpadTakeSnapshotSheet: View {
+ let machine: VPhoneLaunchpadMachinePath
+ /// The names already used, which a new snapshot cannot take.
+ let taken: Set<String>
+ let onConfirm: (_ name: String, _ note: String?) -> Void
+ @Environment(\.dismiss) private var dismiss
+ @State private var name = ""
+ @State private var note = ""
+
+ private var isTaken: Bool {
+ taken.contains(name)
+ }
+
+ private var isValid: Bool {
+ VPhoneLaunchpadNames.isValidMachineName(name) && !isTaken
+ }
+
+ var body: some View {
+ VPhoneLaunchpadSheet(Text("Take Snapshot of \(machine.name)")) {
+ Form {
+ Section {
+ TextField("Name", text: $name)
+ } footer: {
+ if isTaken {
+ Text("A snapshot with this name already exists.")
+ .foregroundStyle(.red)
+ } else {
+ Text("Use letters, numbers, periods, hyphens, and underscores.")
+ .foregroundStyle(.secondary)
+ }
+ }
+ Section {
+ TextField("Note", text: $note, prompt: Text("Optional"), axis: .vertical)
+ .lineLimit(2 ... 4)
+ } footer: {
+ Text("The snapshot keeps the machine's disk, SEP storage and NVRAM as they are now. Its settings and Core Bundle are not part of it.")
+ .foregroundStyle(.secondary)
+ }
+ }
+ .formStyle(.grouped)
+ } actions: {
+ Button("Cancel") { dismiss() }
+ .keyboardShortcut(.cancelAction)
+ Button("Take Snapshot") {
+ onConfirm(name, note)
+ dismiss()
+ }
+ .keyboardShortcut(.defaultAction)
+ .disabled(!isValid)
+ }
+ .frame(width: 420)
+ .fixedSize(horizontal: false, vertical: true)
+ .onAppear { name = VPhoneLaunchpadMachineSnapshot.defaultName(at: Date(), taken: taken) }
+ }
+}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swift b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swift
index 4a81eb3d..2a3a2f9d 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swift
@@ -77,8 +77,10 @@ nonisolated enum VPhoneLaunchpadNames {
/// (`--ip`, `--mac`, `--forward`, `--mdns`, `--mac-name`), which a
/// machine's Settings pass. 2.5.0 added `vm leases`, which Host Setup
/// lists and the helper runs to release orphaned DHCP leases. 2.6.0 added
- /// `vm config --unlock-at-startup`, which a machine's Settings pass.
- private static let minimumBundleComponents = (2, 6, 0)
+ /// `vm config --unlock-at-startup`, which a machine's Settings pass. 2.7.0
+ /// added `vm clone --new-identity`, which Clone passes, and
+ /// `vm snapshot`, which the Snapshots sheet runs.
+ private static let minimumBundleComponents = (2, 7, 0)
static let minimumBundleVersion =
"\(minimumBundleComponents.0).\(minimumBundleComponents.1).\(minimumBundleComponents.2)"