.
This commit is contained in:
@@ -229,7 +229,7 @@ def mount_partitions(partition_info, mount_root="/mnt"):
|
||||
run_command(["mount", partition_info["root"], mount_root])
|
||||
|
||||
# 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):
|
||||
os.makedirs(efi_mount, exist_ok=True)
|
||||
|
||||
|
||||
@@ -112,8 +112,6 @@ def install_minimal_os(mount_root, releasever="43"):
|
||||
"kernel",
|
||||
"systemd",
|
||||
"dnf",
|
||||
"grub2-efi-x64",
|
||||
"shim-x64",
|
||||
"efibootmgr",
|
||||
"passwd",
|
||||
"rootfiles",
|
||||
@@ -140,7 +138,7 @@ def install_minimal_os(mount_root, releasever="43"):
|
||||
|
||||
def configure_system(mount_root, partition_info):
|
||||
"""
|
||||
Basic configuration: fstab and grub.
|
||||
Basic configuration: fstab and systemd-boot.
|
||||
"""
|
||||
logger.info("Configuring system...")
|
||||
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"""
|
||||
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}
|
||||
"""
|
||||
os.makedirs(os.path.join(mount_root, "etc"), exist_ok=True)
|
||||
with open(os.path.join(mount_root, "etc/fstab"), "w") as f:
|
||||
f.write(fstab_content)
|
||||
|
||||
# 2. Configure GRUB
|
||||
# 2. Configure systemd-boot
|
||||
with mount_pseudo_fs(mount_root):
|
||||
# grub2-mkconfig -o /boot/grub2/grub.cfg
|
||||
chroot_cmd = [
|
||||
"chroot",
|
||||
mount_root,
|
||||
"grub2-mkconfig",
|
||||
"-o",
|
||||
"/boot/grub2/grub.cfg",
|
||||
]
|
||||
run_command(chroot_cmd)
|
||||
# Ensure machine-id exists for kernel-install
|
||||
if not os.path.exists(os.path.join(mount_root, "etc/machine-id")):
|
||||
run_command(["chroot", mount_root, "systemd-machine-id-setup"])
|
||||
|
||||
# Set kernel command line
|
||||
os.makedirs(os.path.join(mount_root, "etc/kernel"), exist_ok=True)
|
||||
with open(os.path.join(mount_root, "etc/kernel/cmdline"), "w") as f:
|
||||
f.write(f"root=UUID={root_uuid} rw quiet\n")
|
||||
|
||||
# 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.")
|
||||
log_os_install("CONFIGURE", "complete", "GRUB configured successfully")
|
||||
log_os_install("CONFIGURE", "complete", "systemd-boot configured successfully")
|
||||
|
||||
@@ -56,9 +56,9 @@ def main():
|
||||
logger.info("INSTALLER_OS_INSTALL_COMPLETE: OS installed successfully")
|
||||
|
||||
print("Step 4: Configuring Bootloader...")
|
||||
logger.info("INSTALLER_GRUB: Configuring GRUB bootloader")
|
||||
logger.info("INSTALLER_BOOTLOADER: Configuring bootloader")
|
||||
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.")
|
||||
logger.info(
|
||||
|
||||
@@ -106,7 +106,7 @@ def calculate_auto_partitions(disk_device):
|
||||
"type": "partition",
|
||||
"name": "EFI System",
|
||||
"filesystem": "vfat",
|
||||
"mount_point": "/boot/efi",
|
||||
"mount_point": "/boot",
|
||||
"size": f"{efi_size / (1024**3):.1f} GB",
|
||||
"bytes": efi_size,
|
||||
"style_class": "part-efi",
|
||||
@@ -496,7 +496,7 @@ class PartitioningPage(Adw.Bin):
|
||||
)
|
||||
win.set_content(box)
|
||||
|
||||
options = ["/", "/boot/efi", "[SWAP]", "None"]
|
||||
options = ["/", "/boot", "[SWAP]", "None"]
|
||||
dropdown = Gtk.DropDown.new_from_strings(options)
|
||||
|
||||
current_mp = data.get("mount_point")
|
||||
|
||||
Reference in New Issue
Block a user