Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c69fa5768 |
No files matched your search
@@ -65,11 +65,15 @@ def main() -> int:
|
|||||||
info(f"Installing Omarchy for {ctx.username} → {ctx.target}")
|
info(f"Installing Omarchy for {ctx.username} → {ctx.target}")
|
||||||
|
|
||||||
from .phases_impl import (
|
from .phases_impl import (
|
||||||
|
boost_cpu_governor,
|
||||||
cleanup_bind_mounts,
|
cleanup_bind_mounts,
|
||||||
cleanup_protected_state,
|
cleanup_protected_state,
|
||||||
cleanup_target_hook_masks,
|
cleanup_target_hook_masks,
|
||||||
|
restore_cpu_governors,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
governors = boost_cpu_governor()
|
||||||
|
|
||||||
success = False
|
success = False
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
@@ -85,6 +89,7 @@ def main() -> int:
|
|||||||
info("Installation complete.")
|
info("Installation complete.")
|
||||||
return 0
|
return 0
|
||||||
finally:
|
finally:
|
||||||
|
restore_cpu_governors(governors)
|
||||||
cleanup_bind_mounts(ctx)
|
cleanup_bind_mounts(ctx)
|
||||||
cleanup_target_hook_masks(ctx)
|
cleanup_target_hook_masks(ctx)
|
||||||
if not success:
|
if not success:
|
||||||
|
|||||||
@@ -1396,6 +1396,40 @@ def _validate_pre_mounted_filesystems(ctx: InstallContext) -> None:
|
|||||||
raise RuntimeError(f"{crypttab} missing LUKS UUID {storage['luks_uuid']}")
|
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
|
# cleanup_bind_mounts: invoked from main()'s finally so bind mounts get
|
||||||
# unwound on success, failure, or interrupt. Idempotent.
|
# unwound on success, failure, or interrupt. Idempotent.
|
||||||
|
|||||||
Reference in new issue
Block a user