MCPcopy Index your code
hub / github.com/archlinux/archinstall / add_bootloader

Method add_bootloader

archinstall/lib/installer.py:1834–1907  ·  view source on GitHub ↗

Adds a bootloader to the installation instance. Archinstall supports one of five types: * systemd-bootctl * grub * limine * efistub (beta) * refnd (beta) :param bootloader: Type of bootloader to be added :param uki_enabled: Whether to use unified kernel images :param bootloader

(
		self, bootloader: Bootloader, uki_enabled: bool = False, bootloader_removable: bool = False, plymouth: PlymouthTheme | None = None
	)

Source from the content-addressed store, hash-verified

1832 error('Error generating initramfs (continuing anyway)')
1833
1834 def add_bootloader(
1835 self, bootloader: Bootloader, uki_enabled: bool = False, bootloader_removable: bool = False, plymouth: PlymouthTheme | None = None
1836 ) -> None:
1837 """
1838 Adds a bootloader to the installation instance.
1839 Archinstall supports one of five types:
1840 * systemd-bootctl
1841 * grub
1842 * limine
1843 * efistub (beta)
1844 * refnd (beta)
1845
1846 :param bootloader: Type of bootloader to be added
1847 :param uki_enabled: Whether to use unified kernel images
1848 :param bootloader_removable: Whether to install to removable media location (UEFI only, for GRUB and Limine)
1849 :param plymouth: Optional Plymouth theme to install and configure
1850 """
1851
1852 for plugin in plugins.values():
1853 if hasattr(plugin, 'on_add_bootloader'):
1854 # Allow plugins to override the boot-loader handling.
1855 # This allows for boot configuring and installing bootloaders.
1856 if plugin.on_add_bootloader(self):
1857 return
1858
1859 efi_partition = self._get_efi_partition()
1860 boot_partition = self._get_boot_partition()
1861 root = self._get_root()
1862
1863 if boot_partition is None:
1864 raise ValueError(f'Could not detect boot at mountpoint {self.target}')
1865
1866 if root is None:
1867 raise ValueError(f'Could not detect root at mountpoint {self.target}')
1868
1869 info(f'Adding bootloader {bootloader.value} to {boot_partition.dev_path}')
1870
1871 # validate UKI support
1872 if uki_enabled and not bootloader.has_uki_support():
1873 warn(f'Bootloader {bootloader.value} does not support UKI; disabling.')
1874 uki_enabled = False
1875
1876 # validate removable bootloader option
1877 if bootloader_removable:
1878 if not SysInfo.has_uefi():
1879 warn('Removable install requested but system is not UEFI; disabling.')
1880 bootloader_removable = False
1881 elif not bootloader.has_removable_support():
1882 warn(f'Bootloader {bootloader.value} lacks removable support; disabling.')
1883 bootloader_removable = False
1884
1885 if plymouth is not None:
1886 self._install_plymouth(plymouth)
1887
1888 if uki_enabled:
1889 keep_initramfs = (
1890 bootloader == Bootloader.Grub
1891 and self._disk_config.has_default_btrfs_vols()

Callers 4

perform_installationFunction · 0.80
perform_installationFunction · 0.80
perform_installationFunction · 0.80
perform_installationFunction · 0.80

Calls 15

_get_efi_partitionMethod · 0.95
_get_boot_partitionMethod · 0.95
_get_rootMethod · 0.95
_install_plymouthMethod · 0.95
_config_ukiMethod · 0.95
_add_grub_bootloaderMethod · 0.95
infoFunction · 0.90
warnFunction · 0.90

Tested by

no test coverage detected