Exemple #1
0
 def create(self, filename):
     exclude_list = [
         'image', '.profile', '.kconfig', 'var/cache/kiwi', 'boot'
     ]
     # replace potential suffix from filename because
     # it is added by the archive creation call
     archive = ArchiveTar(filename.replace('.xz', ''))
     archive.create_xz_compressed(source_dir=self.root_dir,
                                  exclude=exclude_list)
 def create(self, filename):
     exclude_list = [
         'image', '.profile', '.kconfig', 'var/cache/kiwi', 'boot'
     ]
     # replace potential suffix from filename because
     # it is added by the archive creation call
     archive = ArchiveTar(
         filename.replace('.xz', '')
     )
     archive.create_xz_compressed(
         source_dir=self.root_dir, exclude=exclude_list
     )
Exemple #3
0
    def create(self):
        supported_archives = Defaults.get_archive_image_types()
        if self.requested_archive_type not in supported_archives:
            raise KiwiArchiveSetupError('Unknown archive type: %s' %
                                        self.requested_archive_type)

        if self.requested_archive_type == 'tbz':
            log.info('Creating XZ compressed tar archive')
            archive = ArchiveTar(self.__target_file_for('tar'))
            archive.create_xz_compressed(self.root_dir)
            checksum = Checksum(self.filename)
            log.info('--> Creating archive checksum')
            checksum.md5(self.checksum)
            self.result.add('root_archive', self.filename)
            self.result.add('root_archive_checksum', self.checksum)
        return self.result
Exemple #4
0
    def create_install_pxe_archive(self):
        """
            Create an oem install tar archive suitable for installing a
            disk image via the network using the PXE boot protocol.
            The archive contains the raw disk image and its checksum
            as well as an install initrd and kernel plus the required
            kernel commandline information which needs to be added
            as append line in the pxelinux config file on the boot
            server
        """
        self.pxe_dir = mkdtemp(prefix="pxe-install-media.", dir=self.target_dir)
        # the system image is transfered as xz compressed variant
        log.info("xz compressing disk image")
        pxe_image_filename = "".join([self.pxe_dir, "/", self.xml_state.xml_data.get_name(), ".xz"])
        compress = Compress(source_filename=self.diskname, keep_source_on_compress=True)
        compress.xz()
        Command.run(["mv", compress.compressed_filename, pxe_image_filename])

        # the system image transfer is checked against a checksum
        log.info("Creating disk image checksum")
        pxe_md5_filename = "".join([self.pxe_dir, "/", self.xml_state.xml_data.get_name(), ".md5"])
        checksum = Checksum(pxe_image_filename)
        checksum.md5(pxe_md5_filename)

        # create pxe config append information
        # this information helps to configure the boot server correctly
        append_filename = "".join([self.pxe_dir, "/", self.xml_state.xml_data.get_name(), ".append"])
        cmdline = "pxe=1"
        custom_cmdline = self.xml_state.build_type.get_kernelcmdline()
        if custom_cmdline:
            cmdline += " " + custom_cmdline
        with open(append_filename, "w") as append:
            append.write("%s\n" % cmdline)

        # create initrd for pxe install
        log.info("Creating pxe install boot image")
        self.__create_pxe_install_kernel_and_initrd()

        # create pxe install tarball
        log.info("Creating pxe install archive")
        archive = ArchiveTar(self.pxename.replace(".xz", ""))
        archive.create_xz_compressed(self.pxe_dir)
Exemple #5
0
    def create(self):
        supported_archives = Defaults.get_archive_image_types()
        if self.requested_archive_type not in supported_archives:
            raise KiwiArchiveSetupError(
                'Unknown archive type: %s' % self.requested_archive_type
            )

        if self.requested_archive_type == 'tbz':
            log.info('Creating XZ compressed tar archive')
            archive = ArchiveTar(
                self.__target_file_for('tar')
            )
            archive.create_xz_compressed(self.root_dir)
            checksum = Checksum(self.filename)
            log.info('--> Creating archive checksum')
            checksum.md5(self.checksum)
            self.result.add(
                'root_archive', self.filename
            )
            self.result.add(
                'root_archive_checksum', self.checksum
            )
        return self.result
Exemple #6
0
    def create_install_pxe_archive(self):
        """
            Create an oem install tar archive suitable for installing a
            disk image via the network using the PXE boot protocol.
            The archive contains the raw disk image and its checksum
            as well as an install initrd and kernel plus the required
            kernel commandline information which needs to be added
            as append line in the pxelinux config file on the boot
            server
        """
        self.pxe_dir = mkdtemp(
            prefix='pxe-install-media.', dir=self.target_dir
        )
        # the system image is transfered as xz compressed variant
        log.info('xz compressing disk image')
        pxe_image_filename = ''.join(
            [
                self.pxe_dir, '/',
                self.xml_state.xml_data.get_name(), '.xz'
            ]
        )
        compress = Compress(
            source_filename=self.diskname,
            keep_source_on_compress=True
        )
        compress.xz()
        Command.run(
            ['mv', compress.compressed_filename, pxe_image_filename]
        )

        # the system image transfer is checked against a checksum
        log.info('Creating disk image checksum')
        pxe_md5_filename = ''.join(
            [
                self.pxe_dir, '/',
                self.xml_state.xml_data.get_name(), '.md5'
            ]
        )
        checksum = Checksum(pxe_image_filename)
        checksum.md5(pxe_md5_filename)

        # create pxe config append information
        # this information helps to configure the boot server correctly
        append_filename = ''.join(
            [
                self.pxe_dir, '/',
                self.xml_state.xml_data.get_name(), '.append'
            ]
        )
        cmdline = 'pxe=1'
        custom_cmdline = self.xml_state.build_type.get_kernelcmdline()
        if custom_cmdline:
            cmdline += ' ' + custom_cmdline
        with open(append_filename, 'w') as append:
            append.write('%s\n' % cmdline)

        # create initrd for pxe install
        log.info('Creating pxe install boot image')
        self.__create_pxe_install_kernel_and_initrd()

        # create pxe install tarball
        log.info('Creating pxe install archive')
        archive = ArchiveTar(
            self.pxename.replace('.xz', '')
        )
        archive.create_xz_compressed(
            self.pxe_dir
        )