Exemple #1
0
 def new(source_dir):
     name_map = {'xorriso': 'XorrIso', 'cdrtools': 'CdrTools'}
     runtime_config = RuntimeConfig()
     tool = runtime_config.get_iso_tool_category()
     try:
         iso_tool = importlib.import_module(
             'kiwi.iso_tools.{}'.format(tool))
         module_name = 'IsoTools{}'.format(name_map[tool])
         return iso_tool.__dict__[module_name](source_dir)
     except Exception:
         raise KiwiIsoToolError(
             'No support for {} tool available'.format(tool))
Exemple #2
0
    def init_iso_creation_parameters(self, custom_args=None):
        """
        Create a set of standard parameters

        :param list custom_args: custom ISO meta data
        """
        if custom_args:
            if 'mbr_id' in custom_args:
                self.iso_parameters += [
                    '-application_id', custom_args['mbr_id']
                ]
            if 'publisher' in custom_args:
                self.iso_parameters += [
                    '-publisher', custom_args['publisher']
                ]
            if 'preparer' in custom_args:
                self.iso_parameters += [
                    '-preparer_id', custom_args['preparer']
                ]
            if 'volume_id' in custom_args:
                self.iso_parameters += [
                    '-volid', custom_args['volume_id']
                ]
        catalog_file = self.boot_path + '/boot.catalog'
        self.iso_parameters += [
            '-joliet', 'on', '-padding', '0'
        ]
        loader_file = self.boot_path + '/loader/isolinux.bin'

        syslinux_lookup_paths = [
            '/usr/share/syslinux', '/usr/lib/syslinux/modules/bios',
            '/usr/lib/ISOLINUX'
        ]
        mbr_file = Path.which('isohdpfx.bin', syslinux_lookup_paths)
        if not mbr_file:
            raise KiwiIsoToolError(
                'isohdpfx.bin not found in {0}'.format(syslinux_lookup_paths)
            )

        self.iso_loaders += [
            '-boot_image', 'any', 'partition_offset=16',
            '-boot_image', 'isolinux', 'bin_path={0}'.format(loader_file),
            '-boot_image', 'isolinux', 'system_area={0}'.format(mbr_file),
            '-boot_image', 'isolinux', 'partition_table=on',
            '-boot_image', 'any', 'cat_path={0}'.format(catalog_file),
            '-boot_image', 'any', 'cat_hidden=on',
            '-boot_image', 'any', 'boot_info_table=on',
            '-boot_image', 'any', 'platform_id=0x00',
            '-boot_image', 'any', 'emul_type=no_emulation',
            '-boot_image', 'any', 'load_size=2048'
        ]
Exemple #3
0
    def get_tool_name(self):
        """
        Lookup xorriso in search path

        :raises KiwiIsoToolError: if xorriso tool is not found
        :return: xorriso tool path

        :rtype: str
        """
        xorriso = Path.which('xorriso')
        if xorriso:
            return xorriso

        raise KiwiIsoToolError('xorriso tool not found')
Exemple #4
0
    def _find_iso_creation_tool(self):
        """
        There are tools by J.Schilling and tools from the community
        Depending on what is installed a decision needs to be made
        """
        iso_creation_tools = ['mkisofs', 'genisoimage']
        for tool in iso_creation_tools:
            tool_found = Path.which(tool)
            if tool_found:
                return tool_found

        raise KiwiIsoToolError(
            'No iso creation tool found, searched for: %s' %
            iso_creation_tools
        )
Exemple #5
0
    def _get_isoinfo_tool(self):
        """
        There are tools by J.Schilling and tools from the community
        This method searches in all paths which could provide an
        isoinfo tool. The first match makes the decision

        :raises KiwiIsoToolError: if no isoinfo tool found
        :return: the isoinfo tool to use

        :rtype: str
        """
        alternative_lookup_paths = ['/usr/lib/genisoimage']
        isoinfo = Path.which('isoinfo', alternative_lookup_paths)
        if isoinfo:
            return isoinfo

        raise KiwiIsoToolError(
            'No isoinfo tool found, searched in PATH: %s and %s' %
            (os.environ.get('PATH'), alternative_lookup_paths))
Exemple #6
0
    def get_tool_name(self):
        """
        There are tools by J.Schilling and tools from the community
        Depending on what is installed a decision needs to be made.
        mkisofs is preferred over genisoimage

        :raises KiwiIsoToolError: if no iso creation tool is found
        :return: tool name

        :rtype: str
        """
        iso_creation_tools = ['mkisofs', 'genisoimage']
        for tool in iso_creation_tools:
            tool_found = Path.which(tool)
            if tool_found:
                return tool_found

        raise KiwiIsoToolError(
            'No iso creation tool found, searched for: %s'.format(
                iso_creation_tools))