本文整理汇总了Python中kiwi.defaults.Defaults.get_grub_bios_modules方法的典型用法代码示例。如果您正苦于以下问题:Python Defaults.get_grub_bios_modules方法的具体用法?Python Defaults.get_grub_bios_modules怎么用?Python Defaults.get_grub_bios_modules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kiwi.defaults.Defaults
的用法示例。
在下文中一共展示了Defaults.get_grub_bios_modules方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_install
# 需要导入模块: from kiwi.defaults import Defaults [as 别名]
# 或者: from kiwi.defaults.Defaults import get_grub_bios_modules [as 别名]
def test_install(self, mock_grub_path, mock_mount_manager, mock_command):
mock_grub_path.return_value = \
self.root_mount.mountpoint + '/usr/lib/grub2'
self.boot_mount.device = self.root_mount.device
def side_effect(device, mountpoint=None):
return self.mount_managers.pop()
mock_mount_manager.side_effect = side_effect
self.bootloader.install()
self.root_mount.mount.assert_called_once_with()
self.volume_mount.mount.assert_called_once_with(
options=['[email protected]/boot/grub2']
)
mock_command.assert_called_once_with(
[
'chroot', 'tmp_root', 'grub2-install', '--skip-fs-probe',
'--directory', '/usr/lib/grub2/i386-pc',
'--boot-directory', '/boot',
'--target', 'i386-pc',
'--modules', ' '.join(
Defaults.get_grub_bios_modules(multiboot=True)
),
'/dev/some-device'
])
示例2: test_install_secure_boot
# 需要导入模块: from kiwi.defaults import Defaults [as 别名]
# 或者: from kiwi.defaults.Defaults import get_grub_bios_modules [as 别名]
def test_install_secure_boot(
self, mock_access, mock_exists, mock_glob, mock_grub_path,
mock_mount_manager, mock_command, mock_which, mock_wipe
):
mock_access.return_value = True
mock_exists.return_value = True
mock_glob.return_value = ['tmp_root/boot/grub2/grubenv']
mock_grub_path.return_value = \
self.root_mount.mountpoint + '/usr/lib/grub2'
self.firmware.efi_mode.return_value = 'uefi'
self.boot_mount.device = self.root_mount.device
def side_effect(device, mountpoint=None):
return self.mount_managers.pop()
mock_mount_manager.side_effect = side_effect
self.bootloader.install()
mock_wipe.assert_called_once_with(
'tmp_root/boot/grub2/grubenv'
)
assert mock_command.call_args_list == [
call([
'chroot', 'tmp_root', 'grub2-install', '--skip-fs-probe',
'--directory', '/usr/lib/grub2/i386-pc',
'--boot-directory', '/boot',
'--target', 'i386-pc',
'--modules', ' '.join(
Defaults.get_grub_bios_modules(multiboot=True)
),
'/dev/some-device'
]),
call([
'cp', '-p', 'tmp_root/usr/sbin/grub2-install',
'tmp_root/usr/sbin/grub2-install.orig'
]),
call([
'cp', 'tmp_root/bin/true', 'tmp_root/usr/sbin/grub2-install'
]),
call([
'chroot', 'tmp_root', 'shim-install', '--removable',
'/dev/some-device'
]),
call([
'cp', '-p', 'tmp_root/usr/sbin/grub2-install.orig',
'tmp_root/usr/sbin/grub2-install'
])
]
self.device_mount.bind_mount.assert_called_once_with()
self.proc_mount.bind_mount.assert_called_once_with()
self.sysfs_mount.bind_mount.assert_called_once_with()
self.efi_mount.mount.assert_called_once_with()
示例3: test_install_with_extra_boot_partition
# 需要导入模块: from kiwi.defaults import Defaults [as 别名]
# 或者: from kiwi.defaults.Defaults import get_grub_bios_modules [as 别名]
def test_install_with_extra_boot_partition(
self, mock_glob, mock_grub_path, mock_mount_manager,
mock_command, mock_which, mock_wipe
):
mock_glob.return_value = ['tmp_root/boot/grub2/grubenv']
mock_grub_path.return_value = \
self.root_mount.mountpoint + '/usr/lib/grub2'
def side_effect(device, mountpoint=None):
return self.mount_managers.pop()
mock_mount_manager.side_effect = side_effect
self.bootloader.install()
self.bootloader.root_mount.mount.assert_called_once_with()
self.bootloader.boot_mount.mount.assert_called_once_with()
mock_glob.assert_called_once_with(
'tmp_root/boot/*/grubenv'
)
mock_wipe.assert_called_once_with(
'tmp_root/boot/grub2/grubenv'
)
mock_which.assert_called_once_with(
custom_env={'PATH': 'tmp_root/usr/sbin'}, filename='grub2-install'
)
mock_command.assert_called_once_with(
[
'chroot', 'tmp_root', 'grub2-install', '--skip-fs-probe',
'--directory', '/usr/lib/grub2/i386-pc',
'--boot-directory', '/boot',
'--target', 'i386-pc',
'--modules', ' '.join(
Defaults.get_grub_bios_modules(multiboot=True)
),
'/dev/some-device'
]
)
示例4: test_install_with_extra_boot_partition
# 需要导入模块: from kiwi.defaults import Defaults [as 别名]
# 或者: from kiwi.defaults.Defaults import get_grub_bios_modules [as 别名]
def test_install_with_extra_boot_partition(
self, mock_mount_manager, mock_command
):
def side_effect(device, mountpoint=None):
return self.mount_managers.pop()
mock_mount_manager.side_effect = side_effect
self.bootloader.install()
self.bootloader.root_mount.mount.assert_called_once_with()
self.bootloader.boot_mount.mount.assert_called_once_with()
mock_command.assert_called_once_with(
[
'grub2-install', '--skip-fs-probe',
'--directory', 'tmp_root/usr/lib/grub2/i386-pc',
'--boot-directory', 'tmp_boot',
'--target', 'i386-pc',
'--modules', ' '.join(
Defaults.get_grub_bios_modules(multiboot=True)
),
'/dev/some-device'
]
)
示例5: install
# 需要导入模块: from kiwi.defaults import Defaults [as 别名]
# 或者: from kiwi.defaults.Defaults import get_grub_bios_modules [as 别名]
def install(self):
"""
Install bootloader on disk device
"""
log.info('Installing grub2 on disk %s', self.device)
if self.target_removable:
self.install_arguments.append('--removable')
if self.arch == 'x86_64' or self.arch == 'i686' or self.arch == 'i586':
self.target = 'i386-pc'
self.install_device = self.device
self.modules = ' '.join(
Defaults.get_grub_bios_modules(multiboot=True)
)
self.install_arguments.append('--skip-fs-probe')
elif self.arch.startswith('ppc64'):
if not self.custom_args or 'prep_device' not in self.custom_args:
raise KiwiBootLoaderGrubInstallError(
'prep device name required for grub2 installation on ppc'
)
self.target = 'powerpc-ieee1275'
self.install_device = self.custom_args['prep_device']
self.modules = ' '.join(Defaults.get_grub_ofw_modules())
self.install_arguments.append('--skip-fs-probe')
self.install_arguments.append('--no-nvram')
else:
raise KiwiBootLoaderGrubPlatformError(
'host architecture %s not supported for grub2 installation' %
self.arch
)
self.root_mount = MountManager(
device=self.custom_args['root_device']
)
self.boot_mount = MountManager(
device=self.custom_args['boot_device'],
mountpoint=self.root_mount.mountpoint + '/boot'
)
self.root_mount.mount()
if not self.root_mount.device == self.boot_mount.device:
self.boot_mount.mount()
if self.volumes:
for volume_path in Path.sort_by_hierarchy(
sorted(self.volumes.keys())
):
volume_mount = MountManager(
device=self.volumes[volume_path]['volume_device'],
mountpoint=self.root_mount.mountpoint + '/' + volume_path
)
self.volumes_mount.append(volume_mount)
volume_mount.mount(
options=[self.volumes[volume_path]['volume_options']]
)
self.device_mount = MountManager(
device='/dev',
mountpoint=self.root_mount.mountpoint + '/dev'
)
self.proc_mount = MountManager(
device='/proc',
mountpoint=self.root_mount.mountpoint + '/proc'
)
self.sysfs_mount = MountManager(
device='/sys',
mountpoint=self.root_mount.mountpoint + '/sys'
)
self.device_mount.bind_mount()
self.proc_mount.bind_mount()
self.sysfs_mount.bind_mount()
# check if a grub installation could be found in the image system
grub_directory = Defaults.get_grub_path(
self.root_mount.mountpoint + '/usr/lib'
)
if not grub_directory:
raise KiwiBootLoaderGrubDataError(
'No grub2 installation found in %s' % self.root_mount.mountpoint
)
grub_directory = grub_directory.replace(
self.root_mount.mountpoint, ''
)
module_directory = grub_directory + '/' + self.target
boot_directory = '/boot'
# wipe existing grubenv to allow the grub installer to create a new one
grubenv_glob = os.sep.join(
[self.root_mount.mountpoint, 'boot', '*', 'grubenv']
)
for grubenv in glob.glob(grubenv_glob):
Path.wipe(grubenv)
# install grub2 boot code
Command.run(
[
'chroot', self.root_mount.mountpoint,
self._get_grub2_install_tool_name(self.root_mount.mountpoint)
#.........这里部分代码省略.........