Implement minimal OS and Bootloader installation logic

This commit is contained in:
2026-02-03 16:28:55 +01:00
parent 3c4870b104
commit 2377b0269a
3 changed files with 157 additions and 9 deletions

View File

@@ -74,3 +74,28 @@ def auto_partition_disk(disk_device):
"swap": swap_part,
"root": root_part
}
def mount_partitions(partition_info, mount_root="/mnt"):
"""
Mounts the partitions into mount_root.
partition_info is the dict returned by auto_partition_disk.
"""
import os
# 1. Mount Root
if not os.path.exists(mount_root):
os.makedirs(mount_root)
run_command(["mount", partition_info["root"], mount_root])
# 2. Mount EFI
efi_mount = os.path.join(mount_root, "boot/efi")
if not os.path.exists(efi_mount):
os.makedirs(efi_mount, exist_ok=True)
run_command(["mount", partition_info["efi"], efi_mount])
# 3. Enable Swap (optional, but might as well)
run_command(["swapon", partition_info["swap"]])
logger.info(f"Partitions mounted at {mount_root}")