This commit is contained in:
2026-02-05 12:39:41 +01:00
parent f7bebc7f88
commit eb03edb050
4 changed files with 38 additions and 20 deletions

View File

@@ -229,7 +229,7 @@ def mount_partitions(partition_info, mount_root="/mnt"):
run_command(["mount", partition_info["root"], mount_root]) run_command(["mount", partition_info["root"], mount_root])
# 2. Mount EFI # 2. Mount EFI
efi_mount = os.path.join(mount_root, "boot/efi") efi_mount = os.path.join(mount_root, "boot")
if not os.path.exists(efi_mount): if not os.path.exists(efi_mount):
os.makedirs(efi_mount, exist_ok=True) os.makedirs(efi_mount, exist_ok=True)

View File

@@ -112,8 +112,6 @@ def install_minimal_os(mount_root, releasever="43"):
"kernel", "kernel",
"systemd", "systemd",
"dnf", "dnf",
"grub2-efi-x64",
"shim-x64",
"efibootmgr", "efibootmgr",
"passwd", "passwd",
"rootfiles", "rootfiles",
@@ -140,7 +138,7 @@ def install_minimal_os(mount_root, releasever="43"):
def configure_system(mount_root, partition_info): def configure_system(mount_root, partition_info):
""" """
Basic configuration: fstab and grub. Basic configuration: fstab and systemd-boot.
""" """
logger.info("Configuring system...") logger.info("Configuring system...")
log_os_install("CONFIGURE", "start", f"Configuring system in {mount_root}") log_os_install("CONFIGURE", "start", f"Configuring system in {mount_root}")
@@ -160,24 +158,44 @@ def configure_system(mount_root, partition_info):
fstab_content = f""" fstab_content = f"""
UUID={root_uuid} / ext4 defaults 1 1 UUID={root_uuid} / ext4 defaults 1 1
UUID={efi_uuid} /boot/efi vfat defaults 0 2 UUID={efi_uuid} /boot vfat defaults 0 2
{swap_entry} {swap_entry}
""" """
os.makedirs(os.path.join(mount_root, "etc"), exist_ok=True) os.makedirs(os.path.join(mount_root, "etc"), exist_ok=True)
with open(os.path.join(mount_root, "etc/fstab"), "w") as f: with open(os.path.join(mount_root, "etc/fstab"), "w") as f:
f.write(fstab_content) f.write(fstab_content)
# 2. Configure GRUB # 2. Configure systemd-boot
with mount_pseudo_fs(mount_root): with mount_pseudo_fs(mount_root):
# grub2-mkconfig -o /boot/grub2/grub.cfg # Ensure machine-id exists for kernel-install
chroot_cmd = [ if not os.path.exists(os.path.join(mount_root, "etc/machine-id")):
"chroot", run_command(["chroot", mount_root, "systemd-machine-id-setup"])
mount_root,
"grub2-mkconfig", # Set kernel command line
"-o", os.makedirs(os.path.join(mount_root, "etc/kernel"), exist_ok=True)
"/boot/grub2/grub.cfg", with open(os.path.join(mount_root, "etc/kernel/cmdline"), "w") as f:
] f.write(f"root=UUID={root_uuid} rw quiet\n")
run_command(chroot_cmd)
# Install systemd-boot to the ESP (mounted at /boot)
run_command(["chroot", mount_root, "bootctl", "install"])
# Add kernel entries
modules_dir = os.path.join(mount_root, "lib/modules")
if os.path.exists(modules_dir):
kvers = [d for d in os.listdir(modules_dir) if os.path.isdir(os.path.join(modules_dir, d))]
for kver in kvers:
logger.info(f"Adding kernel entry for {kver}...")
kernel_image = f"/lib/modules/{kver}/vmlinuz"
# In Fedora, the initrd is usually created in /boot/initramfs-<version>.img
# During installation, dnf should have triggered dracut.
initrd_path = f"/boot/initramfs-{kver}.img"
cmd = ["chroot", mount_root, "kernel-install", "add", kver, kernel_image]
if os.path.exists(os.path.join(mount_root, initrd_path.lstrip("/"))):
cmd.append(initrd_path)
run_command(cmd)
logger.info("System configuration complete.") logger.info("System configuration complete.")
log_os_install("CONFIGURE", "complete", "GRUB configured successfully") log_os_install("CONFIGURE", "complete", "systemd-boot configured successfully")

View File

@@ -56,9 +56,9 @@ def main():
logger.info("INSTALLER_OS_INSTALL_COMPLETE: OS installed successfully") logger.info("INSTALLER_OS_INSTALL_COMPLETE: OS installed successfully")
print("Step 4: Configuring Bootloader...") print("Step 4: Configuring Bootloader...")
logger.info("INSTALLER_GRUB: Configuring GRUB bootloader") logger.info("INSTALLER_BOOTLOADER: Configuring bootloader")
configure_system(mount_root, parts) configure_system(mount_root, parts)
logger.info("INSTALLER_GRUB_COMPLETE: Bootloader configured") logger.info("INSTALLER_BOOTLOADER_COMPLETE: Bootloader configured")
print("Installation complete! You can now reboot.") print("Installation complete! You can now reboot.")
logger.info( logger.info(

View File

@@ -106,7 +106,7 @@ def calculate_auto_partitions(disk_device):
"type": "partition", "type": "partition",
"name": "EFI System", "name": "EFI System",
"filesystem": "vfat", "filesystem": "vfat",
"mount_point": "/boot/efi", "mount_point": "/boot",
"size": f"{efi_size / (1024**3):.1f} GB", "size": f"{efi_size / (1024**3):.1f} GB",
"bytes": efi_size, "bytes": efi_size,
"style_class": "part-efi", "style_class": "part-efi",
@@ -496,7 +496,7 @@ class PartitioningPage(Adw.Bin):
) )
win.set_content(box) win.set_content(box)
options = ["/", "/boot/efi", "[SWAP]", "None"] options = ["/", "/boot", "[SWAP]", "None"]
dropdown = Gtk.DropDown.new_from_strings(options) dropdown = Gtk.DropDown.new_from_strings(options)
current_mp = data.get("mount_point") current_mp = data.get("mount_point")