orchestrator: recover missing ESP mount in free-space installs

This commit is contained in:
Ryan Hughes committed 2026-05-22 15:00:19 -04:00
1 parent cab315bb8a
commit 948a53cc0a
2 files changed
+14 -8

No files matched your search

+1
View File
@@ -632,6 +632,7 @@ _EOF_
cat >/root/protected_install.json <<JSON
{
"esp_device": "$efi_dev",
"esp_mount": "$esp_mount_in_target",
"esp_path": "/EFI/Omarchy",
"luks_uuid": $luks_uuid_json,
@@ -428,13 +428,6 @@ def verify_protected_mounts(ctx: InstallContext) -> None:
if not _is_mountpoint(target):
raise RuntimeError(f"protected mode: {target} is not a mountpoint")
boot_mp = target / "boot"
efi_mp = target / "efi"
if not (_is_mountpoint(boot_mp) or _is_mountpoint(efi_mp)):
raise RuntimeError(
f"protected mode: no ESP mounted under {target} (checked {boot_mp}, {efi_mp})"
)
if not PROTECTED_INTENT_PATH.exists():
raise RuntimeError(
f"protected mode: expected partition intent at {PROTECTED_INTENT_PATH} "
@@ -442,11 +435,23 @@ def verify_protected_mounts(ctx: InstallContext) -> None:
)
intent = json.loads(PROTECTED_INTENT_PATH.read_text())
for key in ("esp_mount", "esp_path", "luks_uuid", "root_device", "kernel"):
for key in ("esp_device", "esp_mount", "esp_path", "luks_uuid", "root_device", "kernel"):
if key not in intent:
raise RuntimeError(
f"protected mode: {PROTECTED_INTENT_PATH} missing key '{key}'"
)
esp_mp = target / intent["esp_mount"].lstrip("/")
if not _is_mountpoint(esp_mp):
esp_dev = intent["esp_device"]
if not Path(esp_dev).exists():
raise RuntimeError(
f"protected mode: ESP device {esp_dev} from {PROTECTED_INTENT_PATH} does not exist"
)
info(f"› remounting protected ESP {esp_dev} at {esp_mp}")
esp_mp.mkdir(parents=True, exist_ok=True)
subprocess.run(["mount", esp_dev, str(esp_mp)], check=True)
ctx.state["protected"] = intent
info(f"› protected intent loaded: kernel={intent['kernel']} esp={intent['esp_mount']}")