From 07d0760dc43ff7a84e44f70e54380892cecb3c1e Mon Sep 17 00:00:00 2001 From: Softer Date: Tue, 5 May 2026 03:00:27 +0300 Subject: [PATCH] Move keep_initramfs logic into add_bootloader() The grub-btrfs snapshot detection was in guided.py, forcing custom script authors to replicate it. Since Installer already holds disk_config, the check belongs inside add_bootloader(). --- archinstall/lib/installer.py | 7 ++++++- archinstall/scripts/guided.py | 11 ----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 6e3adb4e..801eaee2 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -1806,7 +1806,6 @@ class Installer: bootloader: Bootloader, uki_enabled: bool = False, bootloader_removable: bool = False, - keep_initramfs: bool = False, ) -> None: """ Adds a bootloader to the installation instance. @@ -1856,6 +1855,12 @@ class Installer: bootloader_removable = False if uki_enabled: + keep_initramfs = ( + bootloader == Bootloader.Grub + and self._disk_config.has_default_btrfs_vols() + and self._disk_config.btrfs_options is not None + and self._disk_config.btrfs_options.snapshot_config is not None + ) self._config_uki(root, efi_partition, keep_initramfs) match bootloader: diff --git a/archinstall/scripts/guided.py b/archinstall/scripts/guided.py index 1ac7dd3f..dd3a2b23 100644 --- a/archinstall/scripts/guided.py +++ b/archinstall/scripts/guided.py @@ -115,21 +115,10 @@ def perform_installation( installation.setup_swap(algo=config.swap.algorithm) if config.bootloader_config and config.bootloader_config.bootloader != Bootloader.NO_BOOTLOADER: - keep_initramfs = False - if ( - config.bootloader_config.uki - and config.bootloader_config.bootloader == Bootloader.Grub - and disk_config.has_default_btrfs_vols() - and disk_config.btrfs_options - and disk_config.btrfs_options.snapshot_config - ): - keep_initramfs = True - installation.add_bootloader( config.bootloader_config.bootloader, config.bootloader_config.uki, config.bootloader_config.removable, - keep_initramfs, ) if config.network_config: