Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions kiwi/bootloader/config/grub2.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,10 @@ def _supports_platform_modules(self):

def _setup_sysconfig_bootloader(self):
"""
Create or update etc/sysconfig/bootloader by the following
parameters required according to the grub2 bootloader setup
Create or update etc/sysconfig/bootloader for the following
parameters. Please note this file is consumed by perl-bootloader
only and marked for deletion with the next major release of
kiwi because not a mainline grub config file.

* LOADER_TYPE
* LOADER_LOCATION
Expand All @@ -640,6 +642,8 @@ def _setup_sysconfig_bootloader(self):
'LOADER_LOCATION':
'none' if self.firmware.efi_mode() else 'mbr'
}
if self.bls:
sysconfig_bootloader_entries['LOADER_TYPE'] = 'grub2-bls'
if '--set-trusted-boot' in self.config_options:
sysconfig_bootloader_entries['TRUSTED_BOOT'] = 'yes'
if self.firmware.efi_mode() == 'uefi':
Expand Down
16 changes: 16 additions & 0 deletions test/unit/bootloader/config/grub2_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,7 @@ def test_setup_sysconfig_bootloader(self, mock_sysconfig, mock_exists):
sysconfig_bootloader = MagicMock()
mock_sysconfig.return_value = sysconfig_bootloader
mock_exists.return_value = True
self.bootloader.bls = False
self.bootloader._setup_sysconfig_bootloader()
mock_sysconfig.assert_called_once_with(
'root_dir/etc/sysconfig/bootloader'
Expand Down Expand Up @@ -914,6 +915,7 @@ def test_setup_sysconfig_bootloader_no_secure(
sysconfig_bootloader = MagicMock()
mock_sysconfig.return_value = sysconfig_bootloader
mock_exists.return_value = True
self.bootloader.bls = False
self.bootloader._setup_sysconfig_bootloader()
mock_sysconfig.assert_called_once_with(
'root_dir/etc/sysconfig/bootloader'
Expand Down Expand Up @@ -945,6 +947,20 @@ def test_setup_sysconfig_bootloader_no_secure(
call('SECURE_BOOT', 'no'),
call('TRUSTED_BOOT', 'yes')
]
sysconfig_bootloader.__setitem__.reset_mock()
self.bootloader.bls = True
self.bootloader._setup_sysconfig_bootloader()
assert sysconfig_bootloader.__setitem__.call_args_list == [
call('DEFAULT_APPEND', '"some-cmdline root=UUID=foo"'),
call(
'FAILSAFE_APPEND',
'"some-cmdline root=UUID=foo failsafe-options"'
),
call('LOADER_LOCATION', 'none'),
call('LOADER_TYPE', 'grub2-bls'),
call('SECURE_BOOT', 'no'),
call('TRUSTED_BOOT', 'yes')
]

@patch('os.path.exists')
def test_setup_live_image_config_custom_template(self, mock_exists):
Expand Down