Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ is on main, the release is published with that section as its notes (AGENTS.md,

### Installer and launcher

- On iPadOS 12 to 14, splitting the storage tells the space iPadOS uses
from the space a system snapshot holds (iPadOS's update snapshot after a
checkra1n 0.12.4 start, or checkra1n's orig-fs). Before, such an iPad
could show all its storage as used and "can spare 0 GB". Where iPadOS
doesn't run from the snapshot, the installer explains it and offers to
remove it (`--remove-snapshot` without a terminal), which gives the
space back.

- Choosing Dopamine in the Options after a start with palera1n didn't work
now switches to Dopamine: the installer finds the device again as it is,
and Continue installs the helper app. Before, it kept sending the device
Expand Down
2 changes: 2 additions & 0 deletions companion/Helper/helper.entitlements.plist
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<key>com.apple.security.iokit-user-client-class</key>
<!-- AppleKeyStoreUserClient: MobileKeyBag's first-unlock query (FirstUnlock). -->
<array><string>AppleAPFSUserClient</string><string>AppleKeyStoreUserClient</string></array>
<!-- Removing iPadOS 12-14's system snapshot (fs_snapshot_delete), as resize-apfs's helper does. -->
<key>com.apple.private.vfs.snapshot</key><true/>
<!-- Opening the companion app (LaunchServices, SpringBoard). -->
<key>com.apple.springboard.launchapplications</key><true/>
<key>com.apple.frontboard.launchapplications</key><true/>
Expand Down
13 changes: 13 additions & 0 deletions companion/Helper/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,19 @@ final class Server: @unchecked Sendable {
try reply(fd, okJSON: data)
// The copy shows the running split from now on.
publish(try? engine.snapshot())
case "remove_snapshot":
// iPadOS 12-14: the system snapshot that keeps APFS from shrinking,
// which the user approved removing. The engine checks it again (the
// layout's revision, the name, that iPadOS neither runs from it nor
// reverts to it) and inspects the storage afterwards.
guard let name = args["name"] as? String, !name.isEmpty,
let revisionText = args["revision"] as? String, let revision = UUID(uuidString: revisionText)
else { throw ResizeError("Removing a snapshot needs its name and the layout's revision.") }
log("removing the snapshot \(name)")
let snapshot = try engine.removeSnapshot(SnapshotRequest(revision: revision, name: name))
log("removed the snapshot \(name)")
try reply(fd, okJSON: JSONEncoder().encode(snapshot))
publish(snapshot)
default: throw ResizeError("Unknown request.")
}
} catch {
Expand Down
10 changes: 10 additions & 0 deletions companion/PROTOCOL.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ anything else, or a wrong token, closes the connection.
{"hello": {"token": "…", "protocol": 1}}
{"snapshot": {}}
{"split": {"apfs_bytes": 64000000000, "revision": "…", "replacing": ["…"]}}
{"remove_snapshot": {"name": "…", "revision": "…"}}
{"ping": {}}
{"log": {}}
```
Expand All @@ -85,6 +86,15 @@ Answers are `{"ok": …}` or `{"error": {"message": "…"}}`.
approved erasing on the split screen. It must name exactly all of them;
the split removes their GPT entries in its verified GPT write, so it
always leaves iPadOS and free space after it (resize-apfs's plan).
- `remove_snapshot` → the new snapshot, as `snapshot` answers it. iPadOS 12-14:
removes the system snapshot `layout.systemSnapshot` names (iPadOS's update
snapshot, or checkra1n's orig-fs), whose blocks keep APFS from shrinking
below `minimumContainerBytes`. The user approves it on the split screen.
resize-apfs's engine refuses it unless `revision` is the current layout's,
the name is the one it reports, it is `removable` (iPadOS neither runs from
it nor reverts to it) and no operation runs; afterwards it asks APFS for the
new minimum. The answer can take two minutes: the installer waits that long,
and reads the layout again after a dropped connection.
- `log` → `{"text": "…"}`: the last 64 KiB of the helper's log (see the
table above), with seconds since the helper started.
The installer saves it after connecting, to see where the time between
Expand Down
42 changes: 32 additions & 10 deletions crates/app/src/install_screens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,21 +396,43 @@ pub fn split_erase_dialog(layout: &Layout, approved: bool, connected: bool, stuc
}

/// 2.2c: not enough free space.
fn no_room(layout: &Layout, cx: &mut Context<Installer>) -> Div {
/// `removing`: the companion is removing the system snapshot;
/// `confirming`: the user is asked whether to; `problem`: why it didn't.
fn no_room(layout: &Layout, removing: bool, confirming: bool, problem: Option<&str>, cx: &mut Context<Installer>) -> Div {
let free = layout.max_omarchy_gb();
let subtitle = orchard_flow::for_device(&format!(
"{} needs at least {MIN_OMARCHY_GB} GB, and iPadOS only has {free} GB free right now. Delete some apps or files on your iPad, then check again.",
sys()
))
.to_owned();
div()
// A snapshot that may go and would make room: removing it is the way on.
let freeable = layout.snapshot_offer();
let reason = match freeable {
Some((snap, after)) => orchard_flow::snapshot_reason(layout, &snap.name, after, &sys()),
None => orchard_flow::no_room_hint(layout),
};
let subtitle = format!("{} {reason}", orchard_flow::for_device(&format!("{} needs at least {MIN_OMARCHY_GB} GB, and iPadOS can spare {free} GB right now.", sys())));
let mut col = div()
.w_full()
.flex()
.flex_col()
.gap(px(22.))
.child(header(orchard_flow::for_device("Not enough free space on your iPad"), subtitle, TITLE))
.child(div().w_full().flex().flex_col().gap(px(12.)).child(split_labels(layout.total_gb, 0)).child(split_bar(layout, 0., OmarchyNote::Needs, None, cx)))
.child(actions().child(primary("check-again", "Check again", 18., 9., Event::Retry, cx)))
.child(div().w_full().flex().flex_col().gap(px(12.)).child(split_labels(layout.total_gb, 0)).child(split_bar(layout, 0., OmarchyNote::Needs, None, cx)));
if let Some(problem) = problem {
let line = orchard_flow::for_device(&format!("Your iPad didn't remove the snapshot: {problem}")).to_owned();
col = col.child(div().w_full().text_size(px(13.)).line_height(px(19.)).text_color(c(AMBER)).child(line));
}
let buttons = match (freeable, removing, confirming) {
(Some(_), true, _) => actions().child(div().text_size(px(13.)).text_color(c(MUTED)).child("Removing the snapshot. This can take a few minutes.")),
// Removing it can't be undone: asked once more.
(Some(_), false, true) => {
col = col.child(div().w_full().text_size(px(13.)).line_height(px(19.)).text_color(c(AMBER)).child("Remove the snapshot? This can't be undone."));
actions()
.child(secondary("keep-snapshot", "Cancel", 18., 9., Event::AskRemoveSnapshot(false), cx))
.child(primary("remove-snapshot", "Remove", 18., 9., Event::RemoveSnapshot, cx))
}
(Some(_), false, false) => actions()
.child(secondary("check-again", "Check again", 18., 9., Event::Retry, cx))
.child(primary("ask-remove-snapshot", "Remove the snapshot…", 18., 9., Event::AskRemoveSnapshot(true), cx)),
(None, _, _) => actions().child(primary("check-again", "Check again", 18., 9., Event::Retry, cx)),
};
col.child(buttons)
}

/// The split's three steps (2.4, 2.4b, 2.5): done, now, later.
Expand Down Expand Up @@ -1266,7 +1288,7 @@ pub fn text_column(installer: &mut Installer, cx: &mut Context<Installer>) -> Op
State::ChooseSplit { layout, omarchy_gb, approved, .. } => {
installer.layout = Some(layout.clone());
if layout.max_omarchy_gb() < MIN_OMARCHY_GB {
no_room(layout, cx).into_any_element()
no_room(layout, installer.flow.removing_snapshot, installer.flow.confirming_snapshot, installer.flow.split_problem.as_deref(), cx).into_any_element()
} else {
// While dragging, the window's own position; else the flow's.
let shown = installer.drag.as_ref().map(|d| d.value).unwrap_or(*omarchy_gb as f32);
Expand Down
Loading