diff --git a/configs/airootfs/usr/share/omarchy-iso/orchestrator/main.py b/configs/airootfs/usr/share/omarchy-iso/orchestrator/main.py index 46142e0..62f4c88 100644 --- a/configs/airootfs/usr/share/omarchy-iso/orchestrator/main.py +++ b/configs/airootfs/usr/share/omarchy-iso/orchestrator/main.py @@ -65,11 +65,15 @@ def main() -> int: info(f"Installing Omarchy for {ctx.username} → {ctx.target}") from .phases_impl import ( + boost_cpu_governor, cleanup_bind_mounts, cleanup_protected_state, cleanup_target_hook_masks, + restore_cpu_governors, ) + governors = boost_cpu_governor() + success = False try: try: @@ -85,6 +89,7 @@ def main() -> int: info("Installation complete.") return 0 finally: + restore_cpu_governors(governors) cleanup_bind_mounts(ctx) cleanup_target_hook_masks(ctx) if not success: diff --git a/configs/airootfs/usr/share/omarchy-iso/orchestrator/phases_impl.py b/configs/airootfs/usr/share/omarchy-iso/orchestrator/phases_impl.py index fdc66c9..80c7b77 100644 --- a/configs/airootfs/usr/share/omarchy-iso/orchestrator/phases_impl.py +++ b/configs/airootfs/usr/share/omarchy-iso/orchestrator/phases_impl.py @@ -1396,6 +1396,40 @@ def _validate_pre_mounted_filesystems(ctx: InstallContext) -> None: raise RuntimeError(f"{crypttab} missing LUKS UUID {storage['luks_uuid']}") +CPU_SYSFS = Path("/sys/devices/system/cpu") + + +def boost_cpu_governor() -> dict[Path, str]: + """Run the live CPUs flat out for the install. + + Package extraction and the UKI build are both CPU-bound, and archiso boots + on whatever governor the kernel defaults to. Writing an unsupported + governor just fails, so nothing needs probing first, and hosts without + cpufreq (most VMs) have no paths at all. Returns the prior governors. + """ + saved: dict[Path, str] = {} + for path in sorted(CPU_SYSFS.glob("cpu*/cpufreq/scaling_governor")): + try: + saved[path] = path.read_text().strip() + path.write_text("performance\n") + except OSError: + saved.pop(path, None) + + if saved: + info(f"› CPU governor set to performance ({len(saved)} CPUs)") + return saved + + +def restore_cpu_governors(saved: dict[Path, str]) -> None: + """Only matters when an install fails and the user keeps using the live + environment — a successful one reboots out of it.""" + for path, governor in saved.items(): + try: + path.write_text(f"{governor}\n") + except OSError: + continue + + # ───────────────────────────────────────────────────────────────────────────── # cleanup_bind_mounts: invoked from main()'s finally so bind mounts get # unwound on success, failure, or interrupt. Idempotent.