Added check if UDF extension is needed or not
This commit is contained in:
parent
cbced042c5
commit
6305dfc1ff
@ -100,7 +100,7 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase):
|
||||
Create the grub.cfg in memory from a template suitable to boot
|
||||
from a disk image
|
||||
"""
|
||||
log.info('Creating config file from template')
|
||||
log.info('Creating grub config file from template')
|
||||
parameters = {
|
||||
'search_params': '--fs-uuid --set=root ' + uuid,
|
||||
'default_boot': '0',
|
||||
@ -139,7 +139,7 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase):
|
||||
Create the grub.cfg in memory from a template suitable to boot
|
||||
from an ISO image in EFI boot mode
|
||||
"""
|
||||
log.info('Creating install config file from template')
|
||||
log.info('Creating grub install config file from template')
|
||||
parameters = {
|
||||
'search_params': '--file --set=root /boot/' + mbrid.get_id(),
|
||||
'default_boot': '0',
|
||||
@ -179,7 +179,7 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase):
|
||||
Create the grub.cfg in memory from a template suitable to boot
|
||||
a live system from an ISO image in EFI boot mode
|
||||
"""
|
||||
log.info('Creating live ISO config file from template')
|
||||
log.info('Creating grub live ISO config file from template')
|
||||
parameters = {
|
||||
'search_params': '--file --set=root /boot/' + mbrid.get_id(),
|
||||
'default_boot': '0',
|
||||
|
||||
@ -89,7 +89,7 @@ class BootLoaderConfigIsoLinux(BootLoaderConfigBase):
|
||||
# mbrid parameter is not used, the information is placed as the
|
||||
# application id when creating the iso filesystem. Thus not part
|
||||
# of the configuration file
|
||||
log.info('Creating install config file from template')
|
||||
log.info('Creating isolinux install config file from template')
|
||||
parameters = {
|
||||
'default_boot': 'Boot_from_Hard_Disk',
|
||||
'kernel_file': kernel,
|
||||
@ -130,7 +130,7 @@ class BootLoaderConfigIsoLinux(BootLoaderConfigBase):
|
||||
# mbrid parameter is not used, the information is placed as the
|
||||
# application id when creating the iso filesystem. Thus not part
|
||||
# of the configuration file
|
||||
log.info('Creating live ISO config file from template')
|
||||
log.info('Creating isolinux live ISO config file from template')
|
||||
parameters = {
|
||||
'default_boot': self.get_menu_entry_title(plain=True),
|
||||
'kernel_file': kernel,
|
||||
|
||||
@ -23,6 +23,7 @@ from bootloader_config import BootLoaderConfig
|
||||
from filesystem_squashfs import FileSystemSquashFs
|
||||
from filesystem_isofs import FileSystemIsoFs
|
||||
from internal_boot_image_task import BootImageTask
|
||||
from system_size import SystemSize
|
||||
from firmware import FirmWare
|
||||
from defaults import Defaults
|
||||
from path import Path
|
||||
@ -89,15 +90,19 @@ class LiveImageBuilder(object):
|
||||
self.media_dir = mkdtemp(
|
||||
prefix='live-media.', dir=self.target_dir
|
||||
)
|
||||
rootsize = SystemSize(self.media_dir)
|
||||
|
||||
# custom iso metadata
|
||||
log.info('Using following live ISO metadata:')
|
||||
log.info('--> Application id: %s', self.mbrid.get_id())
|
||||
log.info('--> Publisher: %s', Defaults.get_publisher())
|
||||
custom_iso_args = [
|
||||
'-A', self.mbrid.get_id(),
|
||||
'-allow-limited-size', '-udf',
|
||||
'-p', '"' + Defaults.get_preparer() + '"',
|
||||
'-publisher', '"' + Defaults.get_publisher() + '"',
|
||||
]
|
||||
if self.volume_id:
|
||||
log.info('--> Volume id: %s', self.volume_id)
|
||||
custom_iso_args.append('-V')
|
||||
custom_iso_args.append('"' + self.volume_id + '"')
|
||||
|
||||
@ -114,18 +119,18 @@ class LiveImageBuilder(object):
|
||||
Command.run(
|
||||
['mv', self.live_image_file, self.media_dir]
|
||||
)
|
||||
# TODO: create config.isoclient
|
||||
# Example:
|
||||
# IMAGE='/dev/ram1;LimeJeOS-openSUSE-13.2.x86_64;1.13.2'
|
||||
# UNIONFS_CONFIG='/dev/ram1,loop,clicfs'
|
||||
else:
|
||||
raise KiwiLiveBootImageError(
|
||||
'live ISO type "%s" not supported, supported are %s' %
|
||||
(self.live_type, Defaults.get_live_iso_types())
|
||||
)
|
||||
|
||||
# TODO: create config.isoclient
|
||||
|
||||
# TODO: create liveboot
|
||||
|
||||
# setup bootloader config to boot the ISO via isolinux
|
||||
log.info('Setting up live iso bootloader configuration')
|
||||
log.info('Setting up isolinux bootloader configuration')
|
||||
bootloader_config_isolinux = BootLoaderConfig(
|
||||
'isolinux', self.xml_state, self.media_dir
|
||||
)
|
||||
@ -140,6 +145,7 @@ class LiveImageBuilder(object):
|
||||
|
||||
# setup bootloader config to boot the ISO via EFI
|
||||
if self.firmware.efi_mode():
|
||||
log.info('Setting up EFI grub bootloader configuration')
|
||||
bootloader_config_grub = BootLoaderConfig(
|
||||
'grub2', self.xml_state, self.media_dir
|
||||
)
|
||||
@ -156,6 +162,12 @@ class LiveImageBuilder(object):
|
||||
log.info('Creating live ISO boot image')
|
||||
self.__create_live_iso_kernel_and_initrd()
|
||||
|
||||
# calculate size and decide if we need UDF
|
||||
if rootsize.accumulate_mbyte_file_sizes() > 4096:
|
||||
log.info('ISO exceeds 4G size, using UDF filesystem')
|
||||
custom_iso_args.append('-allow-limited-size')
|
||||
custom_iso_args.append('-udf')
|
||||
|
||||
# create iso filesystem from media_dir
|
||||
log.info('Creating live ISO image')
|
||||
iso_image = FileSystemIsoFs(
|
||||
|
||||
@ -74,8 +74,9 @@ class TestLiveImageBuilder(object):
|
||||
@patch('kiwi.live_image_builder.FileSystemSquashFs')
|
||||
@patch('kiwi.live_image_builder.FileSystemIsoFs')
|
||||
@patch('kiwi.live_image_builder.BootLoaderConfig')
|
||||
@patch('kiwi.live_image_builder.SystemSize')
|
||||
def test_create_overlay_structure(
|
||||
self, mock_bootloader, mock_isofs, mock_squashfs,
|
||||
self, mock_size, mock_bootloader, mock_isofs, mock_squashfs,
|
||||
mock_hybrid, mock_command, mock_dtemp
|
||||
):
|
||||
tmpdir_name = ['temp-squashfs', 'temp_media_dir']
|
||||
@ -92,6 +93,11 @@ class TestLiveImageBuilder(object):
|
||||
iso_image = mock.Mock()
|
||||
iso_image.create_on_file.return_value = 'offset'
|
||||
mock_isofs.return_value = iso_image
|
||||
rootsize = mock.Mock()
|
||||
rootsize.accumulate_mbyte_file_sizes = mock.Mock(
|
||||
return_value=8192
|
||||
)
|
||||
mock_size.return_value = rootsize
|
||||
|
||||
self.live_image.create()
|
||||
|
||||
@ -144,13 +150,17 @@ class TestLiveImageBuilder(object):
|
||||
assert mock_command.call_args_list[1] == call(
|
||||
['mv', 'initrd', 'temp_media_dir/boot/x86_64/loader/initrd']
|
||||
)
|
||||
mock_size.assert_called_once_with(
|
||||
'temp_media_dir'
|
||||
)
|
||||
rootsize.accumulate_mbyte_file_sizes.assert_called_once_with()
|
||||
mock_isofs.assert_called_once_with(
|
||||
custom_args=[
|
||||
'-A', '0xffffffff',
|
||||
'-allow-limited-size',
|
||||
'-udf', '-p', '"KIWI - http://suse.github.com/kiwi"',
|
||||
'-p', '"KIWI - http://suse.github.com/kiwi"',
|
||||
'-publisher', '"SUSE LINUX GmbH"',
|
||||
'-V', '"volid"'
|
||||
'-V', '"volid"',
|
||||
'-allow-limited-size', '-udf'
|
||||
], device_provider=None, source_dir='temp_media_dir'
|
||||
)
|
||||
iso_image.create_on_file.assert_called_once_with(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user