Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Create Launchpad machines from slimmed templates

Jacky0de9048b1698
diff --git a/Documents/Guides/create-and-run.md b/Documents/Guides/create-and-run.md
index 56ccdb37..cc245501 100644
--- a/Documents/Guides/create-and-run.md
+++ b/Documents/Guides/create-and-run.md
@@ -42,7 +42,7 @@ The guest shows the VM's name as its device name, in Xcode's device list and `xc
## Templates
-A template is a complete machine kept in `<library>/.templates/<id>/`. It boots once while it is built, its setup boot, and never again once it is frozen. `vm create` without `--no-template` works out the template key from its options and the two IPSWs before anything is restored: the guest device, the iOS and cloudOS versions and builds, the patch preset and the boot-chain patches it resolves to, the bundle series (`2.8` for 2.8.x), the disk size, what is trimmed from the guest's System volume (`--trim`), and the slimming switches below. Then:
+A template is a complete machine kept in `<library>/.templates/<id>/`. It boots once while it is built, its setup boot, and never again once it is frozen. `vm create` without `--no-template` works out the template key from its options and the two IPSWs before anything is restored: the guest device, the iOS and cloudOS versions and builds, the patch preset and the boot-chain patches it resolves to, the bundle series (`2.9` for 2.9.x), the disk size, what is trimmed from the guest's System volume (`--trim`), and the slimming switches below. Then:
- If a template with that key exists, the VM is cloned from it with a new identity, given the requested CPU, memory and network, and booted once to check vphoned. This takes seconds and needs neither root nor the IPSWs; nothing is downloaded.
- Otherwise the full pipeline runs into a staging folder, `.templates/.building-<id>-<uuid>/`: `cfw install`, the offline trim, then the setup boot; the result is frozen and renamed to `.templates/<id>/` in one step, and the VM is cloned from it. The restore tree is removed before the freeze whatever `--keep-artifacts` says: a template never keeps it, because its ~11 GB would stay pinned for as long as the template lives and no clone can use it. `--keep-artifacts` keeps it only with `--no-template`, and `vm template adopt` removes it too. A second `vm create` with the same key waits for the first instead of restoring a second copy. A failed build stays in its staging folder for inspection.
@@ -94,24 +94,44 @@ Every step has a deadline. A failed step stops the VM, records nothing and leave
| `--keep-apps <ids>` | none | Bundle IDs from that list to keep, comma-separated (`com.apple.findmy,com.apple.Passbook`). |
| `--accounts-off` | off | Also turns off `akd`, `amsaccountsd` and `appleaccountd`. The guest then cannot sign in to an Apple Account. |
-Each choice is part of the key, so templates with different slimming live side by side and each serves only the creates that ask for it. Removed apps and the profile stay reversible on a clone: `apps.restore_system` puts an app back from its backup, and `services.profile.apply {"profile":"none"}` turns back on exactly what the profile turned off (both through `vphone-launchpad-cli guest rpc`).
+Each choice is part of the key, so templates with different slimming live side by side and each serves only the creates that ask for it. Removed apps and the profile stay reversible on a clone: `apps.restore_system` puts an app back from its backup, and `services.profile.apply {"profile":"none"}` turns back on exactly what the profile turned off (both through `vphone-launchpad-cli guest rpc`, or Guest System in Launchpad).
What every clone inherits from the template: Setup done, the apps and services as the setup boot left them, the first-boot work installd and the indexers did, and the Data volume as of that boot. It does not inherit a device name: the template's pin is cleared, so a clone shows `iPhone` until its own VM connects and pins the clone's name. A new identity also means the Mac asks "Trust This Computer?" again.
### Finishing a VM as a template
-Launchpad builds a machine with its own pipeline and boots it once, leaving it at Setup. To turn such a machine (or any VM straight after creating it) into a template, stop it, trim it, give it the setup boot, and adopt it:
+To turn a VM straight after creating it into a template, stop it, trim it, give it the setup boot, and adopt it. This is what Launchpad does for a template it has to build (below):
```sh
vphone-cli vm stop phone-src
vphone-cli vm template trim phone-src --tier standard # offline, no root; frees nothing until the setup boot
vphone-cli vm template setup phone-src # headless; --window to watch, slimming switches as for vm create
-vphone-cli vm template adopt phone-src # key from its records and what the setup boot recorded
+vphone-cli vm template adopt phone-src --iphone-source … --cloudos-source … # key from its records; the sources are recorded
vphone-cli vm create phone-d --template <id> --skip-first-boot
```
+`--iphone-source` and `--cloudos-source` on `vm template adopt` record the IPSWs the VM was created from in its `Template.plist`, as a `vm create` that builds a template does. `--json` prints the new template as `vm template show --json` does.
+
`vm template setup` refuses a running VM and a frozen template. It trims nothing itself: the tier `vm template trim` recorded is kept, and a `--trim` that names another tier is refused. On a VM it reports an app vphoned would not remove and leaves it out of the recorded steps, so the adopted key says what was really done. Given a `.building-…` name from `vm template list` (a `vm create` whose setup boot failed), it sets the build up to its key, which fixes the slimming, runs the offline trim first if the build stopped before it, and freezes it on success.
+### Finding a template
+
+`vm template find` answers what template a `vm create` with the same options would clone from, without downloading, restoring or changing anything:
+
+```sh
+vphone-cli vm template find --iphone-source … --cloudos-source … [--device …] [--preset …] [--disk-size …] [--block <id>] [--allow <id>] [slimming switches] --json
+```
+
+It works out the key as `vm create` does. The builds come from the IPSWs when they are local files or already in the IPSW cache, and otherwise from a template whose record names the same two sources, so the key still resolves once the IPSWs were deleted. `--block` and `--allow` are per-patch overrides as `fw set-patches` records them. The JSON has `resolved`, `resolvedBy` (`ipsw` or `template`), `id`, `summary`, `key`, `template` (the matching template as `vm template show --json` prints it, current or stale), `usable` (it exists and is current), `building` (a create holds its build lock) and, when unresolved, `reason`.
+
+### In Launchpad
+
+Launchpad 2.9 creates machines from templates by default. New Machine has a Slim System switch on its General page and the parts on its Template page: the trim tier and kept languages, the service profile, Apple Account, and which system apps go. Turning off Create from a template restores the machine on its own, as `--no-template` does, with keys of its own and without slimming.
+
+The creation runs `vm template find` first. When a current template matches, it clones the machine (`vm create --template <id> --skip-first-boot`) and boots it. When none does, it builds the template in a temporary machine of the same library, named `template-` and eight hex digits, with its usual steps (restore, then `cfw install` through the helper), then `vm template trim`, the headless `vm template setup` and `vm template adopt --iphone-source … --cloudos-source …`, and clones the machine from the result. Each is a step of its own with its duration, and a failed one shows the reason `vphone-cli` gave. Once it has built a template, the creation offers to delete the two IPSWs it came from; nothing is deleted without confirming.
+
+File > Templates… lists every library's templates with their machines, slimming, size and state, and deletes them. Guest System… (in a machine's Actions menu and inspector) switches a running machine's service profile and restores system apps the template removed. The inspector and the machine list show each machine's exclusive disk use, the blocks only it holds, beside what its files allocate.
+
### Shared secrets
Every machine cloned from one template shares, with the template and with each other, its SEP root secret, its Data volume keys and the data the restore and the setup boot wrote. One clone could in principle decrypt another's Data volume. A VM that needs keys of its own, for example to sign in to Apple services for multi-device research, should be created with `--no-template` (which takes no slimming switches). Clones get a new ECID, UDID and MAC address on their first start, as with `vm clone --new-identity`, and share every unchanged block with the template on APFS: a new clone costs almost nothing until it starts writing, and a slimmed template leaves it little first-boot work to write.
diff --git a/Documents/Guides/launchpad-cli.md b/Documents/Guides/launchpad-cli.md
index 36118734..f61e65c5 100644
--- a/Documents/Guides/launchpad-cli.md
+++ b/Documents/Guides/launchpad-cli.md
@@ -113,7 +113,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 |
| `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 |
| `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>] [--from <step>]` | The New Machine pipeline, bound to `--bundle` or the default; `--device` makes an iPad guest, `--from` retries from a step |
+| `vm create <name> [--bundle <version>] [...] [--device <product-type>] [--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. `--device` makes an iPad guest, `--from` retries from a step (`findTemplate` … `firstBoot`); the result names the template and whether this creation built it |
| `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 |
| `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. |
diff --git a/Research/Host/machine_templates.md b/Research/Host/machine_templates.md
index 3c11ae6d..1570c983 100644
--- a/Research/Host/machine_templates.md
+++ b/Research/Host/machine_templates.md
@@ -76,7 +76,13 @@ re-resolves with the template's own `PatchSelection.plist`.
- `Template.plist`: `Identifier`, `Key`, `Created`, `BuiltWithBundleVersion`,
`BootChainBundleVersion`, `SourceMachine` (the name a derived mDNS name
follows from), `Frozen`, `FrozenAt`, `Steps` (`SnapshotDeleted`,
- `SetupDone`, `ServiceProfile`, `ServiceGroups`, `RemovedApps`, `TrimTier`).
+ `SetupDone`, `ServiceProfile`, `ServiceGroups`, `RemovedApps`, `TrimTier`),
+ `Sources` (`IPhone`, `CloudOS`: the IPSW sources a `vm create` build or
+ `vm template adopt --iphone-source … --cloudos-source …` named; not part of
+ the key). `vm template find` resolves a request whose IPSWs are neither
+ local nor cached from a template recorded with the same sources
+ (`VPhoneMachineTemplates.templates(builtFrom:device:in:)`), so Launchpad
+ can offer to delete a template's IPSWs.
- `TemplateSource.plist` in a machine cloned from a template: `Identifier`,
`Cloned`. A plain `vm clone` keeps it (the copy shares the template's
blocks too); `vm export` excludes it (an import shares nothing).
@@ -346,11 +352,27 @@ made after the latest one, as these clones were.
A failure leaves the build; `vm template setup .building-…` runs the trim
if the build stopped before it recorded one, retries the setup boot under
the lock and freezes the build on success.
-- **Launchpad** (P5) builds a machine with its step-by-step pipeline, whose
- first boot leaves it running at Setup; it stops it, runs
- `vm template trim <name> --tier …`, `vm template setup <name> [switches]`,
- `vm template adopt <name>`, then `vm create <name> --template <id>
- --skip-first-boot` and its own first boot. `vm template trim` and
+- **Launchpad** (2.9, `VPhoneLaunchpadCreationPipeline`, steps in
+ `VPhoneLaunchpadCreationPlan`) first runs `vm template find --json` with
+ the request (IPSW sources, device, preset and per-patch overrides, disk
+ size, slimming switches). A usable template is cloned at once. Otherwise it
+ builds one in a temporary library machine `template-<8 hex>`: `vm new`,
+ `fw prepare`, `fw patch`, the DFU restore and `cfw install` through the
+ helper, without its own first boot; then `vm template trim <name> --tier …`
+ (left out for trim none), `vm template setup <name> [switches]` (headless),
+ `vm template adopt <name> --json --iphone-source … --cloudos-source …`, then
+ `vm create <name> --template <id> --skip-first-boot --cpu … --memory …
+ --network …` and its own first boot. An adopt refused because another
+ create saved the same key meanwhile falls back to that template and deletes
+ the build. The helper's root surface is unchanged: `cfw install` runs on
+ the temporary machine, a visible library machine, before it is adopted;
+ trim, setup and adopt run as the user. The setup boot's `vphone-vm` is
+ spawned by `vphone-cli`, itself a pipe child of Launchpad like the
+ pipeline's DFU boot, not through `vphone-launchpad-launcher`, so Launchpad
+ is its responsible process while it runs: a privacy prompt would be
+ Launchpad's own (it carries the microphone and location entitlements), and
+ quitting Launchpad interrupts the build, which the quit confirmation for a
+ running creation already covers. `vm template trim` and
`vm template setup` on a library machine write an unfrozen `Template.plist`
(key from its records) when it has none, and record their steps there.
The setup boot trims nothing: it keeps the tier `vm template trim`
diff --git a/VPhoneLaunchpad/Tests/BundleNamesTests.swift b/VPhoneLaunchpad/Tests/BundleNamesTests.swift
index 80a709da..f06d9c0d 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.8.2", bundleVersion: "2.8.2", isLocalBuild: false, isCompatible: true, isValid: true),
- Expectation(name: "2.8.2-local", bundleVersion: "2.8.2", isLocalBuild: true, isCompatible: true, isValid: true),
- Expectation(name: "2.8.2-local.ab12cd34", bundleVersion: "2.8.2", isLocalBuild: true, isCompatible: true, isValid: true),
+ Expectation(name: "2.9.2", bundleVersion: "2.9.2", isLocalBuild: false, isCompatible: true, isValid: true),
+ Expectation(name: "2.9.2-local", bundleVersion: "2.9.2", isLocalBuild: true, isCompatible: true, isValid: true),
+ Expectation(name: "2.9.2-local.ab12cd34", bundleVersion: "2.9.2", isLocalBuild: true, isCompatible: true, isValid: true),
// The build identifier is lowercase hex; uppercase is no build.
- Expectation(name: "2.8.2-local.AB12CD34", bundleVersion: "2.8.2-local.AB12CD34", isLocalBuild: false, isCompatible: false, isValid: true),
- Expectation(name: "2.8.2-local.ab12", bundleVersion: "2.8.2-local.ab12", isLocalBuild: false, isCompatible: false, isValid: true),
- Expectation(name: "2.8.2-ci.abcdef1", bundleVersion: "2.8.2", isLocalBuild: false, isCompatible: true, isValid: true),
- Expectation(name: "2.7.9-local.ab12cd34", bundleVersion: "2.7.9", isLocalBuild: true, isCompatible: false, isValid: true),
+ Expectation(name: "2.9.2-local.AB12CD34", bundleVersion: "2.9.2-local.AB12CD34", isLocalBuild: false, isCompatible: false, isValid: true),
+ Expectation(name: "2.9.2-local.ab12", bundleVersion: "2.9.2-local.ab12", isLocalBuild: false, isCompatible: false, isValid: true),
+ Expectation(name: "2.9.2-ci.abcdef1", bundleVersion: "2.9.2", isLocalBuild: false, isCompatible: true, isValid: true),
+ Expectation(name: "2.8.9-local.ab12cd34", bundleVersion: "2.8.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/TemplatesTests.sh b/VPhoneLaunchpad/Tests/TemplatesTests.sh
new file mode 100755
index 00000000..b0b99488
--- /dev/null
+++ b/VPhoneLaunchpad/Tests/TemplatesTests.sh
@@ -0,0 +1,16 @@
+#!/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/VPhoneLaunchpad/Machines/VPhoneLaunchpadTemplates.swift" \
+ "$launchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPlan.swift" \
+ "$launchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadDiskUsage.swift" \
+ "$launchpad/Tests/TemplatesTests.swift" \
+ -o "$temporary/templates-tests"
+"$temporary/templates-tests" "$@"
diff --git a/VPhoneLaunchpad/Tests/TemplatesTests.swift b/VPhoneLaunchpad/Tests/TemplatesTests.swift
new file mode 100644
index 00000000..4159fc3b
--- /dev/null
+++ b/VPhoneLaunchpad/Tests/TemplatesTests.swift
@@ -0,0 +1,392 @@
+import Darwin
+import Foundation
+
+@main
+struct TemplatesTests {
+ static func main() throws {
+ slimmingArguments()
+ commandArguments()
+ creationPlan()
+ try templateList()
+ try templateFind()
+ notices()
+ try diskUsage()
+ }
+
+ // MARK: - Switches
+
+ static func slimmingArguments() {
+ let standard = VPhoneLaunchpadSlimming()
+ precondition(standard.arguments.isEmpty, "The defaults pass nothing: \(standard.arguments)")
+ precondition(standard.setupArguments.isEmpty, "Setup takes the defaults too")
+ precondition(standard.trimArguments == ["--tier", "standard"], "Standard trim: \(standard.trimArguments ?? [])")
+ precondition(standard.removedApps.count == 10, "Ten apps go by default")
+ precondition(!standard.removedApps.contains("com.apple.camera") && !standard.removedApps.contains("com.apple.mobilephone"),
+ "Camera and Phone are never removed")
+
+ var off = VPhoneLaunchpadSlimming()
+ off.slim = false
+ // The other switches keep their values but count for nothing.
+ off.trim = .conservative
+ off.trimsServices = false
+ off.accountsOff = true
+ off.keptApps = ["com.apple.news"]
+ precondition(off.arguments == ["--slim", "off"], "Slim off alone: \(off.arguments)")
+ precondition(off.setupArguments == ["--slim", "off"], "Setup with slim off")
+ precondition(off.trimArguments == nil, "Slim off trims nothing")
+ precondition(off.removedApps.isEmpty, "Slim off removes no app")
+
+ var parts = VPhoneLaunchpadSlimming()
+ parts.trim = .conservative
+ parts.keptLanguages = "en, ja"
+ parts.trimsServices = false
+ parts.accountsOff = true
+ parts.keptApps = ["com.apple.Passbook", "com.apple.findmy", "com.apple.camera"]
+ // Languages count only for the standard tier; accounts only with the
+ // trimmed profile; Camera is not one of the apps.
+ precondition(parts.arguments == ["--trim", "conservative", "--service-profile", "none",
+ "--keep-apps", "com.apple.findmy,com.apple.Passbook"],
+ "Mixed switches: \(parts.arguments)")
+ precondition(parts.setupArguments == ["--service-profile", "none", "--keep-apps", "com.apple.findmy,com.apple.Passbook"],
+ "Setup drops the trim: \(parts.setupArguments)")
+ precondition(parts.trimArguments == ["--tier", "conservative"], "Conservative trim keeps no languages")
+
+ var languages = VPhoneLaunchpadSlimming()
+ languages.keptLanguages = " en , ja ,"
+ languages.accountsOff = true
+ precondition(languages.arguments == ["--keep-languages", "en,ja", "--accounts-off"], "Languages: \(languages.arguments)")
+ precondition(languages.setupArguments == ["--accounts-off"], "Setup leaves the languages to the trim")
+ precondition(languages.trimArguments == ["--tier", "standard", "--keep-languages", "en,ja"], "Trim with languages")
+ languages.keptLanguages = "en,zh-Hans,zh"
+ precondition(languages.languagesArgument == nil, "The default languages are not passed")
+ languages.keptLanguages = "en,日本語"
+ precondition(languages.problem != nil, "A language that is no code is refused")
+ languages.keptLanguages = "en,zh-Hant,pt-BR"
+ precondition(languages.problem == nil, "Codes with a region or script pass")
+
+ var noApps = VPhoneLaunchpadSlimming()
+ noApps.removesApps = false
+ noApps.keptApps = ["com.apple.news"]
+ precondition(noApps.arguments == ["--remove-apps", "off"], "Remove apps off ignores the kept list")
+
+ var none = VPhoneLaunchpadSlimming()
+ none.trim = .none
+ precondition(none.arguments == ["--trim", "none"] && none.trimArguments == nil, "No trim step for tier none")
+ print("Slimming switch tests passed")
+ }
+
+ // MARK: - Commands
+
+ static func commandArguments() {
+ var slimming = VPhoneLaunchpadSlimming()
+ slimming.trimsServices = false
+ let request = VPhoneLaunchpadTemplateCommands.Request(
+ iphoneSource: "https://example.invalid/iPhone17,3_27.0_24A435_Restore.ipsw",
+ cloudOSSource: "https://example.invalid/cloudos",
+ device: "iPad16,1",
+ preset: "standard",
+ blocked: ["kernel-b", "kernel-a"],
+ allowed: ["dyld-x"],
+ diskSizeGB: 128,
+ slimming: slimming,
+ )
+ let find = VPhoneLaunchpadTemplateCommands.find(request)
+ precondition(find == [
+ "vm", "template", "find", "--json",
+ "--iphone-source", "https://example.invalid/iPhone17,3_27.0_24A435_Restore.ipsw",
+ "--cloudos-source", "https://example.invalid/cloudos",
+ "--device", "iPad16,1", "--preset", "standard", "--disk-size", "128",
+ "--block", "kernel-a", "--block", "kernel-b", "--allow", "dyld-x",
+ "--service-profile", "none",
+ ], "find: \(find)")
+
+ precondition(VPhoneLaunchpadTemplateCommands.trim("template-1a2b3c4d", slimming)
+ == ["vm", "template", "trim", "template-1a2b3c4d", "--tier", "standard"], "trim")
+ var untrimmed = slimming
+ untrimmed.trim = .none
+ precondition(VPhoneLaunchpadTemplateCommands.trim("t", untrimmed) == nil, "No trim command for tier none")
+ precondition(VPhoneLaunchpadTemplateCommands.setup("template-1a2b3c4d", slimming)
+ == ["vm", "template", "setup", "template-1a2b3c4d", "--service-profile", "none"], "setup")
+ precondition(VPhoneLaunchpadTemplateCommands.adopt("template-1a2b3c4d", iphoneSource: "i", cloudOSSource: "c")
+ == ["vm", "template", "adopt", "template-1a2b3c4d", "--json", "--iphone-source", "i", "--cloudos-source", "c"], "adopt")
+ precondition(VPhoneLaunchpadTemplateCommands.clone("lab-01", template: "52b1fcc75e0c", cpuCount: 6, memoryMB: 6144, network: "tunnel")
+ == ["vm", "create", "lab-01", "--template", "52b1fcc75e0c", "--skip-first-boot",
+ "--cpu", "6", "--memory", "6144", "--network", "tunnel"], "clone")
+ precondition(VPhoneLaunchpadTemplateCommands.delete("52b1fcc75e0c") == ["vm", "template", "delete", "52b1fcc75e0c", "--force"], "delete")
+
+ let failure = ["[setup] failed at setup-skip: refused", "Error: Setup boot failed at step setup-skip (a. skip Setup Assistant): refused"]
+ precondition(VPhoneLaunchpadTemplateCommands.failureLine(failure) == "Setup boot failed at step setup-skip (a. skip Setup Assistant): refused",
+ "The error line is the reason")
+ precondition(VPhoneLaunchpadTemplateCommands.failureLine(["fine"]) == nil, "No error line")
+ print("Command argument tests passed")
+ }
+
+ // MARK: - Plan
+
+ static func creationPlan() {
+ let alone = VPhoneLaunchpadCreationPlan(name: "lab-01", buildName: nil, slimming: VPhoneLaunchpadSlimming())
+ precondition(alone.steps == [.create, .prepare, .patch, .bootDFU, .waitDFU, .restore, .stopDFU, .installCFW, .firstBoot],
+ "Without a template: \(alone.steps)")
+ precondition(alone.machineName(for: .create) == "lab-01" && alone.machineName(for: .installCFW) == "lab-01", "One machine")
+
+ let build = VPhoneLaunchpadCreationPlan.newBuildName()
+ precondition(build.wholeMatch(of: /template-[0-9a-f]{8}/) != nil, "Build name: \(build)")
+ precondition(VPhoneLaunchpadNames.isValidMachineName(build), "The build name is a machine name")
+
+ var plan = VPhoneLaunchpadCreationPlan(name: "lab-01", buildName: build, slimming: VPhoneLaunchpadSlimming())
+ let full: [VPhoneLaunchpadCreationStep] = [.findTemplate, .create, .prepare, .patch, .bootDFU, .waitDFU, .restore, .stopDFU,
+ .installCFW, .trimTemplate, .setUpTemplate, .adoptTemplate, .cloneTemplate, .firstBoot]
+ precondition(plan.steps == full, "Until Find answers, the build is listed: \(plan.steps)")
+ plan.foundTemplate = false
+ precondition(plan.steps == full, "A template to build")
+ precondition(plan.step(after: .installCFW) == .trimTemplate, "Trim follows CFW")
+ precondition(plan.machineName(for: .installCFW) == build, "CFW goes into the build")
+ precondition(plan.machineName(for: .adoptTemplate) == build, "The build is adopted")
+ precondition(plan.machineName(for: .cloneTemplate) == "lab-01" && plan.machineName(for: .firstBoot) == "lab-01",
+ "The clone and its boot are the new machine")
+ precondition(plan.machineName(for: .findTemplate) == "lab-01", "Find names the new machine")
+ precondition(plan.steps.allSatisfy { $0.needsRoot == ($0 == .installCFW) }, "Only CFW needs root")
+
+ plan.slimming.slim = false
+ precondition(!plan.steps.contains(.trimTemplate), "Slim off: no trim step")
+ precondition(plan.step(after: .installCFW) == .setUpTemplate, "Setup follows CFW without a trim")
+
+ plan.foundTemplate = true
+ precondition(plan.steps == [.findTemplate, .cloneTemplate, .firstBoot], "A template found: \(plan.steps)")
+ precondition(plan.step(after: .findTemplate) == .cloneTemplate, "Straight to the clone")
+ precondition(plan.step(after: .firstBoot) == nil, "First boot is last")
+ print("Creation plan tests passed")
+ }
+
+ // MARK: - JSON
+
+ /// `vm template list --json` as 2.9.0 prints it: pretty, keys sorted,
+ /// slashes escaped, empty arrays over two lines.
+ static let listJSON = #"""
+ {
+ "building" : [
+ {
+ "active" : false,
+ "id" : "0e44975ff833",
+ "name" : ".building-0e44975ff833-7A1C",
+ "path" : "\/Users\/me\/.vphone\/machines\/.templates\/.building-0e44975ff833-7A1C"
+ }
+ ],
+ "damaged" : [
+
+ ],
+ "templates" : [
+ {
+ "allocatedBytes" : 17580000000,
+ "bootChainBundleVersion" : "2.9.0",
+ "builtWithBundleVersion" : "2.9.0",
+ "created" : "2026-10-08T10:00:00Z",
+ "diskSizeBytes" : 64000000000,
+ "id" : "52b1fcc75e0c",
+ "key" : {
+ "BootChainPlanDigest" : "01e930903b5c6b6dd87e0a3a20a2d3a5fe1813645577d6e14f6ead8fdbc49153",
+ "BundleSeries" : "2.9",
+ "CloudOSBuild" : "23E5207q",
+ "CloudOSVersion" : "26.4",
+ "Device" : "iPhone17,3",
+ "DiskSizeGB" : 64,
+ "FormatVersion" : 2,
+ "IOSBuild" : "24A435",
+ "IOSVersion" : "27.0",
+ "PatchPreset" : "standard",
+ "Slimming" : {
+ "RemovedApps" : [
+ "com.apple.AppStore",
+ "com.apple.news"
+ ],
+ "ServiceGroups" : [
+ "accounts"
+ ],
+ "ServiceProfile" : "trimmed",
+ "SetupBoot" : true,
+ "TrimTier" : "standard\/1\/en,zh,zh-Hans"
+ }
+ },
+ "machines" : [
+ "e2e-a",
+ "e2e-b"
+ ],
+ "path" : "\/Users\/me\/.vphone\/machines\/.templates\/52b1fcc75e0c",
+ "sourceMachine" : "template-1a2b3c4d",
+ "sources" : {
+ "CloudOS" : "https:\/\/example.invalid\/cloudos",
+ "IPhone" : "https:\/\/example.invalid\/iPhone17,3_27.0_24A435_Restore.ipsw"
+ },
+ "stale" : true,
+ "staleReasons" : [
+ "built by bundle series 2.8; this vphone-cli is 2.9"
+ ],
+ "steps" : {
+ "RemovedApps" : [
+
+ ],
+ "ServiceGroups" : [
+
+ ],
+ "ServiceProfile" : "trimmed",
+ "SetupDone" : true,
+ "SnapshotDeleted" : true,
+ "TrimTier" : "standard\/1\/en,zh,zh-Hans"
+ }
+ },
+ {
+ "allocatedBytes" : 18920000000,
+ "created" : "2026-10-07T10:00:00Z",
+ "diskSizeBytes" : 64000000000,
+ "id" : "2246f982776c",
+ "key" : {
+ "BootChainPlanDigest" : "ab",
+ "BundleSeries" : "2.9",
+ "CloudOSBuild" : "23E5207q",
+ "CloudOSVersion" : "26.4",
+ "Device" : "iPad16,1",
+ "DiskSizeGB" : 64,
+ "FormatVersion" : 2,
+ "IOSBuild" : "24A446",
+ "IOSVersion" : "27.0.1",
+ "PatchPreset" : "standard",
+ "Slimming" : {
+ "RemovedApps" : [
+
+ ],
+ "ServiceProfile" : "none",
+ "SetupBoot" : true,
+ "TrimTier" : "none"
+ }
+ },
+ "machines" : [
+
+ ],
+ "path" : "\/Users\/me\/.vphone\/machines\/.templates\/2246f982776c",
+ "stale" : false,
+ "staleReasons" : [
+
+ ],
+ "steps" : {
+ "SetupDone" : true
+ }
+ }
+ ]
+ }
+ """#
+
+ static func templateList() throws {
+ // A warning on stderr may come first; the document is found the
+ // way every other --json output is.
+ let lines = ["warning: something"] + listJSON.split(separator: "\n", omittingEmptySubsequences: false).map(String.init)
+ guard let start = lines.lastIndex(where: { $0.hasPrefix("[") || $0.hasPrefix("{") }) else {
+ preconditionFailure("No document")
+ }
+ let data = Data(lines[start...].joined(separator: "\n").utf8)
+ let list = try VPhoneLaunchpadTemplateList.decode(data, libraryRoot: "/Users/me/.vphone/machines")
+ precondition(list.templates.count == 2 && list.building.count == 1 && list.damaged.isEmpty, "Counts")
+ let first = list.templates[0]
+ precondition(first.id == "52b1fcc75e0c" && first.libraryRoot == "/Users/me/.vphone/machines", "Identity")
+ precondition(first.key.device == "iPhone17,3" && first.key.iOSBuild == "24A435" && first.key.diskSizeGB == 64, "Key")
+ precondition(first.key.slimming.tier == "standard" && first.key.slimming.keptLanguages == "en,zh,zh-Hans", "Tier")
+ precondition(first.machines == ["e2e-a", "e2e-b"] && first.allocatedBytes == 17_580_000_000, "Usage")
+ precondition(first.stale && first.staleReasons.count == 1, "Stale")
+ precondition(first.sources?.iPhone == "https://example.invalid/iPhone17,3_27.0_24A435_Restore.ipsw", "Sources")
+ precondition(first.created == Date(timeIntervalSince1970: 1_791_453_600), "Created \(first.created)")
+ precondition(first.key.slimming.isSlimmed, "Slimmed")
+
+ let second = list.templates[1]
+ precondition(second.key.osName == "iPadOS" && second.key.slimming.serviceGroups.isEmpty, "Format 1 slimming has no groups")
+ precondition(!second.key.slimming.isSlimmed && second.sources == nil && second.bootChainBundleVersion == nil, "Plain template")
+ precondition(list.building[0].id == "0e44975ff833" && !list.building[0].active, "Unfinished build")
+ print("Template list decoding tests passed")
+ }
+
+ static func templateFind() throws {
+ let unresolved = #"{"building":false,"reason":"the IPSWs are not downloaded and no template records these sources","resolved":false,"usable":false}"#
+ let none = try VPhoneLaunchpadTemplateFind.decode(Data(unresolved.utf8))
+ precondition(!none.resolved && none.id == nil && none.template == nil && none.reason != nil, "Unresolved")
+
+ let templateJSON = listJSON
+ .components(separatedBy: "\"templates\" : [")[1]
+ .components(separatedBy: "},\n {")[0] + "}"
+ let found = """
+ {"building":false,"id":"52b1fcc75e0c","resolved":true,"resolvedBy":"template","summary":"…","template":\(templateJSON),"usable":false}
+ """
+ let match = try VPhoneLaunchpadTemplateFind.decode(Data(found.utf8))
+ precondition(match.resolved && match.resolvedBy == "template" && match.id == "52b1fcc75e0c", "Resolved")
+ precondition(match.template?.stale == true && !match.usable, "A stale template is not usable")
+ print("Template find decoding tests passed")
+ }
+
+ // MARK: - Delete note
+
+ static func notices() {
+ let lines = [
+ "deleted e2e-b",
+ "note: template 52b1fcc75e0c (~17.58 GB) is no longer used by any machine; remove it with `vphone-cli vm template delete 52b1fcc75e0c`",
+ ]
+ let notice = VPhoneLaunchpadTemplateNotice.parse(lines, libraryRoot: "/lib")
+ precondition(notice == VPhoneLaunchpadTemplateNotice(id: "52b1fcc75e0c", size: "17.58 GB", libraryRoot: "/lib"), "Notice: \(String(describing: notice))")
+ precondition(VPhoneLaunchpadTemplateNotice.parse(["deleted e2e-a"], libraryRoot: "/lib") == nil, "No note, no notice")
+ precondition(VPhoneLaunchpadTemplateNotice.parse(["note: template ../x (~1 GB) is no longer used by any machine"], libraryRoot: "/lib") == nil,
+ "Only a template identifier")
+ print("Delete note tests passed")
+ }
+
+ // MARK: - Disk use
+
+ static func diskUsage() throws {
+ let english = Locale(identifier: "en_US")
+ precondition(VPhoneLaunchpadDiskUsage.format(17_580_000_000, locale: english) == "17.58 GB",
+ VPhoneLaunchpadDiskUsage.format(17_580_000_000, locale: english))
+ precondition(VPhoneLaunchpadDiskUsage.format(610_000_000, locale: english) == "610 MB",
+ VPhoneLaunchpadDiskUsage.format(610_000_000, locale: english))
+ let partial = VPhoneLaunchpadDiskUsage(allocated: 17_580_000_000, exclusive: 610_000_000)
+ precondition(partial.summary(locale: english).contains("610 MB") && partial.summary(locale: english).contains("17.58 GB"),
+ partial.summary(locale: english))
+ precondition(VPhoneLaunchpadDiskUsage(allocated: 1_000_000_000, exclusive: nil).summary(locale: english) == "1 GB", "Without a private size")
+
+ // A clone shares its blocks until it writes: on APFS (the temporary
+ // directory is on the boot volume) the original keeps its blocks to
+ // itself only once the clone has rewritten them.
+ let fm = FileManager.default
+ let folder = fm.temporaryDirectory.appendingPathComponent("disk-usage-\(UUID().uuidString)", isDirectory: true)
+ defer { try? fm.removeItem(at: folder) }
+ let machine = folder.appendingPathComponent("machine", isDirectory: true)
+ try fm.createDirectory(at: machine, withIntermediateDirectories: true)
+ let disk = machine.appendingPathComponent("Disk.img")
+ let block = Data((0 ..< (8 << 20)).map { UInt8(truncatingIfNeeded: $0 &* 31) })
+ try block.write(to: disk)
+ let alone = try require(VPhoneLaunchpadDiskUsage.privateSize(of: disk.path), "A private size on APFS")
+ precondition(alone >= 8 << 20, "A file shares nothing yet: \(alone)")
+
+ let clone = folder.appendingPathComponent("clone.img")
+ precondition(clonefile(disk.path, clone.path, 0) == 0, "clonefile")
+ let shared = try require(VPhoneLaunchpadDiskUsage.privateSize(of: disk.path), "Private size after a clone")
+ precondition(shared < 1 << 20, "A cloned file shares its blocks: \(shared)")
+
+ let handle = try FileHandle(forWritingTo: clone)
+ try handle.write(contentsOf: Data(repeating: 0x5A, count: 2 << 20))
+ try handle.synchronize()
+ try handle.close()
+ let written = try require(VPhoneLaunchpadDiskUsage.privateSize(of: clone.path), "Private size of the written clone")
+ precondition(written >= 2 << 20 && written < 4 << 20, "Only rewritten blocks are its own: \(written)")
+
+ // The folder's own walk: everything allocated, little of it exclusive.
+ let usage = VPhoneLaunchpadDiskUsage.measure(machine)
+ precondition(usage.allocated >= 8 << 20, "Allocated \(usage.allocated)")
+ precondition((usage.exclusive ?? .max) <= 3 << 20, "Exclusive \(String(describing: usage.exclusive))")
+ let link = machine.appendingPathComponent("link.img")
+ try fm.createSymbolicLink(at: link, withDestinationURL: clone)
+ precondition(VPhoneLaunchpadDiskUsage.measure(machine).allocated == usage.allocated, "A link is not followed")
+ print("Disk use tests passed")
+ }
+
+ static func require<T>(_ value: T?, _ message: String) throws -> T {
+ guard let value else {
+ preconditionFailure(message)
+ }
+ return value
+ }
+}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadApp.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadApp.swift
index d5fd8404..7337f831 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadApp.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadApp.swift
@@ -28,6 +28,7 @@ struct VPhoneLaunchpadApp: App {
.commands {
CommandGroup(replacing: .newItem) {
Button("Downloaded IPSWs…") { model.present(.ipswCache) }
+ Button("Templates…") { model.present(.templates) }
}
CommandGroup(after: .appSettings) {
Button("Host Setup…") { model.present(.hostSetup) }
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift
index 9d11a9a1..a808708d 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift
@@ -13,6 +13,7 @@ final class VPhoneLaunchpadModel {
case coreBundle
case bundleInstall
case ipswCache
+ case templates
var id: Self {
self
@@ -24,6 +25,7 @@ final class VPhoneLaunchpadModel {
case .coreBundle: String(localized: "Core Bundle")
case .bundleInstall: String(localized: "Core Bundle Install")
case .ipswCache: String(localized: "Downloaded IPSWs")
+ case .templates: String(localized: "Templates")
}
}
}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift
index 92617260..01da018f 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift
@@ -35,7 +35,7 @@
helper: model.helper,
library: model.machines,
)
- creation.applyPreview()
+ creation.applyPreview(.restoring)
model.machines.applyPreview(creation: creation)
for command in commands.dropLast() {
model.history.finish(model.history.record(command), status: 0)
@@ -86,7 +86,7 @@
await shot("05a-machines-no-inspector", suffix)
model.showsInspector = true
if let machine = model.machines.selected {
- await standalone("05b-machine-inspector", suffix, size: NSSize(width: 380, height: 980)) {
+ await standalone("05b-machine-inspector", suffix, size: NSSize(width: 380, height: 1500)) {
VPhoneLaunchpadMachineInspector(machine: machine, onShowProgress: { _ in }, onOpenConsole: { _ in })
.environment(model)
}
@@ -100,13 +100,23 @@
await sheet(.newMachine, "07-new-machine-hardware", suffix)
newMachinePage = .advanced
await sheet(.newMachine, "07-new-machine-advanced", suffix)
+ newMachinePage = .template
+ await sheet(.newMachine, "07b-new-machine-template", suffix)
newMachinePage = .general
await sheet(.creation(path("ios27-rc")), "08-creation-progress", suffix)
- creation.applyPreview(downloading: 0.42)
+ creation.applyPreview(.downloading(0.42))
await sheet(.creation(path("ios27-rc")), "08a-creation-downloading", suffix)
- creation.applyPreview(failed: true)
+ creation.applyPreview(.failed)
await sheet(.creation(path("ios27-rc")), "08b-creation-failed", suffix)
- creation.applyPreview()
+ creation.applyPreview(.settingUpTemplate)
+ await sheet(.creation(path("ios27-rc")), "08d-creation-template-setup", suffix)
+ creation.applyPreview(.setupFailed)
+ await sheet(.creation(path("ios27-rc")), "08e-creation-template-failed", suffix)
+ creation.applyPreview(.builtTemplate)
+ await sheet(.creation(path("ios27-rc")), "08f-creation-template-built", suffix)
+ creation.applyPreview(.clonedFromTemplate)
+ await sheet(.creation(path("ios27-rc")), "08g-creation-from-template", suffix)
+ creation.applyPreview(.restoring)
await standalone("08c-creation-log", suffix, size: NSSize(width: 960, height: 700)) {
VPhoneLaunchpadConsoleView(title: "ios27-rc Creation Log", url: creation.logFile)
}
@@ -145,6 +155,15 @@
await panel(model, .ipswCache, "13-downloaded-ipsws", suffix)
ipswSelection = ipswScan.ipsws[0].id
await panel(model, .ipswCache, "13a-downloaded-ipsws-in-use", suffix)
+ await panel(model, .templates, "14-templates", suffix)
+ guestSystemRunning = true
+ await sheet(.guestSystem(path("research-01")), "15-guest-system", suffix)
+ guestSystemRunning = false
+ await sheet(.guestSystem(labMachine), "15a-guest-system-stopped", suffix)
+ model.machines.applyPreviewNotice()
+ await shot("16-template-notice", suffix)
+ model.machines.templateNotice = nil
+ try? await Task.sleep(for: .milliseconds(800))
}
NSApp.terminate(nil)
}
@@ -210,6 +229,7 @@
guard let view = target.contentView?.superview ?? target.contentView,
let bitmap = view.bitmapImageRepForCachingDisplay(in: view.bounds)
else {
+ NSLog("[preview] no shot for \(name): \(NSApp.windows.map { "\(type(of: $0)) visible=\($0.isVisible) sheet=\($0.isSheet) \($0.frame)" })")
return
}
view.cacheDisplay(in: view.bounds, to: bitmap)
@@ -449,6 +469,70 @@
"restore Verifying restore images…",
]
+ // MARK: Templates
+
+ /// Stands in for `vm template list --json`: a current slimmed iPhone
+ /// template two machines use, an unslimmed iPad one nothing uses, and
+ /// one an older series built.
+ static let templateList: VPhoneLaunchpadTemplateList? = {
+ func template(
+ _ id: String, device: String, ios: String, build: String, created: String, size: Int64,
+ slimming: String, machines: String, stale: String = "[]", series: String = "2.9",
+ ) -> String {
+ """
+ {"id":"\(id)","path":"\(VPhoneLaunchpadMachineLocations.defaultRoot)/.templates/\(id)","created":"\(created)",
+ "builtWithBundleVersion":"\(series).0","bootChainBundleVersion":"\(series).0","sourceMachine":"template-1a2b3c4d",
+ "allocatedBytes":\(size),"diskSizeBytes":64000000000,"machines":\(machines),"stale":\(stale != "[]"),"staleReasons":\(stale),
+ "sources":{"IPhone":"https://updates.cdn-apple.com/example/\(device)_\(ios)_\(build)_Restore.ipsw","CloudOS":"https://updates.cdn-apple.com/example/cloudos-26.4"},
+ "steps":{},
+ "key":{"Device":"\(device)","IOSVersion":"\(ios)","IOSBuild":"\(build)","CloudOSVersion":"26.4","CloudOSBuild":"23E5207q",
+ "PatchPreset":"standard","BootChainPlanDigest":"01e9","BundleSeries":"\(series)","DiskSizeGB":64,"FormatVersion":2,
+ "Slimming":\(slimming)}}
+ """
+ }
+ let slim = #"{"TrimTier":"standard/1/en,zh,zh-Hans","SetupBoot":true,"ServiceProfile":"trimmed","ServiceGroups":[],"RemovedApps":["com.apple.AppStore","com.apple.Home","com.apple.tv","com.apple.news","com.apple.facetime","com.apple.MobileStore","com.apple.MobileSMS","com.apple.games","com.apple.findmy","com.apple.Passbook"]}"#
+ let plain = #"{"TrimTier":"none","SetupBoot":true,"ServiceProfile":"none","ServiceGroups":[],"RemovedApps":[]}"#
+ let accounts = #"{"TrimTier":"conservative/1","SetupBoot":true,"ServiceProfile":"trimmed","ServiceGroups":["accounts"],"RemovedApps":["com.apple.AppStore","com.apple.news"]}"#
+ let json = """
+ {"templates":[
+ \(template("52b1fcc75e0c", device: "iPhone17,3", ios: "27.0", build: "24A435", created: "2026-10-08T10:00:00Z", size: 17_580_000_000,
+ slimming: slim, machines: #"["research-01","ios27-rc"]"#)),
+ \(template("9d04a7c3e1b2", device: "iPad16,1", ios: "27.0.1", build: "24A446", created: "2026-10-07T16:20:00Z", size: 19_310_000_000,
+ slimming: plain, machines: "[]")),
+ \(template("2246f982776c", device: "iPhone17,3", ios: "26.6.2", build: "23G90", created: "2026-10-02T09:00:00Z", size: 18_920_000_000,
+ slimming: accounts, machines: #"["frida-lab"]"#, stale: #"["built by bundle series 2.8; this vphone-cli is 2.9"]"#, series: "2.8"))
+ ],
+ "building":[{"name":".building-0e44975ff833-7A1C","path":"\(VPhoneLaunchpadMachineLocations.defaultRoot)/.templates/.building-0e44975ff833-7A1C","id":"0e44975ff833","active":false}],
+ "damaged":[]}
+ """
+ return try? VPhoneLaunchpadTemplateList.decode(Data(json.utf8), libraryRoot: VPhoneLaunchpadMachineLocations.defaultRoot)
+ }()
+
+ static var templates: [VPhoneLaunchpadTemplate] {
+ templateList?.templates ?? []
+ }
+
+ /// Whether the Guest System sheet sees its machine running.
+ static var guestSystemRunning = false
+
+ /// Stands in for `services.profile`.
+ static var serviceProfile: [String: Any] {
+ [
+ "profile": "trimmed", "supported": true, "running": [], "reboot_required": false,
+ "record": ["groups": ["base", "app_store", "signin_followup"], "allow": []],
+ ]
+ }
+
+ /// Stands in for `apps.removed_system`: list C, Find My kept.
+ static var removedSystemApps: [String: Any] {
+ let apps = [
+ ("com.apple.AppStore", "AppStore.app"), ("com.apple.Home", "Home.app"), ("com.apple.tv", "TVApp.app"),
+ ("com.apple.news", "News.app"), ("com.apple.facetime", "FaceTime.app"), ("com.apple.MobileSMS", "MobileSMS.app"),
+ ("com.apple.Passbook", "Passbook.app"),
+ ]
+ return ["backups": apps.map { ["bundle_id": $0.0, "app": $0.1, "restorable": true] }]
+ }
+
static let commands = [
"vphone-cli host preflight --quiet",
"vphone-cli vm list --json --library-root ~/.vphone/machines",
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadRootView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadRootView.swift
index 9b3d17ce..9eac3984 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadRootView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadRootView.swift
@@ -41,6 +41,8 @@ struct VPhoneLaunchpadRootView: View {
VPhoneLaunchpadInstallView()
case .ipswCache:
VPhoneLaunchpadIPSWCacheView()
+ case .templates:
+ VPhoneLaunchpadTemplatesView()
}
}
.environment(model)
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Control/VPhoneLaunchpadControlCommands.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Control/VPhoneLaunchpadControlCommands.swift
index f926ea7b..ec93e5d1 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Control/VPhoneLaunchpadControlCommands.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Control/VPhoneLaunchpadControlCommands.swift
@@ -566,6 +566,8 @@ struct VPhoneLaunchpadControlCommands {
if let preset = request.option("preset") {
patches.preset = preset
}
+ let usesTemplate = !request.flag("no-template")
+ let slimming = try Self.slimming(request, usesTemplate: usesTemplate)
let options = try VPhoneLaunchpadCreationPipeline.Options(
name: machine.name,
libraryRoot: machine.libraryRoot,
@@ -579,10 +581,77 @@ struct VPhoneLaunchpadControlCommands {
network: request.option("network") ?? "nat",
patches: patches,
keepArtifacts: request.flag("keep-artifacts"),
+ usesTemplate: usesTemplate,
+ slimming: slimming,
)
return library.create(options)
}
+ /// The template switches, refused where `vphone-cli vm create` refuses
+ /// them: with `--no-template`, after `--slim off`, `--accounts-off`
+ /// without the trimmed profile, an app outside the removable list.
+ private static func slimming(_ request: VPhoneLaunchpadControlRequest, usesTemplate: Bool) throws -> VPhoneLaunchpadSlimming {
+ func onOff(_ option: String) throws -> Bool? {
+ guard let value = request.option(option) else {
+ return nil
+ }
+ switch value {
+ case "on": return true
+ case "off": return false
+ default: throw VPhoneLaunchpadError("--\(option) takes on or off, not \(value).")
+ }
+ }
+ let parts = ["trim", "keep-languages", "service-profile", "remove-apps", "keep-apps"].filter { request.option($0) != nil }
+ + (request.flag("accounts-off") ? ["accounts-off"] : [])
+ if !usesTemplate, !parts.isEmpty || request.option("slim") != nil {
+ throw VPhoneLaunchpadError("The slimming switches shape a template; --no-template creates the machine without one.")
+ }
+ var slimming = VPhoneLaunchpadSlimming()
+ slimming.slim = try onOff("slim") ?? true
+ if !slimming.slim, !parts.isEmpty {
+ throw VPhoneLaunchpadError("--slim off turns slimming off; it cannot be combined with --\(parts.joined(separator: ", --")).")
+ }
+ if let trim = request.option("trim") {
+ guard let tier = VPhoneLaunchpadSlimming.TrimTier(rawValue: trim) else {
+ throw VPhoneLaunchpadError("--trim takes none, conservative or standard, not \(trim).")
+ }
+ slimming.trim = tier
+ }
+ if let languages = request.option("keep-languages") {
+ guard slimming.trim == .standard else {
+ throw VPhoneLaunchpadError("--keep-languages needs --trim standard.")
+ }
+ slimming.keptLanguages = languages
+ }
+ if let profile = request.option("service-profile") {
+ guard profile == "trimmed" || profile == "none" else {
+ throw VPhoneLaunchpadError("--service-profile takes trimmed or none, not \(profile).")
+ }
+ slimming.trimsServices = profile == "trimmed"
+ }
+ slimming.removesApps = try onOff("remove-apps") ?? true
+ if let kept = request.option("keep-apps") {
+ let identifiers = Set(VPhoneLaunchpadSlimming.languageList(kept))
+ let known = Set(VPhoneLaunchpadSlimming.removableApps.map(\.id))
+ let unknown = identifiers.subtracting(known)
+ guard unknown.isEmpty else {
+ throw VPhoneLaunchpadError("--keep-apps \(unknown.sorted().joined(separator: ",")): only apps removed by default can be kept (\(known.sorted().joined(separator: ", "))).")
+ }
+ guard slimming.removesApps else {
+ throw VPhoneLaunchpadError("--keep-apps has nothing to keep with --remove-apps off.")
+ }
+ slimming.keptApps = identifiers
+ }
+ slimming.accountsOff = request.flag("accounts-off")
+ if slimming.accountsOff, !slimming.trimsServices {
+ throw VPhoneLaunchpadError("--accounts-off needs --service-profile trimmed.")
+ }
+ if let problem = slimming.problem {
+ throw VPhoneLaunchpadError(problem)
+ }
+ return slimming
+ }
+
/// Streams the creation log and each step until the pipeline stops. The
/// creation is the window's own, so interrupting the CLI only stops
/// watching it.
@@ -606,7 +675,10 @@ struct VPhoneLaunchpadControlCommands {
"bundle": pipeline.options.bundleVersion,
"running": pipeline.isRunning,
"log": pipeline.logFile.path,
- "steps": VPhoneLaunchpadCreationPipeline.Step.allCases.map { step -> [String: Any] in
+ "template": pipeline.templateID ?? NSNull(),
+ "builtTemplate": pipeline.builtTemplate,
+ "buildMachine": pipeline.buildMachine?.name ?? NSNull(),
+ "steps": pipeline.steps.map { step -> [String: Any] in
var item: [String: Any] = ["step": "\(step)", "status": pipeline.status(step).rawValue]
if let duration = pipeline.durations[step] {
item["seconds"] = Int(duration)
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings b/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings
index a44549cb..a11650d0 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings
@@ -1,11 +1,4153 @@
{
"sourceLanguage" : "en",
"strings" : {
+ "%@ Guest System" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ Guest System"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ のゲストシステム"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ 게스트 시스템"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Hệ thống máy khách của %@"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ 的客户机系统"
+ }
+ }
+ }
+ },
+ "%@ allocated; the rest is shared with its template or clones." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ allocated; the rest is shared with its template or clones."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "割り当て済み %@。残りはテンプレートまたは複製と共有しています。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ 할당됨. 나머지는 템플릿 또는 복제본과 공유합니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Đã cấp phát %@; phần còn lại dùng chung với mẫu hoặc các bản nhân bản."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "已分配 %@;其余部分与模板或克隆共享。"
+ }
+ }
+ }
+ },
+ "%@ are deleted from the IPSW cache." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ are deleted from the IPSW cache."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ を IPSW キャッシュから削除します。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@이(가) IPSW 캐시에서 삭제됩니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ sẽ bị xóa khỏi bộ nhớ đệm IPSW."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "将从 IPSW 缓存中删除 %@。"
+ }
+ }
+ }
+ },
+ "%@ is not a language code such as ja or zh-Hant." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ is not a language code such as ja or zh-Hant."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ は ja や zh-Hant のような言語コードではありません。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@은(는) ja 또는 zh-Hant 같은 언어 코드가 아닙니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ không phải là mã ngôn ngữ như ja hoặc zh-Hant."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ 不是 ja 或 zh-Hant 这样的语言代码。"
+ }
+ }
+ }
+ },
+ "%@ keep working: they share its blocks but do not need it." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ keep working: they share its blocks but do not need it."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ は引き続き動作します。ブロックを共有していますが、テンプレートは不要です。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@은(는) 계속 동작합니다. 블록을 공유하지만 템플릿이 필요하지는 않습니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ vẫn hoạt động: chúng dùng chung khối dữ liệu nhưng không cần đến mẫu."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ 仍可正常使用:它们共享其数据块,但并不依赖它。"
+ }
+ }
+ }
+ },
+ "%lld could not be changed." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld could not be changed."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld 件は変更できませんでした。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld개는 변경할 수 없었습니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Không thể thay đổi %lld mục."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld 项无法更改。"
+ }
+ }
+ }
+ },
+ "%lld turned off, %lld turned back on." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld turned off, %lld turned back on."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%1$lld 件をオフ、%2$lld 件をオンに戻しました。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%1$lld개 끔, %2$lld개 다시 켬."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Đã tắt %1$lld, bật lại %2$lld."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "已关闭 %1$lld 项,重新开启 %2$lld 项。"
+ }
+ }
+ }
+ },
+ "A missing template is built in %@, set up once without a window, and saved under Templates." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "A missing template is built in %@, set up once without a window, and saved under Templates."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレートがなければ %@ で作成し、ウインドウなしで一度セットアップしてから「テンプレート」に保存します。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿이 없으면 %@에서 만들고 창 없이 한 번 설정한 뒤 템플릿에 저장합니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nếu chưa có mẫu, mẫu sẽ được dựng trong %@, thiết lập một lần không có cửa sổ và lưu vào Mẫu."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "如果没有模板,会在 %@ 中构建模板,无界面完成一次设置,然后保存到“模板”中。"
+ }
+ }
+ }
+ },
+ "A template build stopped before it finished: %@" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "A template build stopped before it finished: %@"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレートの作成が途中で止まりました: %@"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿 빌드가 완료되기 전에 중단됨: %@"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Một bản dựng mẫu đã dừng trước khi xong: %@"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "有一个模板构建未完成就停止了:%@"
+ }
+ }
+ }
+ },
+ "A template never keeps them." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "A template never keeps them."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレートには残りません。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿에는 보관되지 않습니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Mẫu không bao giờ giữ lại chúng."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "模板从不保留它们。"
+ }
+ }
+ }
+ },
+ "About 140 launch daemons a research machine rarely needs. Each machine can switch them back on in Guest System. Without Apple Account the guest cannot sign in." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "About 140 launch daemons a research machine rarely needs. Each machine can switch them back on in Guest System. Without Apple Account the guest cannot sign in."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "研究用マシンではほとんど使わない約 140 の launch デーモンです。各マシンは「ゲストシステム」で元に戻せます。Apple アカウントをオフにすると、ゲストはサインインできません。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "연구용 머신에 거의 필요 없는 약 140개의 launch 데몬입니다. 각 머신은 게스트 시스템에서 다시 켤 수 있습니다. Apple 계정을 끄면 게스트가 로그인할 수 없습니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Khoảng 140 launch daemon mà máy nghiên cứu hiếm khi cần. Mỗi máy ảo có thể bật lại chúng trong Hệ thống máy khách. Khi tắt Tài khoản Apple, máy khách không thể đăng nhập."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "研究用虚拟机很少用到的约 140 个 launch 守护进程。每台虚拟机都可以在“客户机系统”中重新开启。关闭 Apple 账户后,客户机无法登录。"
+ }
+ }
+ }
+ },
+ "Allocated" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Allocated"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "割り当て済み"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "할당됨"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Đã cấp phát"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "已分配"
+ }
+ }
+ }
+ },
+ "Allocated on disk." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Allocated on disk."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "ディスク上の割り当て量です。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "디스크에 할당된 크기입니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Dung lượng đã cấp phát trên ổ đĩa."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "磁盘上已分配的空间。"
+ }
+ }
+ }
+ },
+ "Allocated on disk; deleting it frees %@ now, the blocks no machine shares." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Allocated on disk; deleting it frees %@ now, the blocks no machine shares."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "ディスク上の割り当て量です。今削除すると、どのマシンとも共有していない %@ が解放されます。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "디스크에 할당된 크기입니다. 지금 삭제하면 어떤 머신과도 공유하지 않는 %@이(가) 확보됩니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Dung lượng đã cấp phát trên ổ đĩa; xóa ngay sẽ giải phóng %@, phần không máy ảo nào dùng chung."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "磁盘上已分配的空间;现在删除可释放 %@,即没有虚拟机共享的数据块。"
+ }
+ }
+ }
+ },
+ "Also deletes the AirPods pairing assets, watch faces and the language data of languages not kept, about 1.2 GB. It cannot be undone: the trim is part of the template." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Also deletes the AirPods pairing assets, watch faces and the language data of languages not kept, about 1.2 GB. It cannot be undone: the trim is part of the template."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "さらに AirPods のペアリング用アセット、文字盤、保持しない言語の言語データも削除します(約 1.2 GB)。元に戻せません。削減はテンプレートの一部です。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "AirPods 페어링 에셋, 시계 페이스, 유지하지 않는 언어의 언어 데이터도 삭제합니다(약 1.2GB). 되돌릴 수 없습니다. 정리는 템플릿의 일부입니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Xóa thêm tài nguyên ghép đôi AirPods, mặt đồng hồ và dữ liệu ngôn ngữ của các ngôn ngữ không giữ lại, khoảng 1,2 GB. Không thể hoàn tác: phần cắt giảm là một phần của mẫu."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "还会删除 AirPods 配对资源、表盘以及未保留语言的语言数据,约 1.2 GB。此操作无法撤销:裁剪是模板的一部分。"
+ }
+ }
+ }
+ },
+ "An outdated template has the key this machine needs." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "An outdated template has the key this machine needs."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "このマシンに必要なキーを持つテンプレートが古くなっています。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "이 머신에 필요한 키를 가진 템플릿이 오래되었습니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Một mẫu đã lỗi thời đang giữ khóa mà máy ảo này cần."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "一个过时的模板占用了这台虚拟机所需的键。"
+ }
+ }
+ }
+ },
+ "Another creation is building this template." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Another creation is building this template."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "別の作成処理がこのテンプレートを作成中です。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "다른 생성 작업이 이 템플릿을 빌드하고 있습니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Một lần tạo khác đang dựng mẫu này."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "另一个创建任务正在构建此模板。"
+ }
+ }
+ }
+ },
+ "App Store" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "App Store"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "App Store"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "App Store"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "App Store"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "App Store"
+ }
+ }
+ }
+ },
+ "Building template: %@" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Building template: %@"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレートを作成中: %@"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿 빌드 중: %@"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Đang dựng mẫu: %@"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "正在构建模板:%@"
+ }
+ }
+ }
+ },
+ "Built from %@ and cloudOS %@ (%@)." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Built from %@ and cloudOS %@ (%@)."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%1$@ と cloudOS %2$@ (%3$@) から作成。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%1$@ 및 cloudOS %2$@ (%3$@)에서 빌드됨."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Dựng từ %1$@ và cloudOS %2$@ (%3$@)."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "构建自 %1$@ 和 cloudOS %2$@ (%3$@)。"
+ }
+ }
+ }
+ },
+ "Built with Core Bundle %@; every machine from it shares its SEP root secret and Data volume keys." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Built with Core Bundle %@; every machine from it shares its SEP root secret and Data volume keys."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Core Bundle %@ で作成。このテンプレートから作成したすべてのマシンは、SEP のルートシークレットと Data ボリュームの鍵を共有します。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Core Bundle %@(으)로 빌드됨. 이 템플릿에서 만든 모든 머신은 SEP 루트 시크릿과 Data 볼륨 키를 공유합니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Dựng bằng Core Bundle %@; mọi máy ảo tạo từ mẫu này dùng chung bí mật gốc SEP và khóa ổ Data."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "使用 Core Bundle %@ 构建;从它创建的每台虚拟机都共享其 SEP 根密钥和 Data 卷密钥。"
+ }
+ }
+ }
+ },
+ "Checked apps are removed. Camera and Phone are never removed. Each machine can restore removed apps in Guest System." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Checked apps are removed. Camera and Phone are never removed. Each machine can restore removed apps in Guest System."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "チェックした App を削除します。カメラと電話は削除しません。削除した App は各マシンの「ゲストシステム」で復元できます。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "선택한 앱이 제거됩니다. 카메라와 전화는 제거되지 않습니다. 각 머신은 게스트 시스템에서 제거된 앱을 복원할 수 있습니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Các ứng dụng được đánh dấu sẽ bị gỡ. Camera và Điện thoại không bao giờ bị gỡ. Mỗi máy ảo có thể khôi phục ứng dụng đã gỡ trong Hệ thống máy khách."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "勾选的 App 会被移除。相机和电话不会被移除。每台虚拟机都可以在“客户机系统”中恢复已移除的 App。"
+ }
+ }
+ }
+ },
+ "Cloned from template %@, which machines with these options share." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Cloned from template %@, which machines with these options share."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレート %@ から複製しました。同じオプションのマシンはこのテンプレートを共有します。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿 %@에서 복제했습니다. 같은 옵션의 머신은 이 템플릿을 공유합니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nhân bản từ mẫu %@, mẫu mà các máy ảo cùng tùy chọn dùng chung."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "从模板 %@ 克隆,使用相同选项的虚拟机共享此模板。"
+ }
+ }
+ }
+ },
+ "Conservative" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Conservative"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "控えめ"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "보수적"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Thận trọng"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "保守"
+ }
+ }
+ }
+ },
+ "Conservative trim" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Conservative trim"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "控えめな削減"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "보수적 정리"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Cắt giảm thận trọng"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "保守裁剪"
+ }
+ }
+ }
+ },
+ "Create from a template" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Create from a template"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレートから作成"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿에서 생성"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tạo từ mẫu"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "从模板创建"
+ }
+ }
+ }
+ },
+ "Create machine from template" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Create machine from template"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレートからマシンを作成"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿에서 머신 생성"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tạo máy ảo từ mẫu"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "从模板创建虚拟机"
+ }
+ }
+ }
+ },
+ "Created from this template. It shares the template's SEP root secret and Data volume keys with every machine created from it." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Created from this template. It shares the template's SEP root secret and Data volume keys with every machine created from it."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "このテンプレートから作成されました。テンプレートの SEP ルートシークレットと Data ボリュームの鍵を、このテンプレートから作成したすべてのマシンと共有しています。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "이 템플릿에서 생성되었습니다. 템플릿의 SEP 루트 시크릿과 Data 볼륨 키를 이 템플릿에서 만든 모든 머신과 공유합니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Được tạo từ mẫu này. Máy ảo dùng chung bí mật gốc SEP và khóa ổ Data của mẫu với mọi máy ảo tạo từ mẫu."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "从此模板创建。它与从该模板创建的每台虚拟机共享模板的 SEP 根密钥和 Data 卷密钥。"
+ }
+ }
+ }
+ },
+ "Delete IPSWs…" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Delete IPSWs…"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "IPSW を削除…"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "IPSW 삭제…"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Xóa IPSW…"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "删除 IPSW…"
+ }
+ }
+ }
+ },
+ "Delete template %@ in Templates, then retry. Machines created from it keep working." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Delete template %@ in Templates, then retry. Machines created from it keep working."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "「テンプレート」でテンプレート %@ を削除してから再試行してください。そこから作成したマシンは引き続き動作します。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿에서 템플릿 %@을(를) 삭제한 후 다시 시도하십시오. 이 템플릿에서 만든 머신은 계속 동작합니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Hãy xóa mẫu %@ trong Mẫu rồi thử lại. Các máy ảo tạo từ mẫu đó vẫn hoạt động."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "请在“模板”中删除模板 %@,然后重试。从它创建的虚拟机仍可正常使用。"
+ }
+ }
+ }
+ },
+ "Delete template %@?" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Delete template %@?"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレート %@ を削除しますか?"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿 %@을(를) 삭제하겠습니까?"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Xóa mẫu %@?"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "删除模板 %@?"
+ }
+ }
+ }
+ },
+ "Delete the IPSWs this template came from?" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Delete the IPSWs this template came from?"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "このテンプレートの元になった IPSW を削除しますか?"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "이 템플릿의 원본 IPSW를 삭제하겠습니까?"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Xóa các IPSW đã dùng để dựng mẫu này?"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "删除构建此模板所用的 IPSW?"
+ }
+ }
+ }
+ },
+ "Delete the selected template. Machines created from it keep working." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Delete the selected template. Machines created from it keep working."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "選択したテンプレートを削除します。そこから作成したマシンは引き続き動作します。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "선택한 템플릿을 삭제합니다. 이 템플릿에서 만든 머신은 계속 동작합니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Xóa mẫu đã chọn. Các máy ảo tạo từ mẫu vẫn hoạt động."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "删除所选模板。从它创建的虚拟机仍可正常使用。"
+ }
+ }
+ }
+ },
+ "Delete the unfinished template build?" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Delete the unfinished template build?"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "未完成のテンプレート作成を削除しますか?"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "완료되지 않은 템플릿 빌드를 삭제하겠습니까?"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Xóa bản dựng mẫu chưa hoàn tất?"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "删除未完成的模板构建?"
+ }
+ }
+ }
+ },
+ "Deletes the software update ramdisk and baseband firmware, about 0.4 GB. It cannot be undone: the trim is part of the template." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Deletes the software update ramdisk and baseband firmware, about 0.4 GB. It cannot be undone: the trim is part of the template."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "ソフトウェア・アップデート用の RAM ディスクとベースバンドファームウェアを削除します(約 0.4 GB)。元に戻せません。削減はテンプレートの一部です。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "소프트웨어 업데이트 램디스크와 베이스밴드 펌웨어를 삭제합니다(약 0.4GB). 되돌릴 수 없습니다. 정리는 템플릿의 일부입니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Xóa ramdisk cập nhật phần mềm và firmware baseband, khoảng 0,4 GB. Không thể hoàn tác: phần cắt giảm là một phần của mẫu."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "删除软件更新内存盘和基带固件,约 0.4 GB。此操作无法撤销:裁剪是模板的一部分。"
+ }
+ }
+ }
+ },
+ "Deleting it frees about %@ now; the blocks its machines share are freed once they change or are deleted." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Deleting it frees about %@ now; the blocks its machines share are freed once they change or are deleted."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "今削除すると約 %@ が解放されます。マシンと共有しているブロックは、それらが変更または削除されたときに解放されます。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "지금 삭제하면 약 %@이(가) 확보됩니다. 머신과 공유하는 블록은 해당 머신이 변경되거나 삭제될 때 확보됩니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Xóa ngay sẽ giải phóng khoảng %@; các khối dùng chung với máy ảo được giải phóng khi chúng thay đổi hoặc bị xóa."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "现在删除约可释放 %@;与虚拟机共享的数据块会在这些虚拟机改写或被删除后释放。"
+ }
+ }
+ }
+ },
+ "Deleting template…" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Deleting template…"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレートを削除中…"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿 삭제 중…"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Đang xóa mẫu…"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "正在删除模板…"
+ }
+ }
+ }
+ },
"Edit…" : {
-
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Edit…"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "編集…"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "편집…"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Sửa…"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "编辑…"
+ }
+ }
+ }
+ },
+ "Every block the machine's files hold, shared or not." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Every block the machine's files hold, shared or not."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "共有の有無にかかわらず、マシンのファイルが保持しているすべてのブロックです。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "공유 여부와 상관없이 머신의 파일이 차지하는 모든 블록입니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Mọi khối mà các tệp của máy ảo chiếm giữ, dùng chung hay không."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "虚拟机文件占用的全部数据块,无论是否共享。"
+ }
+ }
+ }
+ },
+ "Exclusive" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Exclusive"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "専有"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "단독 사용"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Riêng"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "独占"
+ }
+ }
+ }
+ },
+ "FaceTime" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "FaceTime"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "FaceTime"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "FaceTime"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "FaceTime"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "FaceTime 通话"
+ }
+ }
+ }
+ },
+ "Find My" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Find My"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "探す"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "나의 찾기"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tìm"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "查找"
+ }
+ }
+ }
+ },
+ "Find template" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Find template"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレートを検索"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿 찾기"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tìm mẫu"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "查找模板"
+ }
+ }
+ }
+ },
+ "Games" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Games"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "ゲーム"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "게임"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Trò chơi"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "游戏"
+ }
+ }
+ }
+ },
+ "Guest System" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Guest System"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "ゲストシステム"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "게스트 시스템"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Hệ thống máy khách"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "客户机系统"
+ }
+ }
+ }
+ },
+ "Guest System…" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Guest System…"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "ゲストシステム…"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "게스트 시스템…"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Hệ thống máy khách…"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "客户机系统…"
+ }
+ }
+ }
+ },
+ "Home" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Home"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "ホーム"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "홈"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nhà"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "家庭"
+ }
+ }
+ }
+ },
+ "Its restored disk is deleted. A machine that needs this template builds it again." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Its restored disk is deleted. A machine that needs this template builds it again."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "復元済みのディスクを削除します。このテンプレートが必要なマシンは、もう一度作成します。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "복원된 디스크가 삭제됩니다. 이 템플릿이 필요한 머신은 다시 빌드합니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ổ đĩa đã khôi phục sẽ bị xóa. Máy ảo nào cần mẫu này sẽ dựng lại."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "将删除已恢复的磁盘。需要此模板的虚拟机会重新构建它。"
+ }
+ }
+ }
+ },
+ "Kept Languages" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Kept Languages"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "保持する言語"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "유지할 언어"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ngôn ngữ giữ lại"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "保留的语言"
+ }
+ }
+ }
+ },
+ "Machine" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Machine"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "マシン"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "머신"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Máy ảo"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "虚拟机"
+ }
+ }
+ }
+ },
+ "Machines from one template share its SEP root secret and Data volume keys. Turn this off for a machine that needs keys of its own." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Machines from one template share its SEP root secret and Data volume keys. Turn this off for a machine that needs keys of its own."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "同じテンプレートから作成したマシンは、SEP のルートシークレットと Data ボリュームの鍵を共有します。独自の鍵が必要なマシンではオフにしてください。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "같은 템플릿에서 만든 머신은 SEP 루트 시크릿과 Data 볼륨 키를 공유합니다. 고유한 키가 필요한 머신에서는 끄십시오."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Các máy ảo từ cùng một mẫu dùng chung bí mật gốc SEP và khóa ổ Data. Hãy tắt mục này cho máy ảo cần khóa riêng."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "从同一模板创建的虚拟机共享 SEP 根密钥和 Data 卷密钥。需要独立密钥的虚拟机请关闭此项。"
+ }
+ }
+ }
+ },
+ "Machines from this template need neither IPSW. A machine with other options downloads them again." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Machines from this template need neither IPSW. A machine with other options downloads them again."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "このテンプレートから作成するマシンには、どちらの IPSW も不要です。別のオプションのマシンでは再度ダウンロードします。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "이 템플릿에서 만드는 머신에는 두 IPSW 모두 필요하지 않습니다. 다른 옵션의 머신은 다시 다운로드합니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Máy ảo tạo từ mẫu này không cần IPSW nào. Máy ảo có tùy chọn khác sẽ tải lại chúng."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "从此模板创建的虚拟机不需要这两个 IPSW。使用其他选项的虚拟机会重新下载。"
+ }
+ }
+ }
+ },
+ "Messages" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Messages"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "メッセージ"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "메시지"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tin nhắn"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "信息"
+ }
+ }
+ }
+ },
+ "New Machine builds a template the first time it creates a machine from a firmware, and clones every later machine with the same options from it." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "New Machine builds a template the first time it creates a machine from a firmware, and clones every later machine with the same options from it."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "「新規マシン」は、あるファームウェアから初めてマシンを作成するときにテンプレートを作成し、同じオプションの以降のマシンはそこから複製します。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "새로운 머신은 펌웨어로 처음 머신을 만들 때 템플릿을 빌드하고, 이후 같은 옵션의 머신은 이 템플릿에서 복제합니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Máy ảo mới dựng một mẫu ở lần đầu tạo máy ảo từ một firmware, và nhân bản mọi máy ảo sau có cùng tùy chọn từ mẫu đó."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "“新建虚拟机”首次用某个固件创建虚拟机时会构建模板,之后使用相同选项的虚拟机都从该模板克隆。"
+ }
+ }
+ }
+ },
+ "News" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "News"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "News"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "News"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "News"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "News"
+ }
+ }
+ }
+ },
+ "No Templates" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "No Templates"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレートなし"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿 없음"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Không có mẫu"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "没有模板"
+ }
+ }
+ }
+ },
+ "No machine uses template %@ any more. It stays, taking about %@, so the next machine with its options is created in seconds. Delete it in Templates once it is no longer needed." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "No machine uses template %@ any more. It stays, taking about %@, so the next machine with its options is created in seconds. Delete it in Templates once it is no longer needed."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレート %1$@ を使っているマシンはなくなりました。テンプレートは約 %2$@ を使ったまま残るので、同じオプションの次のマシンは数秒で作成できます。不要になったら「テンプレート」で削除してください。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "더 이상 템플릿 %1$@을(를) 사용하는 머신이 없습니다. 템플릿은 약 %2$@을(를) 차지한 채 남아 있으므로 같은 옵션의 다음 머신은 몇 초 만에 생성됩니다. 더 이상 필요 없으면 템플릿에서 삭제하십시오."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Không còn máy ảo nào dùng mẫu %1$@. Mẫu vẫn được giữ, chiếm khoảng %2$@, để máy ảo tiếp theo có cùng tùy chọn được tạo trong vài giây. Hãy xóa trong Mẫu khi không cần nữa."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "已没有虚拟机使用模板 %1$@。模板会保留,约占用 %2$@,下一台使用相同选项的虚拟机可在几秒内创建。不再需要时,请在“模板”中删除它。"
+ }
+ }
+ }
+ },
+ "No machine was created from it." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "No machine was created from it."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "このテンプレートから作成したマシンはありません。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "이 템플릿에서 만든 머신이 없습니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Chưa có máy ảo nào được tạo từ mẫu này."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "尚未有虚拟机从它创建。"
+ }
+ }
+ }
+ },
+ "No system app was removed." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "No system app was removed."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "削除されたシステム App はありません。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "제거된 시스템 앱이 없습니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Không có ứng dụng hệ thống nào bị gỡ."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "没有移除任何系统 App。"
+ }
+ }
+ }
+ },
+ "No template to create the machine from. Retry from Find Template." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "No template to create the machine from. Retry from Find Template."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "マシンを作成するためのテンプレートがありません。「テンプレートを検索」から再試行してください。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "머신을 생성할 템플릿이 없습니다. 템플릿 찾기부터 다시 시도하십시오."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Không có mẫu để tạo máy ảo. Hãy thử lại từ Tìm mẫu."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "没有可用于创建虚拟机的模板。请从“查找模板”重试。"
+ }
+ }
+ }
+ },
+ "No trim" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "No trim"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "削減なし"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "정리 없음"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Không cắt giảm"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "不裁剪"
+ }
+ }
+ }
+ },
+ "Not slimmed" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Not slimmed"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "軽量化なし"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "간소화 안 함"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Chưa tinh gọn"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "未精简"
+ }
+ }
+ }
+ },
+ "Nothing is deleted from the System volume." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nothing is deleted from the System volume."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "System ボリュームからは何も削除しません。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "System 볼륨에서 아무것도 삭제하지 않습니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Không xóa gì khỏi ổ System."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "不从 System 卷删除任何内容。"
+ }
+ }
+ }
+ },
+ "Outdated" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Outdated"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "古い"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "오래됨"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Lỗi thời"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "已过时"
+ }
+ }
+ }
+ },
+ "Outdated: %@. New machines get a new template; this one only takes space." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Outdated: %@. New machines get a new template; this one only takes space."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "古いテンプレート: %@。新しいマシンには新しいテンプレートを使います。このテンプレートは容量を使うだけです。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "오래됨: %@. 새 머신은 새 템플릿을 사용하며, 이 템플릿은 공간만 차지합니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Lỗi thời: %@. Máy ảo mới sẽ dùng mẫu mới; mẫu này chỉ chiếm dung lượng."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "已过时:%@。新虚拟机会使用新模板;此模板只占用空间。"
+ }
+ }
+ }
+ },
+ "Remove system apps" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Remove system apps"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "システム App を削除"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "시스템 앱 제거"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Gỡ ứng dụng hệ thống"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "移除系统 App"
+ }
+ }
+ }
+ },
+ "Removed System Apps" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Removed System Apps"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "削除したシステム App"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "제거된 시스템 앱"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ứng dụng hệ thống đã gỡ"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "已移除的系统 App"
+ }
+ }
+ }
+ },
+ "Removed: %@" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Removed: %@"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "削除済み: %@"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "제거됨: %@"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Đã gỡ: %@"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "已移除:%@"
+ }
+ }
+ }
+ },
+ "Restart Guest" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Restart Guest"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "ゲストを再起動"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "게스트 재시동"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Khởi động lại máy khách"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "重启客户机"
+ }
+ }
+ }
+ },
+ "Restart required" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Restart required"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "再起動が必要"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "재시동 필요"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Cần khởi động lại"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "需要重启"
+ }
+ }
+ }
+ },
+ "Restore Selected" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Restore Selected"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "選択項目を復元"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "선택 항목 복원"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Khôi phục mục đã chọn"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "恢复所选项"
+ }
+ }
+ }
+ },
+ "Retry once it has finished; the machine is then created from that template." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Retry once it has finished; the machine is then created from that template."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "それが終わってから再試行してください。マシンはそのテンプレートから作成されます。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "완료된 후 다시 시도하십시오. 그러면 머신이 해당 템플릿에서 생성됩니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Hãy thử lại khi việc đó xong; máy ảo khi đó sẽ được tạo từ mẫu ấy."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "请在其完成后重试,届时将从该模板创建虚拟机。"
+ }
+ }
+ }
+ },
+ "Save template" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Save template"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレートを保存"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿 저장"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Lưu mẫu"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "保存模板"
+ }
+ }
+ }
+ },
+ "Saved as template %@. The next machine with these options is cloned from it in seconds." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Saved as template %@. The next machine with these options is cloned from it in seconds."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレート %@ として保存しました。同じオプションの次のマシンは、ここから数秒で複製されます。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿 %@(으)로 저장했습니다. 같은 옵션의 다음 머신은 몇 초 만에 여기에서 복제됩니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Đã lưu thành mẫu %@. Máy ảo tiếp theo có cùng tùy chọn sẽ được nhân bản từ mẫu này trong vài giây."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "已保存为模板 %@。下一台使用相同选项的虚拟机会在几秒内从它克隆。"
+ }
+ }
+ }
+ },
+ "Service Profile" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Service Profile"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "サービスプロファイル"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "서비스 프로필"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Cấu hình dịch vụ"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "服务配置"
+ }
+ }
+ }
+ },
+ "Service profile and removed system apps" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Service profile and removed system apps"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "サービスプロファイルと削除したシステム App"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "서비스 프로필 및 제거된 시스템 앱"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Cấu hình dịch vụ và ứng dụng hệ thống đã gỡ"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "服务配置和已移除的系统 App"
+ }
+ }
+ }
+ },
+ "Service profile: %@" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Service profile: %@"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "サービスプロファイル: %@"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "서비스 프로필: %@"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Cấu hình dịch vụ: %@"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "服务配置:%@"
+ }
+ }
+ }
+ },
+ "Services" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Services"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "サービス"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "서비스"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Dịch vụ"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "服务"
+ }
+ }
+ }
+ },
+ "Services and accounts off" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Services and accounts off"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "サービスとアカウントをオフ"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "서비스 및 계정 끔"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tắt dịch vụ và tài khoản"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "已关闭服务和账户"
+ }
+ }
+ }
+ },
+ "Services trimmed" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Services trimmed"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "サービスを削減"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "서비스 정리됨"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Đã cắt giảm dịch vụ"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "已精简服务"
+ }
+ }
+ }
+ },
+ "Set up template" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Set up template"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレートをセットアップ"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿 설정"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Thiết lập mẫu"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "设置模板"
+ }
+ }
+ }
+ },
+ "Show Templates" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Show Templates"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレートを表示"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿 보기"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Hiện mẫu"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "显示模板"
+ }
+ }
+ }
+ },
+ "Slim System" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Slim System"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "システムを軽量化"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "시스템 간소화"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tinh gọn hệ thống"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "精简系统"
+ }
+ }
+ }
+ },
+ "Slimming" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Slimming"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "軽量化"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "간소화"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tinh gọn"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "精简"
+ }
+ }
+ }
+ },
+ "Standard trim" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Standard trim"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "標準の削減"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "표준 정리"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Cắt giảm tiêu chuẩn"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "标准裁剪"
+ }
+ }
+ }
+ },
+ "Start %@ to change these. They change the guest itself, through vphoned." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Start %@ to change these. They change the guest itself, through vphoned."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "変更するには %@ を起動してください。これらは vphoned を通じてゲスト自体を変更します。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "변경하려면 %@을(를) 시작하십시오. vphoned를 통해 게스트 자체를 변경합니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Hãy khởi động %@ để thay đổi các mục này. Chúng thay đổi chính máy khách, qua vphoned."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "启动 %@ 后才能更改这些项。它们通过 vphoned 更改客户机本身。"
+ }
+ }
+ }
+ },
+ "System Apps" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "System Apps"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "システム App"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "시스템 앱"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ứng dụng hệ thống"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "系统 App"
+ }
+ }
+ }
+ },
+ "System Files" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "System Files"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "システムファイル"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "시스템 파일"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tệp hệ thống"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "系统文件"
+ }
+ }
+ }
+ },
+ "TV" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "TV"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "TV"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "TV"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "TV"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "视频"
+ }
+ }
+ }
+ },
+ "Template" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Template"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレート"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Mẫu"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "模板"
+ }
+ }
+ }
+ },
+ "Template No Longer Used" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Template No Longer Used"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "使われなくなったテンプレート"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "더 이상 사용되지 않는 템플릿"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Mẫu không còn được dùng"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "模板已不再使用"
+ }
+ }
+ }
+ },
+ "Templates" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Templates"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレート"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Mẫu"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "模板"
+ }
+ }
+ }
+ },
+ "Templates…" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Templates…"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレート…"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿…"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Mẫu…"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "模板…"
+ }
+ }
+ }
+ },
+ "The IPSWs were deleted." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "The IPSWs were deleted."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "IPSW を削除しました。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "IPSW를 삭제했습니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Đã xóa các IPSW."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "已删除 IPSW。"
+ }
+ }
+ }
+ },
+ "The blocks only this machine holds: what deleting it frees. The rest is shared with its template or clones." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "The blocks only this machine holds: what deleting it frees. The rest is shared with its template or clones."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "このマシンだけが保持しているブロックで、削除すると解放される量です。残りはテンプレートまたは複製と共有しています。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "이 머신만 차지하는 블록으로, 삭제하면 확보되는 크기입니다. 나머지는 템플릿 또는 복제본과 공유합니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Các khối chỉ riêng máy ảo này giữ: phần được giải phóng khi xóa. Phần còn lại dùng chung với mẫu hoặc các bản nhân bản."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "仅此虚拟机占用的数据块,即删除后可释放的空间。其余部分与模板或克隆共享。"
+ }
+ }
+ }
+ },
+ "The guest is restarting." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "The guest is restarting."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "ゲストを再起動しています。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "게스트가 재시동 중입니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Máy khách đang khởi động lại."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "客户机正在重启。"
+ }
+ }
+ }
+ },
+ "The machine is restored on its own, with keys of its own. It is not slimmed, and starts at Setup Assistant." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "The machine is restored on its own, with keys of its own. It is not slimmed, and starts at Setup Assistant."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "マシンは単独で復元され、独自の鍵を持ちます。軽量化されず、設定アシスタントから始まります。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "머신이 단독으로 복원되며 고유한 키를 가집니다. 간소화되지 않으며 설정 지원에서 시작합니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Máy ảo được khôi phục riêng, với khóa riêng. Máy ảo không được tinh gọn và bắt đầu ở Trợ lý thiết lập."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "虚拟机将单独恢复,拥有独立的密钥。不会精简,并从设置助理开始。"
+ }
+ }
+ }
+ },
+ "The next machine with its options builds a new template, which takes a restore." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "The next machine with its options builds a new template, which takes a restore."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "同じオプションの次のマシンでは新しいテンプレートを作成するため、復元が必要になります。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "같은 옵션의 다음 머신은 새 템플릿을 빌드하므로 복원이 필요합니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Máy ảo tiếp theo có cùng tùy chọn sẽ dựng mẫu mới, việc này cần một lần khôi phục."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "下一台使用相同选项的虚拟机需要构建新模板,这需要一次恢复。"
+ }
+ }
+ }
+ },
+ "The path is too long. Use a location with a shorter path." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "The path is too long. Use a location with a shorter path."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "パスが長すぎます。より短いパスの場所を使用してください。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "경로가 너무 깁니다. 더 짧은 경로의 위치를 사용하십시오."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Đường dẫn quá dài. Hãy dùng vị trí có đường dẫn ngắn hơn."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "路径过长。请使用路径更短的位置。"
+ }
+ }
+ }
+ },
+ "The template keeps every file, service and app. Setup Assistant is still skipped." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "The template keeps every file, service and app. Setup Assistant is still skipped."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレートはすべてのファイル、サービス、App を保持します。設定アシスタントはスキップされます。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿은 모든 파일, 서비스, 앱을 유지합니다. 설정 지원은 계속 건너뜁니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Mẫu giữ lại mọi tệp, dịch vụ và ứng dụng. Trợ lý thiết lập vẫn được bỏ qua."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "模板保留所有文件、服务和 App。仍会跳过设置助理。"
+ }
+ }
+ }
+ },
+ "The template's setup boot removed these and kept a backup in the guest. A restored app returns to the Home Screen after SpringBoard restarts." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "The template's setup boot removed these and kept a backup in the guest. A restored app returns to the Home Screen after SpringBoard restarts."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレートのセットアップ起動でこれらを削除し、ゲスト内にバックアップを残しました。復元した App は SpringBoard の再起動後にホーム画面に戻ります。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿 설정 부팅에서 이 앱들을 제거하고 게스트에 백업을 남겼습니다. 복원된 앱은 SpringBoard가 재시동된 후 홈 화면에 다시 나타납니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Lần khởi động thiết lập của mẫu đã gỡ các ứng dụng này và giữ bản sao lưu trong máy khách. Ứng dụng được khôi phục sẽ trở lại Màn hình chính sau khi SpringBoard khởi động lại."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "模板的设置启动移除了这些 App,并在客户机中保留了备份。恢复的 App 会在 SpringBoard 重启后回到主屏幕。"
+ }
+ }
+ }
+ },
+ "This iOS version has no trimmed list." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "This iOS version has no trimmed list."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "この iOS バージョンには削減リストがありません。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "이 iOS 버전에는 정리 목록이 없습니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Phiên bản iOS này không có danh sách cắt giảm."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "此 iOS 版本没有精简列表。"
+ }
+ }
+ }
+ },
+ "Trim" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Trim"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "削減"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "정리"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Cắt giảm"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "裁剪"
+ }
+ }
+ }
+ },
+ "Trim system files" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Trim system files"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "システムファイルを削減"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "시스템 파일 정리"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Cắt giảm tệp hệ thống"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "裁剪系统文件"
+ }
+ }
+ }
+ },
+ "Trim: %@" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Trim: %@"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "削減: %@"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "정리: %@"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Cắt giảm: %@"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "裁剪:%@"
+ }
+ }
+ }
+ },
+ "Trimmed" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Trimmed"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "削減済み"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "정리됨"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Đã cắt giảm"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "精简"
+ }
+ }
+ }
+ },
+ "Trimmed turns off about 140 launch daemons a research machine rarely needs; None turns back on only those it turned off. Either takes effect when the guest restarts." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Trimmed turns off about 140 launch daemons a research machine rarely needs; None turns back on only those it turned off. Either takes effect when the guest restarts."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "「削減済み」は研究用マシンではほとんど使わない約 140 の launch デーモンをオフにします。「なし」はそれでオフにしたものだけをオンに戻します。どちらもゲストの再起動後に反映されます。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "정리됨은 연구용 머신에 거의 필요 없는 약 140개의 launch 데몬을 끕니다. 없음은 정리됨이 끈 데몬만 다시 켭니다. 둘 다 게스트를 재시동하면 적용됩니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Đã cắt giảm sẽ tắt khoảng 140 launch daemon mà máy nghiên cứu hiếm khi cần; Không có chỉ bật lại những gì nó đã tắt. Cả hai có hiệu lực khi máy khách khởi động lại."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "“精简”会关闭研究用虚拟机很少用到的约 140 个 launch 守护进程;“无”只重新开启由它关闭的那些。两者都在客户机重启后生效。"
+ }
+ }
+ }
+ },
+ "Trims system files, unneeded services and system apps once, in the template the machine is cloned from. Choose what goes in Template." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Trims system files, unneeded services and system apps once, in the template the machine is cloned from. Choose what goes in Template."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "システムファイル、不要なサービス、システム App を、マシンの複製元のテンプレートで一度だけ削減します。対象は「テンプレート」で選択します。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "머신을 복제하는 원본 템플릿에서 시스템 파일, 불필요한 서비스, 시스템 앱을 한 번 정리합니다. 정리할 항목은 템플릿에서 선택하십시오."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Cắt giảm tệp hệ thống, dịch vụ không cần và ứng dụng hệ thống một lần, trong mẫu mà máy ảo được nhân bản từ đó. Chọn mục cắt giảm trong Mẫu."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "在虚拟机克隆所用的模板中一次性裁剪系统文件、不需要的服务和系统 App。在“模板”中选择要裁剪的内容。"
+ }
+ }
+ }
+ },
+ "Turn off Apple Account" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Turn off Apple Account"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Apple アカウントをオフ"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Apple 계정 끄기"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tắt Tài khoản Apple"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "关闭 Apple 账户"
+ }
+ }
+ }
+ },
+ "Turn off unneeded services" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Turn off unneeded services"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "不要なサービスをオフ"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "불필요한 서비스 끄기"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tắt dịch vụ không cần"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "关闭不需要的服务"
+ }
+ }
+ }
+ },
+ "Unable to Change the Service Profile" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Unable to Change the Service Profile"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "サービスプロファイルを変更できません"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "서비스 프로필을 변경할 수 없음"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Không thể thay đổi cấu hình dịch vụ"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "无法更改服务配置"
+ }
+ }
+ }
+ },
+ "Unable to List Templates" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Unable to List Templates"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレートを一覧表示できません"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿 목록을 가져올 수 없음"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Không thể liệt kê mẫu"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "无法列出模板"
+ }
+ }
+ }
+ },
+ "Unable to Restart the Guest" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Unable to Restart the Guest"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "ゲストを再起動できません"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "게스트를 재시동할 수 없음"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Không thể khởi động lại máy khách"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "无法重启客户机"
+ }
+ }
+ }
+ },
+ "Unable to Restore the Apps" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Unable to Restore the Apps"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "App を復元できません"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "앱을 복원할 수 없음"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Không thể khôi phục ứng dụng"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "无法恢复 App"
+ }
+ }
+ }
+ },
+ "Unable to read the saved template." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Unable to read the saved template."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "保存したテンプレートを読み取れません。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "저장된 템플릿을 읽을 수 없습니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Không thể đọc mẫu đã lưu."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "无法读取已保存的模板。"
+ }
+ }
+ }
+ },
+ "Unable to read the template search." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Unable to read the template search."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレートの検索結果を読み取れません。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿 검색 결과를 읽을 수 없습니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Không thể đọc kết quả tìm mẫu."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "无法读取模板查找结果。"
+ }
+ }
+ }
+ },
+ "Wallet" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Wallet"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "ウォレット"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "지갑"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ví"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "钱包"
+ }
+ }
+ }
+ },
+ "Without a template the machine is not slimmed. Turn templates on in Template." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Without a template the machine is not slimmed. Turn templates on in Template."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "テンプレートを使わない場合、マシンは軽量化されません。「テンプレート」でテンプレートをオンにしてください。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "템플릿 없이 만든 머신은 간소화되지 않습니다. 템플릿에서 템플릿을 켜십시오."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Không có mẫu thì máy ảo không được tinh gọn. Hãy bật mẫu trong Mẫu."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "不使用模板时,虚拟机不会精简。请在“模板”中开启模板。"
+ }
+ }
+ }
+ },
+ "^[%lld app](inflect: true) removed" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "^[%lld app](inflect: true) removed"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld 個の App を削除"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "앱 %lld개 제거됨"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Đã gỡ %lld ứng dụng"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "已移除 %lld 个 App"
+ }
+ }
+ }
+ },
+ "^[%lld app](inflect: true) restored." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "^[%lld app](inflect: true) restored."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld 個の App を復元しました。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "앱 %lld개를 복원했습니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Đã khôi phục %lld ứng dụng."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "已恢复 %lld 个 App。"
+ }
+ }
+ }
},
"iPadOS" : {
-
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "iPadOS"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "iPadOS"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "iPadOS"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "iPadOS"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "iPadOS"
+ }
+ }
+ }
+ },
+ "iTunes Store" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "iTunes Store"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "iTunes Store"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "iTunes Store"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "iTunes Store"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "iTunes Store"
+ }
+ }
+ }
},
"Device" : {
"localizations" : {
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPipeline.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPipeline.swift
index 04e5279b..441793c1 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPipeline.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPipeline.swift
@@ -11,9 +11,21 @@ import Observation
/// VPhoneVirtualMachineCreator: the device identity file, 90 recovery probes,
/// up to 30 seconds for the post-restore panic, 5 seconds before CFW, and up
/// to 300 seconds for vphoned to answer on first boot.
+///
+/// By default the machine is cloned from a template (`VPhoneLaunchpadCreationPlan`
+/// lists the steps). A template that is missing is built first in a
+/// temporary machine of the same library, by the same restore steps, then
+/// `vm template trim`, `vm template setup` and `vm template adopt`. The
+/// helper's root surface stays `cfw install`: it runs on that temporary
+/// machine before it is adopted, and the trim, the setup boot and the adopt
+/// run as the user. The setup boot's `vphone-vm` is started by `vphone-cli`,
+/// a child of Launchpad like the DFU boot, not through the launcher, so it
+/// is Launchpad's responsibility while it runs, headless.
@MainActor
@Observable
final class VPhoneLaunchpadCreationPipeline {
+ typealias Step = VPhoneLaunchpadCreationStep
+
struct Options: Sendable {
var name: String
/// The canonical library the machine is created in.
@@ -33,51 +45,32 @@ final class VPhoneLaunchpadCreationPipeline {
/// The preset and per-patch overrides the boot chain is built with.
var patches: VPhoneLaunchpadPatchSelection
var keepArtifacts: Bool
+ /// Clone the machine from a template (built first when missing).
+ /// Off restores the machine on its own, with SEP and Data volume keys
+ /// of its own.
+ var usesTemplate = true
+ var slimming = VPhoneLaunchpadSlimming()
var machine: VPhoneLaunchpadMachinePath {
VPhoneLaunchpadMachinePath(libraryRoot: libraryRoot, name: name)
}
- }
-
- enum Step: Int, CaseIterable, Identifiable, Comparable {
- case create
- case prepare
- case patch
- case bootDFU
- case waitDFU
- case restore
- case stopDFU
- case installCFW
- case firstBoot
-
- var id: Int {
- rawValue
- }
-
- static func < (lhs: Step, rhs: Step) -> Bool {
- lhs.rawValue < rhs.rawValue
- }
-
- var title: String {
- switch self {
- case .create: String(localized: "Create machine")
- case .prepare: String(localized: "Download and prepare firmware")
- case .patch: String(localized: "Patch boot chain")
- case .bootDFU: String(localized: "Boot into DFU")
- case .waitDFU: String(localized: "Wait for DFU")
- case .restore: String(localized: "Restore")
- case .stopDFU: String(localized: "Stop machine")
- case .installCFW: String(localized: "Install custom firmware")
- case .firstBoot: String(localized: "First boot")
- }
- }
- var needsRoot: Bool {
- self == .installCFW
+ var templateRequest: VPhoneLaunchpadTemplateCommands.Request {
+ VPhoneLaunchpadTemplateCommands.Request(
+ iphoneSource: iphoneSource,
+ cloudOSSource: cloudOSSource,
+ device: device,
+ preset: patches.preset,
+ blocked: patches.blocked,
+ allowed: patches.allowed,
+ diskSizeGB: diskSizeGB,
+ slimming: slimming,
+ )
}
}
let options: Options
+ private(set) var plan: VPhoneLaunchpadCreationPlan
private(set) var statuses: [Step: VPhoneLaunchpadStatus] = [:]
private(set) var durations: [Step: TimeInterval] = [:]
private(set) var current: Step?
@@ -85,6 +78,15 @@ final class VPhoneLaunchpadCreationPipeline {
/// downloading. Each of the two IPSWs counts from zero; a cached one and
/// a Core Bundle that reports no progress leave it nil.
private(set) var downloadFraction: Double?
+ /// The setup boot's own step while it runs (`b. wait for first-boot
+ /// work`), from its `[setup]` lines.
+ private(set) var setupStage: String?
+ /// The template the machine is cloned from, once found or adopted.
+ private(set) var template: VPhoneLaunchpadTemplate?
+ private(set) var templateID: String?
+ /// True when this creation built the template it cloned from, rather
+ /// than finding one.
+ private(set) var builtTemplate = false
/// The creation log. The sheet shows it in a terminal; the model keeps
/// only the last few lines, for error details.
private let log: VPhoneLaunchpadLogWriter
@@ -105,6 +107,11 @@ final class VPhoneLaunchpadCreationPipeline {
library: VPhoneLaunchpadMachineLibrary,
) {
self.options = options
+ plan = VPhoneLaunchpadCreationPlan(
+ name: options.name,
+ buildName: options.usesTemplate ? VPhoneLaunchpadCreationPlan.newBuildName() : nil,
+ slimming: options.slimming,
+ )
self.bundles = bundles
self.helper = helper
self.library = library
@@ -115,10 +122,21 @@ final class VPhoneLaunchpadCreationPipeline {
log.url
}
+ /// The machine asked for.
var machine: VPhoneLaunchpadMachinePath {
options.machine
}
+ /// The temporary machine a template is built in, while this creation
+ /// may build one.
+ var buildMachine: VPhoneLaunchpadMachinePath? {
+ plan.buildName.map { VPhoneLaunchpadMachinePath(libraryRoot: options.libraryRoot, name: $0) }
+ }
+
+ var steps: [Step] {
+ plan.steps
+ }
+
var isFinished: Bool {
statuses[.firstBoot] == .passed
}
@@ -129,13 +147,18 @@ final class VPhoneLaunchpadCreationPipeline {
/// The step a retry starts from: the one that failed.
var failedStep: Step? {
- Step.allCases.first { statuses[$0] == .failed }
+ steps.first { statuses[$0] == .failed }
+ }
+
+ /// The machine a step works on.
+ private func path(for step: Step) -> VPhoneLaunchpadMachinePath {
+ VPhoneLaunchpadMachinePath(libraryRoot: options.libraryRoot, name: plan.machineName(for: step))
}
/// `fw patch`, as both the step's log line and the run build it. One array so
/// the command the sheet shows cannot drift from the command that runs.
- private var patchArguments: [String] {
- ["fw", "patch", options.name] + options.patches.presetArguments
+ private func patchArguments(_ name: String) -> [String] {
+ ["fw", "patch", name] + options.patches.presetArguments
}
private var deviceArguments: [String] {
@@ -143,27 +166,42 @@ final class VPhoneLaunchpadCreationPipeline {
}
func command(for step: Step) -> String {
- let name = options.name
+ let name = plan.machineName(for: step)
+ let template = templateID ?? "<id>"
return switch step {
+ case .findTemplate: VPhoneLaunchpadTemplateCommands.find(options.templateRequest).joined(separator: " ")
case .create: "vm new \(name) --cpu \(options.cpuCount) --memory \(options.memoryMB) --disk-size \(options.diskSizeGB)"
case .prepare: (["fw", "prepare", name] + deviceArguments).joined(separator: " ")
- case .patch: patchArguments.joined(separator: " ")
+ case .patch: patchArguments(name).joined(separator: " ")
case .bootDFU: "vm launch \(name) --dfu"
case .waitDFU: "recovery-probe --ecid …"
case .restore: "restore \(name)"
case .stopDFU: "vm stop \(name)"
case .installCFW: "cfw install \(name)"
+ case .trimTemplate: (VPhoneLaunchpadTemplateCommands.trim(name, options.slimming) ?? []).joined(separator: " ")
+ case .setUpTemplate: VPhoneLaunchpadTemplateCommands.setup(name, options.slimming).joined(separator: " ")
+ case .adoptTemplate: "vm template adopt \(name) --json --iphone-source … --cloudos-source …"
+ case .cloneTemplate: VPhoneLaunchpadTemplateCommands.clone(
+ name, template: template, cpuCount: options.cpuCount, memoryMB: options.memoryMB, network: options.network,
+ ).joined(separator: " ")
case .firstBoot: "vm launch \(name)"
}
}
// MARK: - Control
- func start(from first: Step = .create) {
- guard !isRunning else {
+ func start(from first: Step? = nil) {
+ guard !isRunning, let first = first ?? steps.first else {
return
}
failure = nil
+ // Find again decides what follows it.
+ if first <= .findTemplate {
+ plan.foundTemplate = nil
+ templateID = nil
+ template = nil
+ builtTemplate = false
+ }
for step in Step.allCases where step >= first {
statuses[step] = .pending
durations[step] = nil
@@ -181,10 +219,12 @@ final class VPhoneLaunchpadCreationPipeline {
isRunning = false
current = nil
downloadFraction = nil
+ setupStage = nil
dfu?.terminate()
dfu = nil
}
- for step in Step.allCases where step >= first {
+ var next: Step? = first
+ while let step = next {
current = step
statuses[step] = .running
let began = Date()
@@ -209,11 +249,16 @@ final class VPhoneLaunchpadCreationPipeline {
?? VPhoneLaunchpadError(String(localized: "\(step.title) failed."), detail: error.localizedDescription)
}
append("✕ \(failure?.message ?? step.title)")
+ if let detail = failure?.detail, plan.buildsTemplate(step) || step == .findTemplate || step == .cloneTemplate {
+ append(" \(detail.replacingOccurrences(of: "\n", with: "\n "))")
+ }
await library?.refresh()
return
}
+ // Read after the step: Find Template decides what follows.
+ next = plan.step(after: step)
}
- if !options.keepArtifacts {
+ if !options.keepArtifacts, !plan.usesTemplate {
await removeRestoreFiles()
}
append("● \(options.name) is ready.")
@@ -222,7 +267,8 @@ final class VPhoneLaunchpadCreationPipeline {
/// Removes the `iPhone*_Restore` tree once the machine has booted, as
/// `cfw install` does without `--keep-artifacts`. Only a real folder is
/// removed; a link by that name is left alone. A failure here does not
- /// fail the creation.
+ /// fail the creation. A template build needs none of this: adopting it
+ /// removes the tree.
private func removeRestoreFiles() async {
let bundle = machine.url
let lines = await Task.detached { () -> [String] in
@@ -268,9 +314,10 @@ final class VPhoneLaunchpadCreationPipeline {
guard let commandLine = bundles.commandLine(version: version) else {
throw VPhoneLaunchpadError(String(localized: "VPhone.bundle \(version) is not installed."))
}
- let name = options.name
- let library = machine.libraryArguments
- let bundle = machine.url
+ let target = path(for: step)
+ let name = target.name
+ let library = target.libraryArguments
+ let bundle = target.url
let log = log
let output: @Sendable (String) -> Void = { line in log.write(line) }
@@ -283,21 +330,44 @@ final class VPhoneLaunchpadCreationPipeline {
try await commandLine.runChecked(arguments, onLine: onLine, onProgress: onProgress)
}
+ /// For the template steps: a failure names the step and carries the
+ /// line `vphone-cli` ended with, which says why.
+ func runReporting(
+ _ arguments: [String],
+ onLine: @escaping @Sendable (String) -> Void = output,
+ ) async throws -> VPhoneLaunchpadCommandResult {
+ onLine("$ \(VPhoneLaunchpadCommandLine.display(arguments))")
+ let result = try await commandLine.run(arguments, onLine: onLine)
+ try Task.checkCancellation()
+ guard result.succeeded else {
+ let reason = VPhoneLaunchpadTemplateCommands.failureLine(result.lines)
+ throw VPhoneLaunchpadError(
+ String(localized: "\(step.title) failed."),
+ detail: [reason, result.tail].compactMap(\.self).joined(separator: "\n\n"),
+ )
+ }
+ return result
+ }
+
switch step {
+ case .findTemplate:
+ try await findTemplate(runReporting)
+
case .create:
try await run(["vm", "new", name, "--cpu", String(options.cpuCount),
"--memory", String(options.memoryMB), "--disk-size", String(options.diskSizeGB)] + library)
// The folder exists now. Every later command, here and after
// creation, runs with the version recorded in it.
do {
- try self.library?.bind(machine, VPhoneLaunchpadMachineBinding(bundle: version, bootChain: version))
+ try self.library?.bind(target, VPhoneLaunchpadMachineBinding(bundle: version, bootChain: version))
} catch {
throw VPhoneLaunchpadError(
String(localized: "Unable to record the Core Bundle of \(name)."),
detail: error.localizedDescription,
)
}
- if options.network != "nat" {
+ // A template keeps the default network; its clone gets this one.
+ if options.network != "nat", !plan.usesTemplate {
try await run(["vm", "config", name, "--network", options.network] + library)
}
await self.library?.refresh()
@@ -322,8 +392,8 @@ final class VPhoneLaunchpadCreationPipeline {
// lines reach the log. The creation log starts over on a retry, so
// the patch output is also kept in a log of its own for later
// diagnosis.
- let patchLog = VPhoneLaunchpadLogWriter(url: VPhoneLaunchpadMachineLibrary.consoleLog(machine, suffix: "-patch"))
- patchLog.write("# \(options.name), \(Date().formatted(.iso8601)), Core Bundle \(version)")
+ let patchLog = VPhoneLaunchpadLogWriter(url: VPhoneLaunchpadMachineLibrary.consoleLog(target, suffix: "-patch"))
+ patchLog.write("# \(name), \(Date().formatted(.iso8601)), Core Bundle \(version)")
let tee: @Sendable (String) -> Void = { line in
log.write(line)
patchLog.write(line)
@@ -331,7 +401,7 @@ final class VPhoneLaunchpadCreationPipeline {
if options.patches.hasOverrides {
try await run(["fw", "set-patches", name] + options.patches.setPatchesArguments + library, onLine: tee)
}
- try await run(patchArguments + library, onLine: tee)
+ try await run(patchArguments(name) + library, onLine: tee)
case .bootDFU:
let arguments = ["vm", "launch", name, "--dfu"] + library
@@ -339,7 +409,7 @@ final class VPhoneLaunchpadCreationPipeline {
dfuPanicked = false
dfu = try commandLine.start(
arguments,
- logFile: VPhoneLaunchpadMachineLibrary.consoleLog(machine, suffix: "-dfu"),
+ logFile: VPhoneLaunchpadMachineLibrary.consoleLog(target, suffix: "-dfu"),
) { [weak self] line in
log.write("dfu \(line)")
if Self.isPanic(line) {
@@ -399,20 +469,156 @@ final class VPhoneLaunchpadCreationPipeline {
libraryRoot: Self.canonicalPath(URL(fileURLWithPath: options.libraryRoot, isDirectory: true)),
// The restore tree stays until first boot succeeds, so a
// failed boot can still be restored again without preparing
- // the firmware anew. `removeRestoreFiles()` reclaims it then.
+ // the firmware anew. `removeRestoreFiles()` reclaims it then;
+ // for a template build, adopting it does.
keepArtifacts: true,
onLine: output,
)
guard status == 0 else {
throw VPhoneLaunchpadError(String(localized: "Unable to install custom firmware. Check the log for details."), detail: log.tail)
}
- self.library?.recordGuestEnvironment(machine, version)
+ self.library?.recordGuestEnvironment(target, version)
+
+ case .trimTemplate:
+ try await stopIfRunning(target, commandLine: commandLine)
+ if let arguments = VPhoneLaunchpadTemplateCommands.trim(name, options.slimming) {
+ _ = try await runReporting(arguments + library)
+ }
+
+ case .setUpTemplate:
+ try await stopIfRunning(target, commandLine: commandLine)
+ // `[setup] b. wait for first-boot work`: the stage the sheet shows.
+ let stage: @Sendable (String) -> Void = { [weak self] line in
+ log.write(line)
+ guard line.hasPrefix("[setup] ") else { return }
+ let text = String(line.dropFirst("[setup] ".count))
+ Task { @MainActor in self?.setupStage = text }
+ }
+ defer { setupStage = nil }
+ _ = try await runReporting(VPhoneLaunchpadTemplateCommands.setup(name, options.slimming) + library, onLine: stage)
+
+ case .adoptTemplate:
+ try await adoptTemplate(target, runReporting, commandLine: commandLine)
+
+ case .cloneTemplate:
+ guard let templateID else {
+ throw VPhoneLaunchpadError(String(localized: "No template to create the machine from. Retry from Find Template."))
+ }
+ _ = try await runReporting(VPhoneLaunchpadTemplateCommands.clone(
+ name, template: templateID, cpuCount: options.cpuCount, memoryMB: options.memoryMB, network: options.network,
+ ) + library)
+ bindClone(target, version: version)
+ await self.library?.refresh()
+ self.library?.selection = [target]
case .firstBoot:
try await firstBoot()
}
}
+ // MARK: - Template steps
+
+ /// `vm template find`: a usable template skips the build. A stale one
+ /// with the same key would make the adopt fail at the end, so it is
+ /// reported at once.
+ private func findTemplate(
+ _ run: ([String], @escaping @Sendable (String) -> Void) async throws -> VPhoneLaunchpadCommandResult,
+ ) async throws {
+ let log = log
+ let result = try await run(
+ VPhoneLaunchpadTemplateCommands.find(options.templateRequest) + options.machine.libraryArguments,
+ { line in log.write(line) },
+ )
+ guard let data = result.jsonData, let found = try? VPhoneLaunchpadTemplateFind.decode(data) else {
+ throw VPhoneLaunchpadError(String(localized: "Unable to read the template search."), detail: result.tail)
+ }
+ if found.usable, let id = found.id {
+ templateID = id
+ template = found.template
+ builtTemplate = false
+ plan.foundTemplate = true
+ append("● using template \(id)\(found.template.map { ", \($0.machines.count) machine(s) use it" } ?? "")")
+ return
+ }
+ if let stale = found.template {
+ throw VPhoneLaunchpadError(
+ String(localized: "An outdated template has the key this machine needs."),
+ detail: String(localized: "Delete template \(stale.id) in Templates, then retry. Machines created from it keep working.")
+ + "\n" + stale.staleReasons.joined(separator: "\n"),
+ )
+ }
+ if found.building {
+ throw VPhoneLaunchpadError(
+ String(localized: "Another creation is building this template."),
+ detail: String(localized: "Retry once it has finished; the machine is then created from that template."),
+ )
+ }
+ plan.foundTemplate = false
+ append("● no template yet (\(found.reason ?? found.id ?? "")); building one in \(plan.buildName ?? "")")
+ }
+
+ /// `vm template adopt`. When another creation saved the same template
+ /// first, this build is not needed: it is deleted and that template used.
+ private func adoptTemplate(
+ _ target: VPhoneLaunchpadMachinePath,
+ _ run: ([String], @escaping @Sendable (String) -> Void) async throws -> VPhoneLaunchpadCommandResult,
+ commandLine: VPhoneLaunchpadCommandLine,
+ ) async throws {
+ let log = log
+ let output: @Sendable (String) -> Void = { line in log.write(line) }
+ do {
+ let result = try await run(VPhoneLaunchpadTemplateCommands.adopt(
+ target.name, iphoneSource: options.iphoneSource, cloudOSSource: options.cloudOSSource,
+ ) + target.libraryArguments, output)
+ guard let data = result.jsonData, let adopted = try? VPhoneLaunchpadTemplate.decoder().decode(VPhoneLaunchpadTemplate.self, from: data)
+ else {
+ throw VPhoneLaunchpadError(String(localized: "Unable to read the saved template."), detail: result.tail)
+ }
+ templateID = adopted.id
+ template = adopted
+ builtTemplate = true
+ append("● template \(adopted.id) saved")
+ } catch {
+ let again = try? await commandLine.run(
+ VPhoneLaunchpadTemplateCommands.find(options.templateRequest) + target.libraryArguments,
+ recordInHistory: false,
+ )
+ guard let data = again?.jsonData, let found = try? VPhoneLaunchpadTemplateFind.decode(data), found.usable, let id = found.id else {
+ throw error
+ }
+ append("● template \(id) was saved by another creation meanwhile; removing \(target.name)")
+ _ = try? await commandLine.run(["vm", "delete", target.name, "--force"] + target.libraryArguments)
+ templateID = id
+ template = found.template
+ builtTemplate = false
+ }
+ await library?.refresh()
+ }
+
+ /// The clone carries the template's `launchpad.json`, if Launchpad built
+ /// it; it runs with this creation's bundle either way. A template the CLI
+ /// built has none: its record names the bundles.
+ private func bindClone(_ target: VPhoneLaunchpadMachinePath, version: String) {
+ var binding = VPhoneLaunchpadMachineBinding.load(target) ?? VPhoneLaunchpadMachineBinding(
+ bundle: version,
+ bootChain: template?.bootChainBundleVersion,
+ guestEnvironment: template?.builtWithBundleVersion,
+ )
+ binding.bundle = version
+ try? library?.bind(target, binding)
+ }
+
+ /// The trim and the setup boot need the build stopped; a retry may find
+ /// it started since.
+ private func stopIfRunning(_ target: VPhoneLaunchpadMachinePath, commandLine: VPhoneLaunchpadCommandLine) async throws {
+ guard let library, await library.isMachineRunning(target) else {
+ return
+ }
+ let arguments = ["vm", "stop", target.name, "--timeout", "20"] + target.libraryArguments
+ append("$ \(VPhoneLaunchpadCommandLine.display(arguments))")
+ try await commandLine.runChecked(arguments, onLine: { [log] line in log.write(line) })
+ }
+
/// Boots with a window, as `vm create` does, and waits for vphoned to
/// answer on the VM's automation socket. The machine keeps running.
private func firstBoot() async throws {
@@ -542,40 +748,97 @@ final class VPhoneLaunchpadCreationPipeline {
}
}
+
#if DEBUG
extension VPhoneLaunchpadCreationPipeline {
- /// Running the restore, failed while preparing firmware, or partway
- /// through downloading an IPSW.
- func applyPreview(failed: Bool = false, downloading: Double? = nil) {
+ enum PreviewState {
+ /// Restoring the machine itself, without a template.
+ case restoring
+ /// Failed while preparing firmware.
+ case failed
+ /// Partway through downloading an IPSW.
+ case downloading(Double)
+ /// Building a template: in its setup boot.
+ case settingUpTemplate
+ /// Built a template, cloned the machine and booted it.
+ case builtTemplate
+ /// Found a template and cloned from it.
+ case clonedFromTemplate
+ /// The setup boot failed.
+ case setupFailed
+ }
+
+ func applyPreview(_ state: PreviewState) {
statuses = [:]
durations = [:]
downloadFraction = nil
- if let downloading {
- statuses[.create] = .passed
- durations[.create] = 1
- statuses[.prepare] = .running
- downloadFraction = downloading
- current = .prepare
- isRunning = true
- return
+ setupStage = nil
+ failure = nil
+ current = nil
+ isRunning = false
+ templateID = nil
+ template = nil
+ builtTemplate = false
+ func passed(_ steps: [(Step, TimeInterval)]) {
+ for (step, duration) in steps {
+ statuses[step] = .passed
+ durations[step] = duration
+ }
}
- if failed {
- statuses[.create] = .passed
- durations[.create] = 0
+ let restored: [(Step, TimeInterval)] = [
+ (.create, 1), (.prepare, 862), (.patch, 48), (.bootDFU, 6), (.waitDFU, 3), (.restore, 87), (.stopDFU, 10), (.installCFW, 61),
+ ]
+ switch state {
+ case .restoring:
+ plan.foundTemplate = plan.usesTemplate ? false : nil
+ passed((plan.usesTemplate ? [(.findTemplate, 0)] : []) + Array(restored.prefix(5)))
+ statuses[.restore] = .running
+ current = .restore
+ isRunning = true
+ case .failed:
+ passed([(.findTemplate, 0), (.create, 0)])
+ plan.foundTemplate = false
statuses[.prepare] = .failed
durations[.prepare] = 6
- current = nil
- isRunning = false
- return
- }
- let finished: [Step: TimeInterval] = [.create: 1, .prepare: 862, .patch: 48, .bootDFU: 6, .waitDFU: 3]
- for (step, duration) in finished {
- statuses[step] = .passed
- durations[step] = duration
+ failure = VPhoneLaunchpadError(String(localized: "\(Step.prepare.title) failed."), detail: "Unable to download the IPSW from https://updates.cdn-apple.com/. Try again later.")
+ case let .downloading(fraction):
+ plan.foundTemplate = false
+ passed([(.findTemplate, 0), (.create, 1)])
+ statuses[.prepare] = .running
+ downloadFraction = fraction
+ current = .prepare
+ isRunning = true
+ case .settingUpTemplate:
+ plan.foundTemplate = false
+ passed([(.findTemplate, 0)] + restored + [(.trimTemplate, 3)])
+ statuses[.setUpTemplate] = .running
+ setupStage = "b. wait for first-boot work"
+ current = .setUpTemplate
+ isRunning = true
+ case .builtTemplate:
+ plan.foundTemplate = false
+ passed([(.findTemplate, 0)] + restored + [(.trimTemplate, 3), (.setUpTemplate, 121), (.adoptTemplate, 0), (.cloneTemplate, 1), (.firstBoot, 9)])
+ templateID = VPhoneLaunchpadPreview.templates.first?.id
+ template = VPhoneLaunchpadPreview.templates.first
+ builtTemplate = true
+ case .clonedFromTemplate:
+ plan.foundTemplate = true
+ passed([(.findTemplate, 0), (.cloneTemplate, 1)])
+ statuses[.firstBoot] = .running
+ templateID = VPhoneLaunchpadPreview.templates.first?.id
+ template = VPhoneLaunchpadPreview.templates.first
+ current = .firstBoot
+ isRunning = true
+ case .setupFailed:
+ plan.foundTemplate = false
+ passed([(.findTemplate, 0)] + restored + [(.trimTemplate, 3)])
+ statuses[.setUpTemplate] = .failed
+ durations[.setUpTemplate] = 214
+ failure = VPhoneLaunchpadError(
+ String(localized: "\(Step.setUpTemplate.title) failed."),
+ detail: "Setup boot failed at step settle (b. wait for first-boot work): not settled within 300 s: staged_system_apps not empty",
+ )
}
- statuses[.restore] = .running
- current = .restore
- isRunning = true
}
}
#endif
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPlan.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPlan.swift
new file mode 100644
index 00000000..427e27dc
--- /dev/null
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPlan.swift
@@ -0,0 +1,128 @@
+import Foundation
+
+// MARK: - Steps
+
+/// One step of New Machine's pipeline, in the order they run.
+nonisolated enum VPhoneLaunchpadCreationStep: Int, CaseIterable, Identifiable, Comparable, Sendable {
+ /// `vm template find`: is there a template for these options already?
+ case findTemplate
+ case create
+ case prepare
+ case patch
+ case bootDFU
+ case waitDFU
+ case restore
+ case stopDFU
+ case installCFW
+ /// `vm template trim` on the stopped template build.
+ case trimTemplate
+ /// `vm template setup`: the template's one boot, headless.
+ case setUpTemplate
+ /// `vm template adopt`: the build becomes the frozen template.
+ case adoptTemplate
+ /// `vm create --template`: the new machine, cloned in a second.
+ case cloneTemplate
+ case firstBoot
+
+ var id: Int {
+ rawValue
+ }
+
+ static func < (lhs: Self, rhs: Self) -> Bool {
+ lhs.rawValue < rhs.rawValue
+ }
+
+ var title: String {
+ switch self {
+ case .findTemplate: String(localized: "Find template")
+ case .create: String(localized: "Create machine")
+ case .prepare: String(localized: "Download and prepare firmware")
+ case .patch: String(localized: "Patch boot chain")
+ case .bootDFU: String(localized: "Boot into DFU")
+ case .waitDFU: String(localized: "Wait for DFU")
+ case .restore: String(localized: "Restore")
+ case .stopDFU: String(localized: "Stop machine")
+ case .installCFW: String(localized: "Install custom firmware")
+ case .trimTemplate: String(localized: "Trim system files")
+ case .setUpTemplate: String(localized: "Set up template")
+ case .adoptTemplate: String(localized: "Save template")
+ case .cloneTemplate: String(localized: "Create machine from template")
+ case .firstBoot: String(localized: "First boot")
+ }
+ }
+
+ var needsRoot: Bool {
+ self == .installCFW
+ }
+}
+
+// MARK: - Plan
+
+/// Which steps a creation runs, and on which machine.
+///
+/// Without a template every step works on the new machine itself, as
+/// `vm create --no-template` does. With one, Find Template asks the bundle
+/// whether a template for these options exists. If it does, the machine is
+/// cloned from it and booted. If not, the template is built first under a
+/// temporary machine name in the same library: restored, custom firmware
+/// installed through the helper, trimmed, set up headless and adopted, which
+/// moves it into `.templates`. Then the clone and its first boot follow.
+nonisolated struct VPhoneLaunchpadCreationPlan: Hashable, Sendable {
+ /// The machine New Machine was asked for.
+ var name: String
+ /// The temporary machine a template is built in; nil without a template.
+ var buildName: String?
+ var slimming: VPhoneLaunchpadSlimming
+ /// Nil until Find Template answers; then whether it found a template
+ /// this creation clones from as it is.
+ var foundTemplate: Bool?
+
+ var usesTemplate: Bool {
+ buildName != nil
+ }
+
+ /// Every step this creation runs, in order. Until Find Template has
+ /// answered, a template-backed creation lists the build too.
+ var steps: [VPhoneLaunchpadCreationStep] {
+ let restore: [VPhoneLaunchpadCreationStep] = [.create, .prepare, .patch, .bootDFU, .waitDFU, .restore, .stopDFU, .installCFW]
+ guard usesTemplate else {
+ return restore + [.firstBoot]
+ }
+ if foundTemplate == true {
+ return [.findTemplate, .cloneTemplate, .firstBoot]
+ }
+ var steps: [VPhoneLaunchpadCreationStep] = [.findTemplate] + restore
+ if slimming.trimArguments != nil {
+ steps.append(.trimTemplate)
+ }
+ return steps + [.setUpTemplate, .adoptTemplate, .cloneTemplate, .firstBoot]
+ }
+
+ /// The step after `step`, or nil after the last.
+ func step(after step: VPhoneLaunchpadCreationStep) -> VPhoneLaunchpadCreationStep? {
+ steps.first { $0 > step }
+ }
+
+ /// Whether `step` builds the template rather than the machine asked for.
+ func buildsTemplate(_ step: VPhoneLaunchpadCreationStep) -> Bool {
+ guard usesTemplate else {
+ return false
+ }
+ switch step {
+ case .findTemplate, .cloneTemplate, .firstBoot: return false
+ default: return true
+ }
+ }
+
+ /// The machine `step` works on.
+ func machineName(for step: VPhoneLaunchpadCreationStep) -> String {
+ buildsTemplate(step) ? buildName ?? name : name
+ }
+
+ /// A short machine name no library is likely to hold: `template-`
+ /// and eight hex digits. It stays in the library only while the
+ /// template is built.
+ static func newBuildName() -> String {
+ "template-" + String(UUID().uuidString.replacingOccurrences(of: "-", with: "").prefix(8)).lowercased()
+ }
+}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadDiskUsage.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadDiskUsage.swift
new file mode 100644
index 00000000..cb182d62
--- /dev/null
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadDiskUsage.swift
@@ -0,0 +1,79 @@
+import Darwin
+import Foundation
+
+/// What a machine folder takes on disk.
+///
+/// `allocated` counts every block its files hold (`st_blocks`), shared or
+/// not. `exclusive` counts the blocks no other file shares: APFS's private
+/// size (`ATTR_CMNEXT_PRIVATESIZE`), what deleting the folder would free. A
+/// machine cloned from a template shares every block it has not written with
+/// the template and its other clones, so its exclusive size is a fraction of
+/// what is allocated. A Time Machine local snapshot also counts as sharing.
+nonisolated struct VPhoneLaunchpadDiskUsage: Hashable, Sendable {
+ var allocated: Int64
+ /// Nil when the volume does not report private sizes (not APFS).
+ var exclusive: Int64?
+
+ /// Walks `folder` without following links. Slow for a big folder of many
+ /// files; call it off the main actor.
+ static func measure(_ folder: URL) -> Self {
+ let keys: [URLResourceKey] = [.isRegularFileKey, .isSymbolicLinkKey, .totalFileAllocatedSizeKey]
+ var usage = Self(allocated: 0, exclusive: 0)
+ guard let walker = FileManager.default.enumerator(at: folder, includingPropertiesForKeys: keys, options: []) else {
+ return Self(allocated: 0, exclusive: nil)
+ }
+ for case let file as URL in walker {
+ guard let values = try? file.resourceValues(forKeys: Set(keys)),
+ values.isSymbolicLink != true, values.isRegularFile == true
+ else {
+ continue
+ }
+ usage.allocated += Int64(values.totalFileAllocatedSize ?? 0)
+ if let exclusive = usage.exclusive {
+ usage.exclusive = privateSize(of: file.path).map { exclusive + $0 }
+ }
+ }
+ return usage
+ }
+
+ /// The bytes of `path` no other file shares, or nil when the file system
+ /// does not say. A link is not followed.
+ static func privateSize(of path: String) -> Int64? {
+ var request = attrlist()
+ request.bitmapcount = u_short(ATTR_BIT_MAP_COUNT)
+ request.commonattr = attrgroup_t(ATTR_CMN_RETURNED_ATTRS)
+ // Extended common attributes are asked for in the fork field.
+ request.forkattr = attrgroup_t(ATTR_CMNEXT_PRIVATESIZE)
+ // u_int32_t length, attribute_set_t returned, off_t private size.
+ var buffer = [UInt8](repeating: 0, count: 64)
+ let options = UInt32(FSOPT_ATTR_CMN_EXTENDED) | UInt32(FSOPT_NOFOLLOW)
+ let status = buffer.withUnsafeMutableBytes { bytes in
+ getattrlist(path, &request, bytes.baseAddress, bytes.count, options)
+ }
+ guard status == 0 else {
+ return nil
+ }
+ return buffer.withUnsafeBytes { bytes -> Int64? in
+ let returned = bytes.loadUnaligned(fromByteOffset: 4, as: attribute_set_t.self)
+ guard returned.forkattr & attrgroup_t(ATTR_CMNEXT_PRIVATESIZE) != 0 else {
+ return nil
+ }
+ let offset = 4 + MemoryLayout<attribute_set_t>.size
+ return Int64(bytes.loadUnaligned(fromByteOffset: offset, as: off_t.self))
+ }
+ }
+
+ /// `17.58 GB`, decimal as the Finder counts.
+ static func format(_ bytes: Int64, locale: Locale = .current) -> String {
+ bytes.formatted(.byteCount(style: .file).locale(locale))
+ }
+
+ /// The inspector's value: `0.61 GB of 17.58 GB`, or the allocated size
+ /// alone when the volume gives no private size.
+ func summary(locale: Locale = .current) -> String {
+ guard let exclusive else {
+ return Self.format(allocated, locale: locale)
+ }
+ return String(localized: "\(Self.format(exclusive, locale: locale)) of \(Self.format(allocated, locale: locale))")
+ }
+}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadGuestSystemView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadGuestSystemView.swift
new file mode 100644
index 00000000..63e5eb06
--- /dev/null
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadGuestSystemView.swift
@@ -0,0 +1,291 @@
+import SwiftUI
+
+// MARK: - State read from the guest
+
+/// `services.profile`, as much of it as the sheet shows.
+nonisolated struct VPhoneLaunchpadServiceProfile: Equatable, Sendable {
+ var profile: String
+ var supported: Bool
+ /// The groups and allowed labels the guest's record holds, passed back
+ /// when the profile is applied again so `--accounts-off` stays.
+ var groups: [String]
+ var allow: [String]
+ /// Labels the profile turned off that still run until the guest restarts.
+ var running: Int
+ var rebootRequired: Bool
+
+ init(_ result: [String: Any]) {
+ profile = result["profile"] as? String ?? "none"
+ supported = result["supported"] as? Bool ?? false
+ let record = result["record"] as? [String: Any]
+ groups = record?["groups"] as? [String] ?? []
+ allow = record?["allow"] as? [String] ?? []
+ running = (result["running"] as? [Any])?.count ?? 0
+ rebootRequired = result["reboot_required"] as? Bool ?? false
+ }
+}
+
+/// One backup `apps.removed_system` lists.
+nonisolated struct VPhoneLaunchpadRemovedApp: Identifiable, Hashable, Sendable {
+ let id: String
+ let name: String
+ let restorable: Bool
+
+ static func list(_ result: [String: Any]) -> [Self] {
+ let backups = result["backups"] as? [[String: Any]] ?? []
+ var seen = Set<String>()
+ return backups.compactMap { backup in
+ guard let bundleID = backup["bundle_id"] as? String, seen.insert(bundleID).inserted else {
+ return nil
+ }
+ let app = (backup["app"] as? String).map { $0.hasSuffix(".app") ? String($0.dropLast(4)) : $0 }
+ let known = VPhoneLaunchpadSlimming.removableApps.first { $0.id == bundleID }?.name
+ return Self(id: bundleID, name: known ?? app ?? bundleID, restorable: backup["restorable"] as? Bool ?? true)
+ }
+ }
+}
+
+// MARK: - Sheet
+
+/// What a template's slimming left in one machine's guest, and how to undo
+/// it there: the service profile, switched at once and taking effect when the
+/// guest restarts, and the removed system apps, restored from the backups the
+/// removal kept. Both go through vphoned, so the machine must be running.
+struct VPhoneLaunchpadGuestSystemView: View {
+ let machine: VPhoneLaunchpadMachinePath
+ @Environment(VPhoneLaunchpadModel.self) private var model
+ @Environment(\.dismiss) private var dismiss
+ @State private var profile: VPhoneLaunchpadServiceProfile?
+ @State private var chosenProfile = "trimmed"
+ @State private var removedApps: [VPhoneLaunchpadRemovedApp]?
+ @State private var selectedApps: Set<String> = []
+ @State private var loadError: String?
+ @State private var isWorking = false
+ /// What the last change did, under its section.
+ @State private var profileNote: String?
+ @State private var appsNote: String?
+ @State private var error: VPhoneLaunchpadError?
+
+ private var library: VPhoneLaunchpadMachineLibrary {
+ model.machines
+ }
+
+ private var isRunning: Bool {
+ #if DEBUG
+ if VPhoneLaunchpadPreview.isActive {
+ return VPhoneLaunchpadPreview.guestSystemRunning
+ }
+ #endif
+ return library.state(of: machine) == .running
+ }
+
+ var body: some View {
+ VPhoneLaunchpadSheet(Text("\(machine.name) Guest System")) {
+ Form {
+ if !isRunning {
+ Section {
+ Label("Start \(machine.name) to change these. They change the guest itself, through vphoned.", systemImage: "info.circle")
+ .foregroundStyle(.secondary)
+ }
+ } else if let loadError {
+ Section {
+ Label(loadError, systemImage: "exclamationmark.triangle")
+ .foregroundStyle(.secondary)
+ .textSelection(.enabled)
+ HStack {
+ Spacer()
+ Button("Try Again") { Task { await load() } }
+ }
+ }
+ } else {
+ servicesSection
+ appsSection
+ }
+ }
+ .formStyle(.grouped)
+ } actions: {
+ Button("Done") { dismiss() }
+ .keyboardShortcut(.defaultAction)
+ }
+ .frame(width: 480)
+ .fixedSize(horizontal: false, vertical: true)
+ .task(id: isRunning) {
+ if isRunning {
+ await load()
+ }
+ }
+ .errorAlert($error)
+ }
+
+ // MARK: - Services
+
+ @ViewBuilder
+ private var servicesSection: some View {
+ Section {
+ if let profile {
+ Picker("Service Profile", selection: $chosenProfile) {
+ Text("Trimmed").tag("trimmed")
+ Text("None").tag("none")
+ }
+ HStack {
+ if profile.rebootRequired {
+ Label("Restart required", systemImage: "arrow.clockwise")
+ .foregroundStyle(.orange)
+ .font(.callout)
+ }
+ Spacer()
+ if profile.rebootRequired {
+ Button("Restart Guest") { Task { await restartGuest() } }
+ .disabled(isWorking)
+ }
+ Button("Apply") { Task { await applyProfile() } }
+ .disabled(isWorking || chosenProfile == profile.profile || (!profile.supported && chosenProfile == "trimmed"))
+ }
+ } else {
+ ProgressView().controlSize(.small).frame(maxWidth: .infinity)
+ }
+ } header: {
+ Text("Services")
+ } footer: {
+ VStack(alignment: .leading, spacing: 4) {
+ Text("Trimmed turns off about 140 launch daemons a research machine rarely needs; None turns back on only those it turned off. Either takes effect when the guest restarts.")
+ if profile?.supported == false {
+ Text("This iOS version has no trimmed list.")
+ }
+ if let profileNote {
+ Text(verbatim: profileNote)
+ }
+ }
+ .foregroundStyle(.secondary)
+ }
+ }
+
+ // MARK: - Apps
+
+ @ViewBuilder
+ private var appsSection: some View {
+ Section {
+ if let removedApps {
+ if removedApps.isEmpty {
+ Text("No system app was removed.").foregroundStyle(.secondary)
+ } else {
+ ForEach(removedApps) { app in
+ Toggle(isOn: Binding(
+ get: { selectedApps.contains(app.id) },
+ set: { selected in
+ if selected {
+ selectedApps.insert(app.id)
+ } else {
+ selectedApps.remove(app.id)
+ }
+ },
+ )) {
+ HStack {
+ Text(verbatim: app.name)
+ Spacer()
+ Text(verbatim: app.id).font(.caption).foregroundStyle(.secondary)
+ }
+ }
+ .toggleStyle(.checkbox)
+ .disabled(!app.restorable)
+ }
+ HStack {
+ Spacer()
+ Button("Restore Selected") { Task { await restoreApps() } }
+ .disabled(isWorking || selectedApps.isEmpty)
+ }
+ }
+ } else {
+ ProgressView().controlSize(.small).frame(maxWidth: .infinity)
+ }
+ } header: {
+ Text("Removed System Apps")
+ } footer: {
+ VStack(alignment: .leading, spacing: 4) {
+ Text("The template's setup boot removed these and kept a backup in the guest. A restored app returns to the Home Screen after SpringBoard restarts.")
+ if let appsNote {
+ Text(verbatim: appsNote)
+ }
+ }
+ .foregroundStyle(.secondary)
+ }
+ }
+
+ // MARK: - Calls
+
+ private func load() async {
+ #if DEBUG
+ if VPhoneLaunchpadPreview.isActive {
+ profile = VPhoneLaunchpadServiceProfile(VPhoneLaunchpadPreview.serviceProfile)
+ chosenProfile = profile?.profile ?? "trimmed"
+ removedApps = VPhoneLaunchpadRemovedApp.list(VPhoneLaunchpadPreview.removedSystemApps)
+ selectedApps = ["com.apple.news"]
+ return
+ }
+ #endif
+ loadError = nil
+ do {
+ let state = try await VPhoneLaunchpadServiceProfile(library.guestCall(machine, "services.profile"))
+ profile = state
+ chosenProfile = state.profile
+ removedApps = try await VPhoneLaunchpadRemovedApp.list(library.guestCall(machine, "apps.removed_system"))
+ selectedApps.formIntersection(Set(removedApps?.map(\.id) ?? []))
+ } catch {
+ loadError = VPhoneLaunchpadError.message(for: error)
+ }
+ }
+
+ private func applyProfile() async {
+ guard let profile else {
+ return
+ }
+ isWorking = true
+ defer { isWorking = false }
+ var params: [String: Any] = ["profile": chosenProfile, "force": true]
+ if chosenProfile == "trimmed" {
+ params["groups"] = profile.groups
+ params["allow"] = profile.allow
+ }
+ do {
+ let result = try await library.guestCall(machine, "services.profile.apply", params)
+ let disabled = (result["disabled"] as? [Any])?.count ?? 0
+ let enabled = (result["enabled"] as? [Any])?.count ?? 0
+ let failed = (result["failed"] as? [Any])?.count ?? 0
+ var note = String(localized: "\(disabled) turned off, \(enabled) turned back on.")
+ if failed > 0 {
+ note += " " + String(localized: "\(failed) could not be changed.")
+ }
+ profileNote = note
+ self.profile = try await VPhoneLaunchpadServiceProfile(library.guestCall(machine, "services.profile"))
+ } catch {
+ self.error = VPhoneLaunchpadError(String(localized: "Unable to Change the Service Profile"), detail: VPhoneLaunchpadError.message(for: error))
+ }
+ }
+
+ private func restartGuest() async {
+ isWorking = true
+ defer { isWorking = false }
+ do {
+ _ = try await library.guestCall(machine, "system.reboot", ["force": true], timeout: 30)
+ profileNote = String(localized: "The guest is restarting.")
+ } catch {
+ self.error = VPhoneLaunchpadError(String(localized: "Unable to Restart the Guest"), detail: VPhoneLaunchpadError.message(for: error))
+ }
+ }
+
+ private func restoreApps() async {
+ isWorking = true
+ defer { isWorking = false }
+ let identifiers = selectedApps.sorted()
+ do {
+ let result = try await library.guestCall(machine, "apps.restore_system", ["bundle_ids": identifiers, "force": true])
+ let results = result["results"] as? [[String: Any]] ?? []
+ let restored = results.filter { $0["status"] as? String == "restored" }.count
+ appsNote = String(localized: "^[\(restored) app](inflect: true) restored.")
+ selectedApps = []
+ } catch {
+ self.error = VPhoneLaunchpadError(String(localized: "Unable to Restore the Apps"), detail: VPhoneLaunchpadError.message(for: error))
+ }
+ removedApps = try? await VPhoneLaunchpadRemovedApp.list(library.guestCall(machine, "apps.removed_system"))
+ }
+}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swift
index 71431f34..083ca3ee 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swift
@@ -77,6 +77,7 @@ struct VPhoneLaunchpadMachineInspector: View {
let onShowProgress: (VPhoneLaunchpadMachinePath) -> Void
let onOpenConsole: (VPhoneLaunchpadMachinePath) -> Void
var onChangeBundle: (VPhoneLaunchpadMachine) -> Void = { _ in }
+ var onOpenGuestSystem: (VPhoneLaunchpadMachinePath) -> Void = { _ in }
@Environment(VPhoneLaunchpadModel.self) private var model
@State private var showsCommands = false
@State private var patchCatalog: VPhoneLaunchpadPatchCatalog?
@@ -96,7 +97,7 @@ struct VPhoneLaunchpadMachineInspector: View {
var body: some View {
Form {
Section {
- if let creation = library.creations[machine.path] {
+ if let creation = library.creation(for: machine.path) {
creationSummary(creation)
}
LabeledContent("State") {
@@ -133,6 +134,18 @@ struct VPhoneLaunchpadMachineInspector: View {
LabeledContent("CPU", value: String(localized: "\(machine.cpuCount) cores"))
LabeledContent("Memory", value: VPhoneLaunchpadMachinesView.memory(machine.memoryMB))
LabeledContent("Disk", value: VPhoneLaunchpadMachinesView.disk(machine.diskSizeBytes))
+ if let usage = library.diskUsage[machine.path] {
+ if let exclusive = usage.exclusive {
+ LabeledContent("Exclusive") {
+ Text(VPhoneLaunchpadDiskUsage.format(exclusive))
+ .help(String(localized: "The blocks only this machine holds: what deleting it frees. The rest is shared with its template or clones."))
+ }
+ }
+ LabeledContent("Allocated") {
+ Text(VPhoneLaunchpadDiskUsage.format(usage.allocated))
+ .help(String(localized: "Every block the machine's files hold, shared or not."))
+ }
+ }
LabeledContent("Network", value: machine.networkDescription)
if let address = machine.addressDescription {
LabeledContent("IPv4 Address", value: address)
@@ -158,12 +171,31 @@ struct VPhoneLaunchpadMachineInspector: View {
if let udid = machine.udid {
value("UDID", udid)
}
+ if let template = library.templateSources[machine.path] {
+ LabeledContent("Template") {
+ Text(verbatim: template)
+ .textSelection(.enabled)
+ .help(String(localized: "Created from this template. It shares the template's SEP root secret and Data volume keys with every machine created from it."))
+ }
+ }
value(
"Location",
VPhoneLaunchpadHostSetup.abbreviated(machine.path.url),
)
}
+ Section {
+ HStack {
+ Text("Service profile and removed system apps")
+ .foregroundStyle(.secondary)
+ Spacer()
+ Button("Guest System…") { onOpenGuestSystem(machine.path) }
+ .disabled(library.creation(for: machine.path)?.isRunning == true)
+ }
+ } header: {
+ Text("Guest System")
+ }
+
Section("Console") {
HStack {
Button {
@@ -234,7 +266,7 @@ struct VPhoneLaunchpadMachineInspector: View {
HStack {
Spacer()
Button("Change…") { onChangeBundle(machine) }
- .disabled(model.bundles.selectableVersions.isEmpty || library.creations[machine.path]?.isRunning == true)
+ .disabled(model.bundles.selectableVersions.isEmpty || library.creation(for: machine.path)?.isRunning == true)
}
}
}
@@ -267,7 +299,7 @@ struct VPhoneLaunchpadMachineInspector: View {
/// guest patches in line. Boot-chain patches only a restore changes.
@ViewBuilder
private var patchesSection: some View {
- if library.creations[machine.path]?.isRunning != true {
+ if library.creation(for: machine.path)?.isRunning != true {
Section("Patches") {
if let catalog = patchCatalog, patchCatalogMachine == machine.path {
LabeledContent(
@@ -382,7 +414,7 @@ struct VPhoneLaunchpadMachineInspector: View {
patchCatalogError = nil
patchCatalogMachine = path
}
- guard library.creations[path]?.isRunning != true else { return }
+ guard library.creation(for: path)?.isRunning != true else { return }
do {
let catalog = try await VPhoneLaunchpadPatchCatalog.read(
using: library.commandLine(for: path),
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swift
index 8bbc37a3..951017fe 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swift
@@ -95,13 +95,17 @@ final class VPhoneLaunchpadMachineLibrary {
/// The bar the state label shows in place of its text: an export's
/// progress, or the IPSW download of a creation.
func progress(of machine: Path) -> Double? {
- exports[machine]?.fraction ?? creations[machine]?.downloadFraction
+ exports[machine]?.fraction ?? creation(for: machine)?.downloadFraction
}
func state(of machine: Path) -> RunState {
if let creation = creations[machine], creation.isRunning, let step = creation.current {
return .busy(String(localized: "Creating: \(step.title)"))
}
+ // The temporary machine a template is built in.
+ if let creation = creation(for: machine), creation.isRunning, let step = creation.current {
+ return .busy(String(localized: "Building template: \(step.title)"))
+ }
if let activity = activities[machine] {
return .busy(activity)
}
@@ -118,6 +122,11 @@ final class VPhoneLaunchpadMachineLibrary {
launched[machine]
}
+ /// The creation of a machine, or the one building a template in it.
+ func creation(for machine: Path) -> VPhoneLaunchpadCreationPipeline? {
+ creations[machine] ?? creations.values.first { $0.buildMachine == machine }
+ }
+
// MARK: - Locations
/// The library New Machine offers first: the one last created in, while
@@ -214,6 +223,7 @@ final class VPhoneLaunchpadMachineLibrary {
let paths = machines.map(\.path)
externallyRunning = await Task.detached { Self.machinesHoldingDisks(paths) }.value
await loadBindings(paths)
+ refreshDiskUsage()
}
/// The same test `vm stop` uses: a machine runs while some process holds
@@ -266,7 +276,7 @@ final class VPhoneLaunchpadMachineLibrary {
/// version, so a bundle installed later does not change what it runs. A
/// machine still being created is skipped: its pipeline binds it.
private func loadBindings(_ paths: [Path]) async {
- let pending = Set(creations.keys)
+ let pending = Set(creations.keys).union(creations.values.compactMap(\.buildMachine))
let fallback = bundles.defaultVersion
let before = bindings
var loaded = await Task.detached {
@@ -604,11 +614,11 @@ final class VPhoneLaunchpadMachineLibrary {
do {
_ = try await VPhoneLaunchpadGuestSocket.send(request, socketPath: socket, timeout: 10)
} catch {
- return await !isRunning(machine)
+ return await !isMachineRunning(machine)
}
let deadline = Date().addingTimeInterval(Self.guestShutdownTimeout)
while Date() < deadline {
- if await !isRunning(machine) {
+ if await !isMachineRunning(machine) {
return true
}
try? await Task.sleep(for: .seconds(1))
@@ -618,7 +628,7 @@ final class VPhoneLaunchpadMachineLibrary {
/// Whether the machine's virtual machine is still up: the process
/// Launchpad started, or for one started elsewhere, whoever holds its disk.
- private func isRunning(_ machine: Path) async -> Bool {
+ func isMachineRunning(_ machine: Path) async -> Bool {
if let child = launched[machine] {
return child.isRunning
}
@@ -691,13 +701,156 @@ final class VPhoneLaunchpadMachineLibrary {
/// Removing the folder needs nothing version-specific, so a machine whose
/// own bundle is gone or from an unsupported series is deleted with the
/// default one instead of having to be rebound first.
+ ///
+ /// When the machine was the last one cloned from a template, `vm delete`
+ /// says so and leaves the template; `templateNotice` passes that on.
func delete(_ machine: Path) async {
- await perform(
- String(localized: "Deleting…"),
- on: machine,
- ["vm", "delete", machine.name, "--force"] + machine.libraryArguments,
- anyBundle: true,
+ do {
+ let result = try await performChecked(
+ String(localized: "Deleting…"),
+ on: machine,
+ ["vm", "delete", machine.name, "--force"] + machine.libraryArguments,
+ anyBundle: true,
+ )
+ if let notice = VPhoneLaunchpadTemplateNotice.parse(result.lines, libraryRoot: machine.libraryRoot) {
+ templateNotice = notice
+ }
+ } catch {
+ if !(error is CancellationError) {
+ actionError = VPhoneLaunchpadError(actionFailure: error)
+ }
+ }
+ }
+
+ /// The template the last deleted machine was cloned from, now used by
+ /// no machine. The machine list shows it once.
+ var templateNotice: VPhoneLaunchpadTemplateNotice?
+
+ // MARK: - Disk use
+
+ /// What each listed machine takes on disk, measured off the main actor
+ /// at most every `diskUsageInterval` seconds.
+ private(set) var diskUsage: [Path: VPhoneLaunchpadDiskUsage] = [:]
+ /// The template each machine was cloned from (its `TemplateSource.plist`).
+ private(set) var templateSources: [Path: String] = [:]
+ private var diskUsageMeasured: Date?
+ private var isMeasuringDiskUsage = false
+ private static let diskUsageInterval: TimeInterval = 30
+
+ /// Measures again when the last measurement is old, or a machine was
+ /// added. Private sizes take APFS a walk of each file's extents, so this
+ /// never runs on every five-second refresh.
+ private func refreshDiskUsage(force: Bool = false) {
+ let paths = machines.map(\.path)
+ let isNew = paths.contains { diskUsage[$0] == nil }
+ let isOld = diskUsageMeasured.map { Date().timeIntervalSince($0) > Self.diskUsageInterval } ?? true
+ guard !isMeasuringDiskUsage, force || isNew || isOld else {
+ return
+ }
+ isMeasuringDiskUsage = true
+ Task {
+ let measured = await Self.measure(paths)
+ diskUsage = measured.usage
+ templateSources = measured.sources
+ diskUsageMeasured = Date()
+ isMeasuringDiskUsage = false
+ }
+ }
+
+ @concurrent
+ private nonisolated static func measure(_ paths: [Path]) async -> (usage: [Path: VPhoneLaunchpadDiskUsage], sources: [Path: String]) {
+ var usage: [Path: VPhoneLaunchpadDiskUsage] = [:]
+ var sources: [Path: String] = [:]
+ for path in paths {
+ usage[path] = VPhoneLaunchpadDiskUsage.measure(path.url)
+ sources[path] = templateSource(in: path.url)
+ }
+ return (usage, sources)
+ }
+
+ /// The `Identifier` of `TemplateSource.plist`, when it names a template.
+ nonisolated static func templateSource(in folder: URL) -> String? {
+ let file = folder.appendingPathComponent("TemplateSource.plist")
+ guard let values = try? file.resourceValues(forKeys: [.isRegularFileKey, .isSymbolicLinkKey]),
+ values.isRegularFile == true, values.isSymbolicLink != true,
+ let record = NSDictionary(contentsOf: file),
+ let identifier = record["Identifier"] as? String,
+ identifier.wholeMatch(of: /[0-9a-f]{12}/) != nil
+ else {
+ return nil
+ }
+ return identifier
+ }
+
+ // MARK: - Templates
+
+ /// Every library's templates, from `vm template list --json` with the
+ /// default bundle. Nil until read.
+ private(set) var templates: [VPhoneLaunchpadTemplate]?
+ /// Template builds a create left behind (or is running), by library.
+ private(set) var templateBuilds: [(libraryRoot: String, build: VPhoneLaunchpadTemplateList.Building)] = []
+ private(set) var templatesError: String?
+ /// Each template's private size, read off the main actor.
+ private(set) var templateUsage: [String: VPhoneLaunchpadDiskUsage] = [:]
+
+ func refreshTemplates() async {
+ guard let commandLine = bundles.commandLine() else {
+ templatesError = String(localized: "No Core Bundle version is installed. Install one in Core Bundle.")
+ return
+ }
+ var found: [VPhoneLaunchpadTemplate] = []
+ var builds: [(libraryRoot: String, build: VPhoneLaunchpadTemplateList.Building)] = []
+ var errors: [String] = []
+ for root in roots where root == libraryRoot || VPhoneLaunchpadMachineLocations.isAvailable(root) {
+ do {
+ let result = try await commandLine.run(VPhoneLaunchpadTemplateCommands.list + ["--library-root", root], recordInHistory: false)
+ guard result.succeeded, let data = result.jsonData else {
+ errors.append(result.tail)
+ continue
+ }
+ let list = try VPhoneLaunchpadTemplateList.decode(data, libraryRoot: root)
+ found += list.templates
+ builds += list.building.map { (root, $0) }
+ } catch {
+ errors.append(error.localizedDescription)
+ }
+ }
+ templates = found.sorted { $0.created > $1.created }
+ templateBuilds = builds
+ templatesError = errors.first
+ let urls = found.map { ($0.id + "@" + $0.libraryRoot, $0.url) }
+ templateUsage = await Task.detached {
+ Dictionary(uniqueKeysWithValues: urls.map { ($0.0, VPhoneLaunchpadDiskUsage.measure($0.1)) })
+ }.value
+ }
+
+ func usage(of template: VPhoneLaunchpadTemplate) -> VPhoneLaunchpadDiskUsage? {
+ templateUsage[template.id + "@" + template.libraryRoot]
+ }
+
+ /// Deletes a template, or a left-over build by its `.building-…` name.
+ /// Machines cloned from it keep working.
+ func deleteTemplate(_ identifier: String, in root: String) async throws {
+ try await performChecked(
+ String(localized: "Deleting template…"),
+ on: nil,
+ VPhoneLaunchpadTemplateCommands.delete(identifier) + ["--library-root", root],
+ )
+ await refreshTemplates()
+ }
+
+ // MARK: - Guest
+
+ /// One vphoned call over the running machine's `vphone.sock`, as
+ /// `vphone-launchpad-cli guest rpc` makes it. The reply's `result`.
+ func guestCall(_ machine: Path, _ method: String, _ params: [String: Any] = [:], timeout: Int = 120) async throws -> [String: Any] {
+ let request: [String: Any] = ["t": "rpc", "method": method, "params": params, "screen": false]
+ let reply = try await VPhoneLaunchpadGuestSocket.send(
+ request,
+ socketPath: machine.url.appendingPathComponent("vphone.sock").path,
+ timeout: timeout,
)
+ return (reply as? [String: Any])?["result"] as? [String: Any] ?? [:]
}
// MARK: - Export
@@ -796,13 +949,14 @@ final class VPhoneLaunchpadMachineLibrary {
/// `perform` for a sheet that reports its own errors: throws what failed,
/// or `CancellationError` when the command was cancelled.
+ @discardableResult
private func performChecked(
_ activity: String,
on machine: Path?,
_ arguments: [String],
anyBundle: Bool = false,
onProgress: (@Sendable (Double) -> Void)? = nil,
- ) async throws {
+ ) async throws -> VPhoneLaunchpadCommandResult {
// A machine's commands run with its own bundle; `anyBundle` lets one
// that needs no particular version fall back to the default.
let commandLine: VPhoneLaunchpadCommandLine? = if let machine {
@@ -829,8 +983,9 @@ final class VPhoneLaunchpadMachineLibrary {
}
}
do {
- try await commandLine.runChecked(arguments, onProgress: onProgress)
+ let result = try await commandLine.runChecked(arguments, onProgress: onProgress)
await refresh()
+ return result
} catch {
await refresh()
if error is CancellationError || Task.isCancelled {
@@ -938,6 +1093,7 @@ final class VPhoneLaunchpadMachineLibrary {
startedAt = [VPhoneLaunchpadPreview.path("research-01"): Date().addingTimeInterval(-6130)]
creations = [creation.machine: creation]
selection = [VPhoneLaunchpadPreview.path("research-01")]
+ applyPreviewDiskUsage()
// One machine on an older bundle whose guest environment was not
// updated with it, so the inspector shows mixed versions.
let current = VPhoneLaunchpadPreview.releases[1].version
@@ -950,6 +1106,33 @@ final class VPhoneLaunchpadMachineLibrary {
})
}
+ /// Disk use and template origins for the mock machines.
+ func applyPreviewDiskUsage() {
+ let research = VPhoneLaunchpadPreview.path("research-01")
+ diskUsage = [
+ research: VPhoneLaunchpadDiskUsage(allocated: 17_812_000_000, exclusive: 612_000_000),
+ VPhoneLaunchpadPreview.labMachine: VPhoneLaunchpadDiskUsage(allocated: 21_406_000_000, exclusive: 3_240_000_000),
+ ]
+ templateSources = [research: "52b1fcc75e0c", VPhoneLaunchpadPreview.labMachine: "2246f982776c"]
+ diskUsageMeasured = Date()
+ }
+
+ func applyPreviewTemplates() {
+ templates = VPhoneLaunchpadPreview.templates
+ templateBuilds = (VPhoneLaunchpadPreview.templateList?.building ?? []).map { (VPhoneLaunchpadMachineLocations.defaultRoot, $0) }
+ templatesError = nil
+ templateUsage = [
+ "52b1fcc75e0c@\(libraryRoot)": VPhoneLaunchpadDiskUsage(allocated: 17_580_000_000, exclusive: 106_000_000),
+ "9d04a7c3e1b2@\(libraryRoot)": VPhoneLaunchpadDiskUsage(allocated: 19_310_000_000, exclusive: 19_310_000_000),
+ "2246f982776c@\(libraryRoot)": VPhoneLaunchpadDiskUsage(allocated: 18_920_000_000, exclusive: 15_700_000_000),
+ ]
+ }
+
+ /// What deleting the last machine of a template leaves to say.
+ func applyPreviewNotice() {
+ templateNotice = VPhoneLaunchpadTemplateNotice(id: "9d04a7c3e1b2", size: "19.31 GB", libraryRoot: libraryRoot)
+ }
+
/// The mock list without one machine, as a refresh leaves it after
/// the machine is deleted.
func applyPreview(removing machine: Path) {
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift
index 6528cb00..e3d91cc1 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift
@@ -14,6 +14,7 @@ struct VPhoneLaunchpadMachinesView: View {
case export([MachinePath])
case snapshots(MachinePath)
case console(MachinePath)
+ case guestSystem(MachinePath)
var id: String {
switch self {
@@ -26,6 +27,7 @@ struct VPhoneLaunchpadMachinesView: View {
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)"
+ case let .guestSystem(machine): "guest-system-\(machine.url.path)"
}
}
}
@@ -81,6 +83,7 @@ struct VPhoneLaunchpadMachinesView: View {
onShowProgress: { path in sheet = .creation(path) },
onOpenConsole: { path in sheet = .console(path) },
onChangeBundle: { machine in sheet = .changeBundle([machine]) },
+ onOpenGuestSystem: { path in sheet = .guestSystem(path) },
)
} else if library.selection.count > 1 {
ContentUnavailableView("\(library.selection.count) Machines Selected", systemImage: "iphone")
@@ -140,6 +143,22 @@ struct VPhoneLaunchpadMachinesView: View {
} message: { error in
Text(error.detail ?? "")
}
+ // `vm delete` of the last machine cloned from a template keeps
+ // the template and says so; so does this.
+ .alert(
+ String(localized: "Template No Longer Used"),
+ isPresented: Binding(get: { library.templateNotice != nil && library.actionError == nil }, set: {
+ if !$0 {
+ library.templateNotice = nil
+ }
+ }),
+ presenting: library.templateNotice,
+ ) { _ in
+ Button("Show Templates") { model.present(.templates) }
+ Button("OK", role: .cancel) {}
+ } message: { notice in
+ Text("No machine uses template \(notice.id) any more. It stays, taking about \(notice.size), so the next machine with its options is created in seconds. Delete it in Templates once it is no longer needed.")
+ }
}
// MARK: - Toolbar
@@ -155,6 +174,8 @@ struct VPhoneLaunchpadMachinesView: View {
Button("New Machine…") { sheet = .newMachine }
Button("Import…") { chooseImport() }
.disabled(library.globalActivity != nil)
+ Divider()
+ Button("Templates…") { model.present(.templates) }
} label: {
Label("New Machine", systemImage: "plus")
}
@@ -302,6 +323,9 @@ struct VPhoneLaunchpadMachinesView: View {
Divider()
Button("Settings…") { sheet = .settings([machine]) }
.disabled(!isStopped)
+ // It works on the running guest, and says so when it is not.
+ Button("Guest System…") { sheet = .guestSystem(machine.path) }
+ .disabled(library.creation(for: machine.path)?.isRunning == true)
changeBundleButton([machine])
Button("Rename…") { sheet = .rename(machine.path) }
.disabled(!isStopped)
@@ -312,7 +336,7 @@ struct VPhoneLaunchpadMachinesView: View {
// 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)
+ .disabled(library.creation(for: machine.path)?.isRunning == true)
Button("Install Custom Firmware") {
Task { await library.installCustomFirmware(machine.path) }
}
@@ -348,7 +372,7 @@ struct VPhoneLaunchpadMachinesView: View {
private func changeBundleButton(_ machines: [VPhoneLaunchpadMachine]) -> some View {
Button("Change Core Bundle…") { sheet = .changeBundle(machines) }
.disabled(model.bundles.selectableVersions.isEmpty
- || machines.contains { library.creations[$0.path]?.isRunning == true })
+ || machines.contains { library.creation(for: $0.path)?.isRunning == true })
}
// MARK: - Table
@@ -398,6 +422,16 @@ struct VPhoneLaunchpadMachinesView: View {
Text(Self.disk(machine.diskSizeBytes)).monospacedDigit()
}
.width(64)
+ // What deleting the machine frees: a clone of a template
+ // shares the rest.
+ TableColumn("Exclusive") { machine in
+ let usage = library.diskUsage[machine.path]
+ Text(verbatim: usage?.exclusive.map { VPhoneLaunchpadDiskUsage.format($0) } ?? "—")
+ .monospacedDigit()
+ .foregroundStyle(usage?.exclusive == nil ? .secondary : .primary)
+ .help(usage.map { String(localized: "\(VPhoneLaunchpadDiskUsage.format($0.allocated)) allocated; the rest is shared with its template or clones.") } ?? "")
+ }
+ .width(min: 64, ideal: 76)
}
.contextMenu(forSelectionType: MachinePath.self) { paths in
machineActions(library.machines.filter { paths.contains($0.path) })
@@ -450,7 +484,7 @@ struct VPhoneLaunchpadMachinesView: View {
self.sheet = .creation(path)
}
case let .creation(path):
- if let creation = library.creations[path] {
+ if let creation = library.creation(for: path) {
VPhoneLaunchpadCreationView(creation: creation)
}
case let .settings(machines):
@@ -471,6 +505,8 @@ struct VPhoneLaunchpadMachinesView: View {
VPhoneLaunchpadSnapshotsView(machine: path)
case let .console(path):
VPhoneLaunchpadConsoleView(title: "\(path.name) Console", url: VPhoneLaunchpadMachineLibrary.consoleLog(path))
+ case let .guestSystem(path):
+ VPhoneLaunchpadGuestSystemView(machine: path)
}
}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineAdvancedView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineAdvancedView.swift
index c7e9b8bb..d5350783 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineAdvancedView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineAdvancedView.swift
@@ -3,6 +3,8 @@ import SwiftUI
/// New Machine's Advanced page: network, patches and restore options, as
/// sections of New Machine's form. It edits New Machine's own state.
struct VPhoneLaunchpadNewMachineAdvancedView: View {
+ /// A template never keeps the restore files.
+ var usesTemplate: Bool
@Binding var network: String
@Binding var patches: VPhoneLaunchpadPatchSelection
@Binding var keepArtifacts: Bool
@@ -33,8 +35,15 @@ struct VPhoneLaunchpadNewMachineAdvancedView: View {
patchSection
- Section("Options") {
+ Section {
Toggle("Keep prepared restore files", isOn: $keepArtifacts)
+ .disabled(usesTemplate)
+ } header: {
+ Text("Options")
+ } footer: {
+ if usesTemplate {
+ Text("A template never keeps them.").foregroundStyle(.secondary)
+ }
}
}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift
index cb3ad711..dece6216 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift
@@ -2,8 +2,8 @@ import AppKit
import SwiftUI
/// Name, location, Core Bundle, guest device and firmware pairing from
-/// `fw catalog`, hardware and options, on three pages. Every page has
-/// defaults, so Create works from any of them.
+/// `fw catalog`, hardware, the template and its slimming, and options, on four
+/// pages. Every page has defaults, so Create works from any of them.
/// Create hands off to the pipeline sheet.
struct VPhoneLaunchpadNewMachineView: View {
let onCreate: (VPhoneLaunchpadMachinePath) -> Void
@@ -33,10 +33,13 @@ struct VPhoneLaunchpadNewMachineView: View {
@State private var patchCatalog: VPhoneLaunchpadPatchCatalog?
@State private var patchCatalogError: String?
@State private var keepArtifacts = false
+ /// Clone the machine from a template, built first when there is none.
+ @State private var usesTemplate = true
+ @State private var slimming = VPhoneLaunchpadSlimming()
@State private var page = Page.general
enum Page: Hashable {
- case general, hardware, advanced
+ case general, hardware, template, advanced
}
private var selectedGuest: VPhoneLaunchpadFirmwareCatalog.Device? {
@@ -107,8 +110,23 @@ struct VPhoneLaunchpadNewMachineView: View {
VPhoneLaunchpadMachineLocations.problem(with: location)
}
+ /// Why the template switches stop Create, or nil.
+ private var templateProblem: String? {
+ guard usesTemplate else {
+ return nil
+ }
+ if let problem = slimming.problem {
+ return problem
+ }
+ // The template is built in a machine named like `template-1a2b3c4d`.
+ if !VPhoneLaunchpadMachineLocations.socketPathFits(root: location, name: "template-00000000") {
+ return String(localized: "The path is too long. Use a location with a shorter path.")
+ }
+ return nil
+ }
+
private var canCreate: Bool {
- nameProblem == nil && locationProblem == nil && sources != nil && bundleVersion != nil
+ nameProblem == nil && locationProblem == nil && templateProblem == nil && sources != nil && bundleVersion != nil
}
var body: some View {
@@ -117,6 +135,7 @@ struct VPhoneLaunchpadNewMachineView: View {
VPhoneLaunchpadSheetPages(selection: $page) {
Text("General").tag(Page.general)
Text("Hardware").tag(Page.hardware)
+ Text("Template").tag(Page.template)
Text("Advanced").tag(Page.advanced)
}
Form {
@@ -126,7 +145,7 @@ struct VPhoneLaunchpadNewMachineView: View {
TextField("Name", text: $name)
locationPicker
} footer: {
- if let problem = nameProblem ?? locationProblem {
+ if let problem = nameProblem ?? locationProblem ?? templateProblem {
Text(problem).foregroundStyle(.red)
}
}
@@ -134,6 +153,8 @@ struct VPhoneLaunchpadNewMachineView: View {
bundleSection
firmware
+
+ slimSection
case .hardware:
Section {
Stepper("CPU: \(cpu) cores", value: $cpu, in: 1 ... ProcessInfo.processInfo.activeProcessorCount)
@@ -142,8 +163,11 @@ struct VPhoneLaunchpadNewMachineView: View {
} footer: {
Text(spaceNote).foregroundStyle(.secondary)
}
+ case .template:
+ VPhoneLaunchpadSlimmingSections(usesTemplate: $usesTemplate, slimming: $slimming)
case .advanced:
VPhoneLaunchpadNewMachineAdvancedView(
+ usesTemplate: usesTemplate,
network: $network,
patches: $patches,
keepArtifacts: $keepArtifacts,
@@ -180,6 +204,27 @@ struct VPhoneLaunchpadNewMachineView: View {
}
}
+ // MARK: - Slimming
+
+ /// The master switch. The parts are on the Template page.
+ private var slimSection: some View {
+ Section {
+ Toggle("Slim System", isOn: $slimming.slim)
+ .disabled(!usesTemplate)
+ } footer: {
+ Group {
+ if !usesTemplate {
+ Text("Without a template the machine is not slimmed. Turn templates on in Template.")
+ } else if slimming.slim {
+ Text("Trims system files, unneeded services and system apps once, in the template the machine is cloned from. Choose what goes in Template.")
+ } else {
+ Text("The template keeps every file, service and app. Setup Assistant is still skipped.")
+ }
+ }
+ .foregroundStyle(.secondary)
+ }
+ }
+
// MARK: - Core Bundle
private var bundleSection: some View {
@@ -483,6 +528,8 @@ struct VPhoneLaunchpadNewMachineView: View {
network: network,
patches: patches,
keepArtifacts: keepArtifacts,
+ usesTemplate: usesTemplate,
+ slimming: slimming,
)
let pipeline = model.machines.create(options)
model.machines.selection = [pipeline.machine]
@@ -493,26 +540,76 @@ struct VPhoneLaunchpadNewMachineView: View {
// MARK: - Pipeline
/// The pipeline, which keeps running when this sheet closes. A failure shows
-/// on its step; the log, which records why, opens in its own sheet.
+/// on its step; the log, which records why, opens in its own sheet. A
+/// template-backed creation shows the template's steps apart from the
+/// machine's own.
struct VPhoneLaunchpadCreationView: View {
+ typealias Step = VPhoneLaunchpadCreationStep
+
let creation: VPhoneLaunchpadCreationPipeline
+ @Environment(VPhoneLaunchpadModel.self) private var model
@Environment(\.dismiss) private var dismiss
@State private var showsLog = false
+ /// The IPSWs a template this creation built came from, once it is done.
+ @State private var ipswFiles: [VPhoneLaunchpadIPSWFile] = []
+ @State private var ipswDirectories: [URL] = []
+ @State private var offersIPSWs = false
+
+ private var templateSteps: [Step] {
+ creation.steps.filter { $0 == .findTemplate || creation.plan.buildsTemplate($0) }
+ }
+
+ private var machineSteps: [Step] {
+ creation.steps.filter { !templateSteps.contains($0) }
+ }
var body: some View {
VPhoneLaunchpadSheet(Text("Creating \(creation.options.name)")) {
Form {
+ if creation.plan.usesTemplate {
+ Section {
+ ForEach(templateSteps) { step in
+ stepRow(step)
+ }
+ } header: {
+ Text("Template")
+ } footer: {
+ Text(templateNote).foregroundStyle(.secondary)
+ }
+ }
Section {
- ForEach(VPhoneLaunchpadCreationPipeline.Step.allCases) { step in
+ ForEach(machineSteps) { step in
stepRow(step)
}
+ } header: {
+ if creation.plan.usesTemplate {
+ Text("Machine")
+ }
} footer: {
if creation.isRunning {
Text("Creation continues if you close this window.").foregroundStyle(.secondary)
+ } else if let failure = creation.failure, let detail = failure.detail {
+ Text(verbatim: detail)
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ .textSelection(.enabled)
+ .lineLimit(6)
}
}
+ if offersIPSWs {
+ VPhoneLaunchpadTemplateIPSWOffer(files: $ipswFiles, cacheDirectories: ipswDirectories)
+ }
}
.formStyle(.grouped)
+ .task(id: creation.isFinished && creation.builtTemplate) {
+ guard creation.isFinished, creation.builtTemplate, !offersIPSWs else {
+ return
+ }
+ let found = await VPhoneLaunchpadTemplateIPSWOffer.scan(creation, library: model.machines)
+ ipswFiles = found.files
+ ipswDirectories = found.directories
+ offersIPSWs = !found.files.isEmpty
+ }
} accessory: {
Button("Open Log") { showsLog = true }
} actions: {
@@ -526,13 +623,27 @@ struct VPhoneLaunchpadCreationView: View {
.keyboardShortcut(.cancelAction)
}
.frame(width: 720)
- .fixedSize(horizontal: false, vertical: true)
+ // A template build lists fourteen steps: the form scrolls in a
+ // sheet that fits a laptop screen instead of growing past it.
+ .frame(height: creation.plan.usesTemplate ? 720 : nil)
+ .fixedSize(horizontal: false, vertical: !creation.plan.usesTemplate)
.sheet(isPresented: $showsLog) {
VPhoneLaunchpadConsoleView(title: "\(creation.options.name) Creation Log", url: creation.logFile)
}
}
- private func stepRow(_ step: VPhoneLaunchpadCreationPipeline.Step) -> some View {
+ private var templateNote: String {
+ if let id = creation.templateID, creation.plan.foundTemplate == true {
+ return String(localized: "Cloned from template \(id), which machines with these options share.")
+ }
+ if let id = creation.templateID, creation.builtTemplate {
+ return String(localized: "Saved as template \(id). The next machine with these options is cloned from it in seconds.")
+ }
+ let build = creation.plan.buildName ?? ""
+ return String(localized: "A missing template is built in \(build), set up once without a window, and saved under Templates.")
+ }
+
+ private func stepRow(_ step: Step) -> some View {
LabeledContent {
HStack(spacing: 8) {
if step == .prepare, let fraction = creation.downloadFraction {
@@ -552,13 +663,21 @@ struct VPhoneLaunchpadCreationView: View {
}
} label: {
Label {
- HStack(spacing: 4) {
- Text(step.title)
- if step.needsRoot {
- Image(systemName: "lock.fill")
+ VStack(alignment: .leading, spacing: 2) {
+ HStack(spacing: 4) {
+ Text(step.title)
+ if step.needsRoot {
+ Image(systemName: "lock.fill")
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ .help("Runs as root through the privileged helper")
+ }
+ }
+ if step == .setUpTemplate, let stage = creation.setupStage {
+ // The CLI's own words for the stage: `b. wait for first-boot work`.
+ Text(verbatim: stage)
.font(.caption)
.foregroundStyle(.secondary)
- .help("Runs as root through the privileged helper")
}
}
} icon: {
@@ -571,3 +690,104 @@ struct VPhoneLaunchpadCreationView: View {
Duration.seconds(interval).formatted(.time(pattern: interval >= 3600 ? .hourMinuteSecond : .minuteSecond))
}
}
+
+// MARK: - IPSWs a template came from
+
+/// Offered once a creation has built a template: its clones need neither
+/// IPSW, so the two downloads can go. Nothing is deleted without the
+/// confirmation, and only files the IPSW cache holds.
+struct VPhoneLaunchpadTemplateIPSWOffer: View {
+ @Binding var files: [VPhoneLaunchpadIPSWFile]
+ let cacheDirectories: [URL]
+ @State private var confirming = false
+ @State private var deleted = false
+ @State private var error: VPhoneLaunchpadError?
+
+ private var total: Int64 {
+ files.reduce(0) { $0 + $1.size }
+ }
+
+ var body: some View {
+ Section {
+ if deleted {
+ Label("The IPSWs were deleted.", systemImage: "checkmark.circle")
+ .foregroundStyle(.secondary)
+ } else {
+ ForEach(files) { file in
+ LabeledContent {
+ Text(verbatim: VPhoneLaunchpadIPSWCacheView.size(file.size)).monospacedDigit()
+ } label: {
+ Text(verbatim: file.name)
+ .lineLimit(1)
+ .truncationMode(.middle)
+ }
+ }
+ HStack {
+ Spacer()
+ Button("Delete IPSWs…") { confirming = true }
+ .disabled(files.isEmpty)
+ }
+ }
+ } header: {
+ Text("Downloaded IPSWs")
+ } footer: {
+ if !deleted {
+ Text("Machines from this template need neither IPSW. A machine with other options downloads them again.")
+ .foregroundStyle(.secondary)
+ }
+ }
+ .confirmationDialog(
+ String(localized: "Delete the IPSWs this template came from?"),
+ isPresented: $confirming,
+ ) {
+ Button(String(localized: "Delete \(VPhoneLaunchpadIPSWCacheView.size(total))"), role: .destructive) {
+ Task { await delete() }
+ }
+ } message: {
+ Text("\(files.map(\.name).joined(separator: ", ")) are deleted from the IPSW cache.")
+ }
+ .errorAlert($error)
+ }
+
+ /// The cached IPSWs `creation` was given as sources and no unfinished
+ /// creation still reads.
+ static func scan(
+ _ creation: VPhoneLaunchpadCreationPipeline,
+ library: VPhoneLaunchpadMachineLibrary,
+ ) async -> (files: [VPhoneLaunchpadIPSWFile], directories: [URL]) {
+ let sources = [creation.options.iphoneSource, creation.options.cloudOSSource]
+ #if DEBUG
+ if VPhoneLaunchpadPreview.isActive {
+ let scan = VPhoneLaunchpadPreview.ipswScan
+ return (scan.ipsws.filter { file in sources.contains { VPhoneLaunchpadIPSWUse.source($0, is: file) } }, scan.cacheDirectories)
+ }
+ #endif
+ guard let scan = try? await VPhoneLaunchpadIPSWCache.scan(libraryRoots: library.roots, machineFolders: []) else {
+ return ([], [])
+ }
+ let busy = library.creations.values.filter { !$0.isFinished && $0 !== creation }
+ .flatMap { [$0.options.iphoneSource, $0.options.cloudOSSource] }
+ let files = scan.ipsws.filter { file in
+ !file.isDownloading
+ && sources.contains { VPhoneLaunchpadIPSWUse.source($0, is: file) }
+ && !busy.contains { VPhoneLaunchpadIPSWUse.source($0, is: file) }
+ }
+ return (files, scan.cacheDirectories)
+ }
+
+ private func delete() async {
+ var remaining = files
+ for file in files {
+ do {
+ try await VPhoneLaunchpadIPSWCache.removeIPSW(file.url, cacheDirectories: cacheDirectories)
+ remaining.removeAll { $0.id == file.id }
+ } catch {
+ self.error = VPhoneLaunchpadError(String(localized: "Unable to Delete \(file.name)"), detail: error.localizedDescription)
+ files = remaining
+ return
+ }
+ }
+ files = []
+ deleted = true
+ }
+}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadSlimmingView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadSlimmingView.swift
new file mode 100644
index 00000000..0743c05b
--- /dev/null
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadSlimmingView.swift
@@ -0,0 +1,117 @@
+import SwiftUI
+
+/// New Machine's Template page: whether the machine is cloned from a
+/// template, and how that template is slimmed. The switches are part of the
+/// template's key: other switches make another template, and both stay.
+struct VPhoneLaunchpadSlimmingSections: View {
+ @Binding var usesTemplate: Bool
+ @Binding var slimming: VPhoneLaunchpadSlimming
+
+ var body: some View {
+ Section {
+ Toggle("Create from a template", isOn: $usesTemplate)
+ } header: {
+ Text("Template")
+ } footer: {
+ Text(usesTemplate
+ ? "Machines from one template share its SEP root secret and Data volume keys. Turn this off for a machine that needs keys of its own."
+ : "The machine is restored on its own, with keys of its own. It is not slimmed, and starts at Setup Assistant.")
+ .foregroundStyle(.secondary)
+ }
+
+ if usesTemplate {
+ filesSection
+ servicesSection
+ appsSection
+ }
+ }
+
+ // MARK: - Files
+
+ private var filesSection: some View {
+ Section {
+ Picker("Trim", selection: $slimming.trim) {
+ ForEach(VPhoneLaunchpadSlimming.TrimTier.allCases) { tier in
+ Text(tier.title).tag(tier)
+ }
+ }
+ if slimming.trim == .standard {
+ TextField("Kept Languages", text: $slimming.keptLanguages, prompt: Text(verbatim: VPhoneLaunchpadSlimming.defaultLanguages))
+ }
+ } header: {
+ Text("System Files")
+ } footer: {
+ VStack(alignment: .leading, spacing: 4) {
+ Text(trimNote).foregroundStyle(.secondary)
+ if let problem = slimming.problem {
+ Text(problem).foregroundStyle(.red)
+ }
+ }
+ }
+ .disabled(!slimming.slim)
+ }
+
+ private var trimNote: String {
+ switch slimming.trim {
+ case .none:
+ String(localized: "Nothing is deleted from the System volume.")
+ case .conservative:
+ String(localized: "Deletes the software update ramdisk and baseband firmware, about 0.4 GB. It cannot be undone: the trim is part of the template.")
+ case .standard:
+ String(localized: "Also deletes the AirPods pairing assets, watch faces and the language data of languages not kept, about 1.2 GB. It cannot be undone: the trim is part of the template.")
+ }
+ }
+
+ // MARK: - Services
+
+ private var servicesSection: some View {
+ Section {
+ Toggle("Turn off unneeded services", isOn: $slimming.trimsServices)
+ Toggle("Turn off Apple Account", isOn: $slimming.accountsOff)
+ .disabled(!slimming.trimsServices)
+ } header: {
+ Text("Services")
+ } footer: {
+ Text("About 140 launch daemons a research machine rarely needs. Each machine can switch them back on in Guest System. Without Apple Account the guest cannot sign in.")
+ .foregroundStyle(.secondary)
+ }
+ .disabled(!slimming.slim)
+ }
+
+ // MARK: - Apps
+
+ private var appsSection: some View {
+ Section {
+ Toggle("Remove system apps", isOn: $slimming.removesApps)
+ if slimming.removesApps {
+ LazyVGrid(columns: [GridItem(.flexible(), alignment: .leading), GridItem(.flexible(), alignment: .leading)], spacing: 6) {
+ ForEach(VPhoneLaunchpadSlimming.removableApps) { app in
+ Toggle(isOn: removes(app.id)) {
+ Text(verbatim: app.name)
+ }
+ .toggleStyle(.checkbox)
+ }
+ }
+ }
+ } header: {
+ Text("System Apps")
+ } footer: {
+ Text("Checked apps are removed. Camera and Phone are never removed. Each machine can restore removed apps in Guest System.")
+ .foregroundStyle(.secondary)
+ }
+ .disabled(!slimming.slim)
+ }
+
+ private func removes(_ bundleID: String) -> Binding<Bool> {
+ Binding(
+ get: { !slimming.keptApps.contains(bundleID) },
+ set: { removed in
+ if removed {
+ slimming.keptApps.remove(bundleID)
+ } else {
+ slimming.keptApps.insert(bundleID)
+ }
+ },
+ )
+ }
+}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadTemplates.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadTemplates.swift
new file mode 100644
index 00000000..66ccdf7f
--- /dev/null
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadTemplates.swift
@@ -0,0 +1,438 @@
+import Foundation
+
+// MARK: - Slimming switches
+
+/// New Machine's system slimming switches, as `vphone-cli vm create`,
+/// `vm template find`, `vm template trim` and `vm template setup` take them
+/// (`VPhoneTemplateSlimmingRequest` in the bundle). Only switches that differ
+/// from the CLI's defaults are passed, so the CLI's own defaults stay the one
+/// source of them.
+///
+/// The template key holds the trim tier and the removed apps; the service
+/// profile can be switched on the machine later (Guest System).
+nonisolated struct VPhoneLaunchpadSlimming: Hashable, Sendable {
+ enum TrimTier: String, CaseIterable, Identifiable, Sendable {
+ case none
+ case conservative
+ case standard
+
+ var id: Self {
+ self
+ }
+
+ var title: String {
+ switch self {
+ case .none: String(localized: "None")
+ case .conservative: String(localized: "Conservative")
+ case .standard: String(localized: "Standard")
+ }
+ }
+ }
+
+ /// One app the setup boot removes unless it is kept.
+ struct App: Identifiable, Hashable, Sendable {
+ let id: String
+ let name: String
+ }
+
+ /// Master switch. Off is `--slim off`: nothing trimmed, every service
+ /// and app kept. Setup is skipped either way.
+ var slim = true
+ var trim = TrimTier.standard
+ /// The languages the standard tier keeps the linguistic data of, comma
+ /// separated; empty keeps ``defaultLanguages``.
+ var keptLanguages = ""
+ /// The trimmed service profile; off is `--service-profile none`.
+ var trimsServices = true
+ var removesApps = true
+ /// Apps of ``removableApps`` to keep.
+ var keptApps: Set<String> = []
+ /// Also turns off the Apple Account daemons. Needs the trimmed profile.
+ var accountsOff = false
+
+ static let defaultLanguages = "en,zh-Hans,zh"
+
+ /// List C of the template plan, the CLI's `defaultRemovedApps`. Camera
+ /// and Phone are never removed.
+ static var removableApps: [App] {
+ [
+ App(id: "com.apple.AppStore", name: String(localized: "App Store")),
+ App(id: "com.apple.Home", name: String(localized: "Home")),
+ App(id: "com.apple.tv", name: String(localized: "TV")),
+ App(id: "com.apple.news", name: String(localized: "News")),
+ App(id: "com.apple.facetime", name: String(localized: "FaceTime")),
+ App(id: "com.apple.MobileStore", name: String(localized: "iTunes Store")),
+ App(id: "com.apple.MobileSMS", name: String(localized: "Messages")),
+ App(id: "com.apple.games", name: String(localized: "Games")),
+ App(id: "com.apple.findmy", name: String(localized: "Find My")),
+ App(id: "com.apple.Passbook", name: String(localized: "Wallet")),
+ ]
+ }
+
+ static func appName(_ bundleID: String) -> String {
+ removableApps.first { $0.id == bundleID }?.name ?? bundleID
+ }
+
+ // MARK: Effective values
+
+ /// The kept languages as the CLI takes them, or nil for the default (or
+ /// when no tier removes language data).
+ var languagesArgument: String? {
+ guard slim, trim == .standard else {
+ return nil
+ }
+ let list = Self.languageList(keptLanguages)
+ guard !list.isEmpty, list.joined(separator: ",") != Self.defaultLanguages else {
+ return nil
+ }
+ return list.joined(separator: ",")
+ }
+
+ static func languageList(_ text: String) -> [String] {
+ text.split(separator: ",").map { $0.trimmingCharacters(in: .whitespaces) }.filter { !$0.isEmpty }
+ }
+
+ /// Why Create cannot go ahead with these switches, or nil. The CLI
+ /// refuses the rest; the controls do not offer them.
+ var problem: String? {
+ guard let languages = languagesArgument else {
+ return nil
+ }
+ let bad = Self.languageList(languages).filter { $0.wholeMatch(of: /[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*/) == nil }
+ guard bad.isEmpty else {
+ return String(localized: "\(bad.joined(separator: ", ")) is not a language code such as ja or zh-Hant.")
+ }
+ return nil
+ }
+
+ /// The apps the template removes.
+ var removedApps: [String] {
+ guard slim, removesApps else {
+ return []
+ }
+ return Self.removableApps.map(\.id).filter { !keptApps.contains($0) }
+ }
+
+ // MARK: Arguments
+
+ /// For `vm template find` and `vm create`.
+ var arguments: [String] {
+ guard slim else {
+ return ["--slim", "off"]
+ }
+ var arguments: [String] = []
+ if trim != .standard {
+ arguments += ["--trim", trim.rawValue]
+ }
+ if let languagesArgument {
+ arguments += ["--keep-languages", languagesArgument]
+ }
+ arguments += profileArguments
+ if !removesApps {
+ arguments += ["--remove-apps", "off"]
+ } else {
+ let kept = Self.removableApps.map(\.id).filter(keptApps.contains)
+ if !kept.isEmpty {
+ arguments += ["--keep-apps", kept.joined(separator: ",")]
+ }
+ }
+ return arguments
+ }
+
+ private var profileArguments: [String] {
+ if !trimsServices {
+ return ["--service-profile", "none"]
+ }
+ return accountsOff ? ["--accounts-off"] : []
+ }
+
+ /// For `vm template setup`: the same without the trim, which the setup
+ /// boot takes from what `vm template trim` recorded.
+ var setupArguments: [String] {
+ guard slim else {
+ return ["--slim", "off"]
+ }
+ var arguments: [String] = []
+ var index = self.arguments.startIndex
+ let all = self.arguments
+ while index < all.endIndex {
+ let argument = all[index]
+ if argument == "--trim" || argument == "--keep-languages" {
+ index += 2
+ continue
+ }
+ arguments.append(argument)
+ index += 1
+ }
+ return arguments
+ }
+
+ /// `vm template trim`'s options, or nil when nothing is trimmed and the
+ /// step is left out.
+ var trimArguments: [String]? {
+ guard slim, trim != .none else {
+ return nil
+ }
+ return ["--tier", trim.rawValue] + (languagesArgument.map { ["--keep-languages", $0] } ?? [])
+ }
+}
+
+// MARK: - Commands
+
+/// The `vphone-cli` arguments of a template-backed creation and of the
+/// Templates page, without `--library-root`. One place, so the command a
+/// step shows cannot drift from the one it runs.
+nonisolated enum VPhoneLaunchpadTemplateCommands {
+ struct Request: Hashable, Sendable {
+ var iphoneSource: String
+ var cloudOSSource: String
+ var device: String?
+ var preset: String
+ var blocked: Set<String> = []
+ var allowed: Set<String> = []
+ var diskSizeGB: Int
+ var slimming: VPhoneLaunchpadSlimming
+ }
+
+ static func find(_ request: Request) -> [String] {
+ var arguments = ["vm", "template", "find", "--json",
+ "--iphone-source", request.iphoneSource, "--cloudos-source", request.cloudOSSource]
+ if let device = request.device {
+ arguments += ["--device", device]
+ }
+ arguments += ["--preset", request.preset, "--disk-size", String(request.diskSizeGB)]
+ arguments += request.blocked.sorted().flatMap { ["--block", $0] }
+ arguments += request.allowed.sorted().flatMap { ["--allow", $0] }
+ return arguments + request.slimming.arguments
+ }
+
+ static func trim(_ machine: String, _ slimming: VPhoneLaunchpadSlimming) -> [String]? {
+ slimming.trimArguments.map { ["vm", "template", "trim", machine] + $0 }
+ }
+
+ static func setup(_ machine: String, _ slimming: VPhoneLaunchpadSlimming) -> [String] {
+ ["vm", "template", "setup", machine] + slimming.setupArguments
+ }
+
+ static func adopt(_ machine: String, iphoneSource: String, cloudOSSource: String) -> [String] {
+ ["vm", "template", "adopt", machine, "--json", "--iphone-source", iphoneSource, "--cloudos-source", cloudOSSource]
+ }
+
+ /// The new machine, cloned with the settings a template does not fix.
+ /// Its first boot is Launchpad's own.
+ static func clone(_ machine: String, template: String, cpuCount: Int, memoryMB: Int, network: String) -> [String] {
+ ["vm", "create", machine, "--template", template, "--skip-first-boot",
+ "--cpu", String(cpuCount), "--memory", String(memoryMB), "--network", network]
+ }
+
+ static let list = ["vm", "template", "list", "--json"]
+
+ static func delete(_ identifier: String) -> [String] {
+ ["vm", "template", "delete", identifier, "--force"]
+ }
+
+ /// The line a failed `vphone-cli` ends with (`Error: …`), the reason a
+ /// step failed in a sentence; nil when there is none.
+ static func failureLine(_ lines: [String]) -> String? {
+ lines.last { $0.hasPrefix("Error: ") }.map { String($0.dropFirst("Error: ".count)) }
+ }
+}
+
+// MARK: - vm template list / show / find / adopt --json
+
+/// One template as `vm template list --json`, `show --json` and `adopt
+/// --json` print it (`VPhoneMachineTemplateReport`).
+nonisolated struct VPhoneLaunchpadTemplate: Decodable, Identifiable, Hashable, Sendable {
+ struct Slimming: Decodable, Hashable, Sendable {
+ let trimTier: String
+ let setupBoot: Bool
+ let serviceProfile: String
+ let serviceGroups: [String]
+ let removedApps: [String]
+
+ private enum CodingKeys: String, CodingKey {
+ case trimTier = "TrimTier"
+ case setupBoot = "SetupBoot"
+ case serviceProfile = "ServiceProfile"
+ case serviceGroups = "ServiceGroups"
+ case removedApps = "RemovedApps"
+ }
+
+ init(from decoder: any Decoder) throws {
+ let container = try decoder.container(keyedBy: CodingKeys.self)
+ trimTier = try container.decode(String.self, forKey: .trimTier)
+ setupBoot = try container.decode(Bool.self, forKey: .setupBoot)
+ serviceProfile = try container.decode(String.self, forKey: .serviceProfile)
+ serviceGroups = try container.decodeIfPresent([String].self, forKey: .serviceGroups) ?? []
+ removedApps = try container.decode([String].self, forKey: .removedApps)
+ }
+
+ /// The tier without its list version and languages:
+ /// `standard/1/en,zh` is `standard`.
+ var tier: String {
+ String(trimTier.split(separator: "/").first ?? "none")
+ }
+
+ /// The languages a standard trim kept, from `standard/1/en,zh`.
+ var keptLanguages: String? {
+ let parts = trimTier.split(separator: "/")
+ return parts.count >= 3 ? String(parts[2]) : nil
+ }
+
+ var isSlimmed: Bool {
+ tier != "none" || serviceProfile != "none" || !removedApps.isEmpty
+ }
+
+ /// `Standard trim · Services trimmed · 10 apps removed`, or Not
+ /// slimmed.
+ var summary: String {
+ guard isSlimmed else {
+ return String(localized: "Not slimmed")
+ }
+ var parts: [String] = []
+ switch tier {
+ case "standard": parts.append(String(localized: "Standard trim"))
+ case "conservative": parts.append(String(localized: "Conservative trim"))
+ case "none": parts.append(String(localized: "No trim"))
+ default: parts.append(tier)
+ }
+ if serviceProfile == "trimmed" {
+ parts.append(serviceGroups.contains("accounts")
+ ? String(localized: "Services and accounts off")
+ : String(localized: "Services trimmed"))
+ }
+ if !removedApps.isEmpty {
+ parts.append(String(localized: "^[\(removedApps.count) app](inflect: true) removed"))
+ }
+ return parts.joined(separator: " · ")
+ }
+ }
+
+ struct Key: Decodable, Hashable, Sendable {
+ let device: String
+ let iOSVersion: String
+ let iOSBuild: String
+ let cloudOSVersion: String
+ let cloudOSBuild: String
+ let patchPreset: String
+ let bundleSeries: String
+ let diskSizeGB: Int
+ let slimming: Slimming
+
+ private enum CodingKeys: String, CodingKey {
+ case device = "Device"
+ case iOSVersion = "IOSVersion"
+ case iOSBuild = "IOSBuild"
+ case cloudOSVersion = "CloudOSVersion"
+ case cloudOSBuild = "CloudOSBuild"
+ case patchPreset = "PatchPreset"
+ case bundleSeries = "BundleSeries"
+ case diskSizeGB = "DiskSizeGB"
+ case slimming = "Slimming"
+ }
+
+ var osName: String {
+ device.hasPrefix("iPad") ? "iPadOS" : "iOS"
+ }
+ }
+
+ struct Sources: Decodable, Hashable, Sendable {
+ let iPhone: String
+ let cloudOS: String
+
+ private enum CodingKeys: String, CodingKey {
+ case iPhone = "IPhone"
+ case cloudOS = "CloudOS"
+ }
+ }
+
+ let id: String
+ let path: String
+ let key: Key
+ let created: Date
+ let builtWithBundleVersion: String?
+ let bootChainBundleVersion: String?
+ let sourceMachine: String?
+ let allocatedBytes: Int64
+ let machines: [String]
+ let stale: Bool
+ let staleReasons: [String]
+ let sources: Sources?
+ /// The library it was listed from. Not part of the JSON.
+ var libraryRoot = ""
+
+ private enum CodingKeys: String, CodingKey {
+ case id, path, key, created, builtWithBundleVersion, bootChainBundleVersion, sourceMachine, allocatedBytes,
+ machines, stale, staleReasons, sources
+ }
+
+ static func decoder() -> JSONDecoder {
+ let decoder = JSONDecoder()
+ decoder.dateDecodingStrategy = .iso8601
+ return decoder
+ }
+
+ var url: URL {
+ URL(fileURLWithPath: path, isDirectory: true)
+ }
+}
+
+/// `vm template list --json`.
+nonisolated struct VPhoneLaunchpadTemplateList: Decodable, Sendable {
+ /// A create building a template, or a build that stopped.
+ struct Building: Decodable, Hashable, Sendable {
+ let name: String
+ let path: String
+ let id: String?
+ let active: Bool
+ }
+
+ var templates: [VPhoneLaunchpadTemplate]
+ var building: [Building]
+ var damaged: [[String: String]]
+
+ static func decode(_ data: Data, libraryRoot: String) throws -> Self {
+ var list = try VPhoneLaunchpadTemplate.decoder().decode(Self.self, from: data)
+ for index in list.templates.indices {
+ list.templates[index].libraryRoot = libraryRoot
+ }
+ return list
+ }
+}
+
+/// `vm template find --json`.
+nonisolated struct VPhoneLaunchpadTemplateFind: Decodable, Sendable {
+ let resolved: Bool
+ let resolvedBy: String?
+ let id: String?
+ let summary: String?
+ let template: VPhoneLaunchpadTemplate?
+ let usable: Bool
+ let building: Bool
+ let reason: String?
+
+ static func decode(_ data: Data) throws -> Self {
+ try VPhoneLaunchpadTemplate.decoder().decode(Self.self, from: data)
+ }
+}
+
+// MARK: - Last machine of a template
+
+/// What `vm delete` notes when the machine was the last one cloned from a
+/// template that is still there: the template, and what it takes.
+nonisolated struct VPhoneLaunchpadTemplateNotice: Identifiable, Hashable, Sendable {
+ let id: String
+ /// As the CLI wrote it, `17.58 GB`.
+ let size: String
+ let libraryRoot: String
+
+ /// `note: template 52b1fcc75e0c (~17.58 GB) is no longer used by any machine; …`
+ static func parse(_ lines: [String], libraryRoot: String) -> Self? {
+ for line in lines.reversed() {
+ if let match = line.firstMatch(of: /^note: template ([0-9a-f]{12}) \(~([^)]+)\) is no longer used by any machine/) {
+ return Self(id: String(match.1), size: String(match.2), libraryRoot: libraryRoot)
+ }
+ }
+ return nil
+ }
+}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadTemplatesView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadTemplatesView.swift
new file mode 100644
index 00000000..889aae0f
--- /dev/null
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadTemplatesView.swift
@@ -0,0 +1,281 @@
+import SwiftUI
+
+// MARK: - Templates
+
+/// Every library's machine templates, from `vm template list --json`, with
+/// Delete. New Machine builds a template the first time a combination of
+/// firmware, preset, disk size and slimming is asked for, and clones every
+/// later machine with that combination from it.
+struct VPhoneLaunchpadTemplatesView: View {
+ @Environment(VPhoneLaunchpadModel.self) private var model
+ @Environment(\.dismiss) private var dismiss
+ @State private var selection: VPhoneLaunchpadTemplate.ID?
+ @State private var deletion: VPhoneLaunchpadTemplate?
+ @State private var buildDeletion: (libraryRoot: String, name: String)?
+ @State private var isDeleting = false
+ @State private var actionError: VPhoneLaunchpadError?
+
+ private var library: VPhoneLaunchpadMachineLibrary {
+ model.machines
+ }
+
+ private var templates: [VPhoneLaunchpadTemplate] {
+ library.templates ?? []
+ }
+
+ private var selected: VPhoneLaunchpadTemplate? {
+ templates.first { $0.id == selection }
+ }
+
+ /// Builds no create holds any more.
+ private var leftovers: [(libraryRoot: String, build: VPhoneLaunchpadTemplateList.Building)] {
+ library.templateBuilds.filter { !$0.build.active }
+ }
+
+ var body: some View {
+ VPhoneLaunchpadSheet(Text("Templates")) {
+ VStack(spacing: 0) {
+ list
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ if let selected {
+ Divider()
+ detail(selected)
+ }
+ ForEach(leftovers, id: \.build.path) { leftover in
+ Divider()
+ HStack {
+ Label("A template build stopped before it finished: \(leftover.build.name)", systemImage: "exclamationmark.triangle")
+ .foregroundStyle(.secondary)
+ .lineLimit(1)
+ .truncationMode(.middle)
+ Spacer()
+ Button("Delete…") { buildDeletion = (leftover.libraryRoot, leftover.build.name) }
+ .disabled(isDeleting)
+ }
+ .font(.callout)
+ .padding(.horizontal, 16)
+ .padding(.vertical, 8)
+ }
+ }
+ } accessory: {
+ Button("Delete…") { deletion = selected }
+ .disabled(selected == nil || isDeleting)
+ .help(String(localized: "Delete the selected template. Machines created from it keep working."))
+ } actions: {
+ Button("Done") { dismiss() }
+ .keyboardShortcut(.defaultAction)
+ }
+ .frame(width: 980, height: 480)
+ .task { await reload() }
+ .confirmationDialog(
+ deletion.map { String(localized: "Delete template \($0.id)?") } ?? "",
+ isPresented: Binding(get: { deletion != nil }, set: {
+ if !$0 {
+ deletion = nil
+ }
+ }),
+ presenting: deletion,
+ ) { template in
+ Button("Delete", role: .destructive) {
+ Task { await delete(template.id, in: template.libraryRoot) }
+ }
+ } message: { template in
+ Text(deletionMessage(template))
+ }
+ .confirmationDialog(
+ String(localized: "Delete the unfinished template build?"),
+ isPresented: Binding(get: { buildDeletion != nil }, set: {
+ if !$0 {
+ buildDeletion = nil
+ }
+ }),
+ ) {
+ Button("Delete", role: .destructive) {
+ if let build = buildDeletion {
+ Task { await delete(build.name, in: build.libraryRoot) }
+ }
+ }
+ } message: {
+ Text("Its restored disk is deleted. A machine that needs this template builds it again.")
+ }
+ .errorAlert($actionError)
+ }
+
+ // MARK: - List
+
+ @ViewBuilder
+ private var list: some View {
+ if library.templates == nil {
+ if let error = library.templatesError {
+ ContentUnavailableView("Unable to List Templates", systemImage: "exclamationmark.triangle", description: Text(verbatim: error))
+ } else {
+ ProgressView().controlSize(.small)
+ }
+ } else if templates.isEmpty {
+ ContentUnavailableView {
+ Label("No Templates", systemImage: "square.stack.3d.up")
+ } description: {
+ Text("New Machine builds a template the first time it creates a machine from a firmware, and clones every later machine with the same options from it.")
+ }
+ } else {
+ table
+ }
+ }
+
+ private var table: some View {
+ Table(templates, selection: $selection) {
+ TableColumn("Template") { template in
+ VStack(alignment: .leading, spacing: 2) {
+ Text(verbatim: template.key.device)
+ Text(verbatim: template.id)
+ .font(.caption.monospaced())
+ .foregroundStyle(.secondary)
+ }
+ .help(template.path)
+ }
+ .width(min: 84, ideal: 96)
+ TableColumn("OS") { template in
+ Text(verbatim: "\(template.key.osName) \(template.key.iOSVersion) (\(template.key.iOSBuild))")
+ .help(Text(verbatim: "cloudOS \(template.key.cloudOSVersion) (\(template.key.cloudOSBuild))"))
+ }
+ .width(min: 130, ideal: 150)
+ TableColumn("Preset") { template in
+ Text(verbatim: "\(template.key.patchPreset), \(template.key.diskSizeGB) GB")
+ }
+ .width(min: 110, ideal: 120)
+ TableColumn("Slimming") { template in
+ Text(template.key.slimming.summary)
+ .lineLimit(1)
+ .help(slimmingHelp(template.key.slimming))
+ }
+ .width(min: 120, ideal: 150)
+ TableColumn("Size") { template in
+ Text(verbatim: VPhoneLaunchpadDiskUsage.format(template.allocatedBytes))
+ .monospacedDigit()
+ .help(sizeHelp(template))
+ }
+ .width(min: 60, ideal: 70)
+ .alignment(.numeric)
+ TableColumn("Machines") { template in
+ Text(verbatim: template.machines.isEmpty ? "—" : template.machines.joined(separator: ", "))
+ .foregroundStyle(template.machines.isEmpty ? .secondary : .primary)
+ .lineLimit(1)
+ .truncationMode(.tail)
+ .help(template.machines.joined(separator: ", "))
+ }
+ .width(min: 64, ideal: 86)
+ TableColumn("State") { template in
+ if template.stale {
+ Label {
+ Text("Outdated")
+ } icon: {
+ VPhoneLaunchpadStatusIcon(status: .warning)
+ }
+ .help(template.staleReasons.joined(separator: "\n"))
+ } else {
+ Label {
+ Text("Current")
+ } icon: {
+ VPhoneLaunchpadStatusIcon(status: .passed)
+ }
+ }
+ }
+ .width(min: 76, ideal: 84)
+ TableColumn("Created") { template in
+ Text(template.created, format: .dateTime.year().month(.defaultDigits).day())
+ .help(template.created.formatted(date: .long, time: .shortened))
+ }
+ .width(min: 70, ideal: 84)
+ }
+ .onDeleteCommand { deletion = selected }
+ }
+
+ /// The selected template's details that do not fit a column.
+ private func detail(_ template: VPhoneLaunchpadTemplate) -> some View {
+ VStack(alignment: .leading, spacing: 4) {
+ if template.stale {
+ Label {
+ Text("Outdated: \(template.staleReasons.joined(separator: "; ")). New machines get a new template; this one only takes space.")
+ } icon: {
+ Image(systemName: "exclamationmark.triangle.fill").foregroundStyle(.yellow)
+ }
+ }
+ if let sources = template.sources {
+ Text("Built from \(URL(string: sources.iPhone)?.lastPathComponent ?? sources.iPhone) and cloudOS \(template.key.cloudOSVersion) (\(template.key.cloudOSBuild)).")
+ }
+ Text("Built with Core Bundle \(template.builtWithBundleVersion ?? "—"); every machine from it shares its SEP root secret and Data volume keys.")
+ }
+ .font(.callout)
+ .foregroundStyle(.secondary)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(.horizontal, 16)
+ .padding(.vertical, 8)
+ }
+
+ // MARK: - Text
+
+ private func slimmingHelp(_ slimming: VPhoneLaunchpadTemplate.Slimming) -> String {
+ var lines: [String] = []
+ if slimming.tier != "none" {
+ lines.append(String(localized: "Trim: \(slimming.trimTier)"))
+ }
+ lines.append(String(localized: "Service profile: \(slimming.serviceProfile)"))
+ if !slimming.removedApps.isEmpty {
+ lines.append(String(localized: "Removed: \(slimming.removedApps.map(VPhoneLaunchpadSlimming.appName).joined(separator: ", "))"))
+ }
+ return lines.joined(separator: "\n")
+ }
+
+ private func sizeHelp(_ template: VPhoneLaunchpadTemplate) -> String {
+ guard let exclusive = library.usage(of: template)?.exclusive else {
+ return String(localized: "Allocated on disk.")
+ }
+ return String(localized: "Allocated on disk; deleting it frees \(VPhoneLaunchpadDiskUsage.format(exclusive)) now, the blocks no machine shares.")
+ }
+
+ private func deletionMessage(_ template: VPhoneLaunchpadTemplate) -> String {
+ var parts: [String] = []
+ if template.machines.isEmpty {
+ parts.append(String(localized: "No machine was created from it."))
+ } else {
+ parts.append(String(localized: "\(template.machines.joined(separator: ", ")) keep working: they share its blocks but do not need it."))
+ }
+ if let exclusive = library.usage(of: template)?.exclusive {
+ parts.append(String(localized: "Deleting it frees about \(VPhoneLaunchpadDiskUsage.format(exclusive)) now; the blocks its machines share are freed once they change or are deleted."))
+ }
+ parts.append(String(localized: "The next machine with its options builds a new template, which takes a restore."))
+ return parts.joined(separator: " ")
+ }
+
+ // MARK: - Actions
+
+ private func reload() async {
+ #if DEBUG
+ if VPhoneLaunchpadPreview.isActive {
+ library.applyPreviewTemplates()
+ selection = selection ?? VPhoneLaunchpadPreview.templates.first?.id
+ return
+ }
+ #endif
+ await library.refreshTemplates()
+ if let selection, !templates.contains(where: { $0.id == selection }) {
+ self.selection = nil
+ }
+ }
+
+ private func delete(_ name: String, in root: String) async {
+ guard !isDeleting else {
+ return
+ }
+ isDeleting = true
+ defer { isDeleting = false }
+ do {
+ try await library.deleteTemplate(name, in: root)
+ } catch is CancellationError {
+ return
+ } catch {
+ actionError = VPhoneLaunchpadError(actionFailure: error)
+ }
+ await reload()
+ }
+}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swift b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swift
index c29e6ebf..6481195f 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swift
@@ -82,7 +82,9 @@ nonisolated enum VPhoneLaunchpadNames {
/// `vm snapshot`, which the Snapshots sheet runs. 2.8.0 added `vm config
/// --sync-host-location`, which a machine's Settings pass. 2.9.0 added
/// `--work-parent` on `cfw install`, `update-environment` and
- /// `update-kernel`, which the helper passes.
+ /// `update-kernel`, which the helper passes, and `vm template
+ /// find|trim|setup|adopt --json|list --json|delete` and `vm create
+ /// --template --skip-first-boot`, which New Machine and Templates run.
private static let minimumBundleComponents = (2, 9, 0)
static let minimumBundleVersion =
"\(minimumBundleComponents.0).\(minimumBundleComponents.1).\(minimumBundleComponents.2)"
diff --git a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadControl.swift b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadControl.swift
index e3cd1a10..f9418753 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadControl.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadControl.swift
@@ -168,8 +168,9 @@ nonisolated struct VPhoneLaunchpadControlCommand: Sendable {
summary: "The last lines of the console log (--kind create, dfu or patch for those logs)."),
Self(name: "vm.create", arguments: ["name"], options: [
"root", "bundle", "iphone-source", "cloudos-source", "device", "cpu", "memory", "disk-size", "network", "preset", "from",
- ], flags: ["keep-artifacts", "no-wait"],
- summary: "Create a machine through every step, as New Machine does, bound to --bundle (default: the default bundle). --from <step> retries a failed creation from that step."),
+ "slim", "trim", "keep-languages", "service-profile", "remove-apps", "keep-apps",
+ ], flags: ["keep-artifacts", "no-wait", "no-template", "accounts-off"],
+ 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. --slim, --trim, --keep-languages, --service-profile, --remove-apps, --keep-apps and --accounts-off shape the template, as in vphone-cli vm create. --from <step> retries a failed creation from that step."),
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"],