Unify ISO install orchestration
Drive installs through the common ISO pipeline, carry install intent in configurator JSON, and finalize Limine boot setup from the ISO.
This commit is contained in:
17 files changed
+958
-814
No files matched your search
@@ -201,6 +201,9 @@ weights = [
|
||||
('Installing base system', 8, 84, 85),
|
||||
('Configuring protected boot', 84, 86, 8),
|
||||
('Configuring hibernation', 86, 88, 5),
|
||||
('Configuring system', 88, 93, 10),
|
||||
('Finalizing Limine boot', 93, 96, 8),
|
||||
('Finalizing user', 96, 98, 10),
|
||||
('Finalizing in chroot', 88, 98, 10),
|
||||
('Configuring login', 98, 99, 3),
|
||||
('Validating protected boot setup', 99, 100, 5),
|
||||
|
||||
@@ -66,7 +66,7 @@ def load_arch_config(config_path: Path, creds_path: Path) -> ArchConfigHandler:
|
||||
import sys
|
||||
saved_argv = sys.argv
|
||||
sys.argv = [
|
||||
saved_argv[0] if saved_argv else "omarchy-install",
|
||||
saved_argv[0] if saved_argv else "omarchy-iso-install",
|
||||
"--config", str(config_path),
|
||||
"--creds", str(creds_path),
|
||||
]
|
||||
|
||||
@@ -21,6 +21,8 @@ class InstallContext:
|
||||
|
||||
user_configuration: dict
|
||||
user_credentials: dict
|
||||
arch_config_path: Path
|
||||
omarchy_install: dict[str, Any]
|
||||
|
||||
target: Path = Path("/mnt")
|
||||
omarchy_path: Path = Path("/usr/share/omarchy")
|
||||
@@ -42,6 +44,15 @@ class InstallContext:
|
||||
config_path = Path(config_str)
|
||||
creds_path = Path(creds_str)
|
||||
user_configuration = json.loads(config_path.read_text())
|
||||
omarchy_install = user_configuration.get("omarchy_install") or _default_omarchy_install(user_configuration)
|
||||
|
||||
arch_configuration = dict(user_configuration)
|
||||
arch_configuration.pop("omarchy_install", None)
|
||||
state_dir = Path(os.environ.get("OMARCHY_INSTALL_STATE_DIR", "/run/omarchy-install"))
|
||||
state_dir.mkdir(parents=True, exist_ok=True)
|
||||
arch_config_path = state_dir / "archinstall-user_configuration.json"
|
||||
arch_config_path.write_text(json.dumps(arch_configuration, indent=2) + "\n")
|
||||
|
||||
ctx = cls(
|
||||
config_path=config_path,
|
||||
creds_path=creds_path,
|
||||
@@ -50,13 +61,14 @@ class InstallContext:
|
||||
encrypt=_read_text(os.environ.get("OMARCHY_INSTALL_ENCRYPT_FILE")).lower() in ("true", "yes", "1"),
|
||||
user_configuration=user_configuration,
|
||||
user_credentials=json.loads(creds_path.read_text()),
|
||||
arch_config_path=arch_config_path,
|
||||
omarchy_install=omarchy_install,
|
||||
state_dir=state_dir,
|
||||
)
|
||||
disk_config = user_configuration.get("disk_config", {})
|
||||
if (
|
||||
disk_config.get("config_type") == "pre_mounted_config"
|
||||
and disk_config.get("mountpoint")
|
||||
):
|
||||
ctx.target = Path(disk_config["mountpoint"])
|
||||
target_mount = omarchy_install.get("target_mount") or disk_config.get("mountpoint")
|
||||
if target_mount:
|
||||
ctx.target = Path(target_mount)
|
||||
return ctx
|
||||
|
||||
@property
|
||||
@@ -65,6 +77,8 @@ class InstallContext:
|
||||
|
||||
@property
|
||||
def mode(self) -> str:
|
||||
if mode := self.omarchy_install.get("mode"):
|
||||
return mode
|
||||
cfg_type = self.user_configuration.get("disk_config", {}).get("config_type")
|
||||
return "protected" if cfg_type == "pre_mounted_config" else "full_disk"
|
||||
|
||||
@@ -73,6 +87,22 @@ class InstallContext:
|
||||
return self.mode == "protected"
|
||||
|
||||
|
||||
def _default_omarchy_install(user_configuration: dict) -> dict[str, Any]:
|
||||
disk_config = user_configuration.get("disk_config", {})
|
||||
mode = "protected" if disk_config.get("config_type") == "pre_mounted_config" else "full_disk"
|
||||
return {
|
||||
"mode": mode,
|
||||
"target_mount": disk_config.get("mountpoint") or "/mnt",
|
||||
"boot": {
|
||||
"esp_mount": "/boot",
|
||||
"esp_path": "/EFI/limine",
|
||||
"efi_binary": "limine_x64.efi",
|
||||
"enable_fallback": mode == "full_disk",
|
||||
},
|
||||
"storage": {},
|
||||
}
|
||||
|
||||
|
||||
def _read_text(path: str | None) -> str:
|
||||
if not path:
|
||||
return ""
|
||||
|
||||
@@ -23,43 +23,33 @@ def build_phases(ctx: InstallContext):
|
||||
hooks (limine-mkinitcpio-hook, in particular) and useradd happen at
|
||||
points where their prerequisites are guaranteed to be in place.
|
||||
|
||||
Two modes:
|
||||
- full_disk: archinstall owns disk layout + bootloader.
|
||||
- protected: Omarchy owns disk layout + bootloader; archinstall is
|
||||
used for pacstrap + users + packages only.
|
||||
Full-disk and protected installs use the same phase sequence. The
|
||||
configurator only changes the JSON input: full-disk asks archinstall to
|
||||
create/mount the layout, while protected provides an already-mounted target
|
||||
and the partition details Omarchy needs for boot/fstab generation.
|
||||
"""
|
||||
from .phases_impl import (
|
||||
prepare_live,
|
||||
arch_install_full,
|
||||
arch_install_base,
|
||||
verify_protected_mounts,
|
||||
configure_protected_boot,
|
||||
prepare_install_target,
|
||||
arch_install_system,
|
||||
configure_hibernation,
|
||||
run_system_finalizer,
|
||||
finalize_limine_boot,
|
||||
run_chroot_finalizer,
|
||||
configure_login,
|
||||
validate_boot_full,
|
||||
validate_boot_protected,
|
||||
validate_boot,
|
||||
)
|
||||
|
||||
if ctx.is_protected:
|
||||
return [
|
||||
("Preparing live environment", prepare_live),
|
||||
("Verifying protected mounts", verify_protected_mounts),
|
||||
("Installing base system", arch_install_base),
|
||||
("Configuring protected boot", configure_protected_boot),
|
||||
("Configuring hibernation", configure_hibernation),
|
||||
("Finalizing in chroot", run_chroot_finalizer),
|
||||
("Configuring login", configure_login),
|
||||
("Validating protected boot setup", validate_boot_protected),
|
||||
]
|
||||
|
||||
return [
|
||||
("Preparing live environment", prepare_live),
|
||||
("Installing Arch + Omarchy", arch_install_full),
|
||||
("Preparing install target", prepare_install_target),
|
||||
("Installing Arch + Omarchy", arch_install_system),
|
||||
("Configuring hibernation", configure_hibernation),
|
||||
("Finalizing in chroot", run_chroot_finalizer),
|
||||
("Configuring system", run_system_finalizer),
|
||||
("Finalizing Limine boot", finalize_limine_boot),
|
||||
("Finalizing user", run_chroot_finalizer),
|
||||
("Configuring login", configure_login),
|
||||
("Validating boot setup", validate_boot_full),
|
||||
("Validating boot setup", validate_boot),
|
||||
]
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user