def _copy_first_boot_files_to_system_image(self): boot_names = self.boot_image.get_boot_names() if self.initrd_system == 'kiwi': log.info('Copy boot files to system image') kernel = Kernel(self.boot_image.boot_root_directory) log.info('--> boot image kernel as %s', boot_names.kernel_name) kernel.copy_kernel( self.root_dir, ''.join(['/boot/', boot_names.kernel_name]) ) if self.xen_server: if kernel.get_xen_hypervisor(): log.info('--> boot image Xen hypervisor as xen.gz') kernel.copy_xen_hypervisor( self.root_dir, '/boot/xen.gz' ) else: raise KiwiDiskBootImageError( 'No hypervisor in boot image tree %s found' % self.boot_image.boot_root_directory ) log.info('--> initrd archive as %s', boot_names.initrd_name) Command.run( [ 'mv', self.boot_image.initrd_filename, self.root_dir + ''.join(['/boot/', boot_names.initrd_name]) ] )
def get_boot_names(self): """ Provides kernel and initrd names for kiwi boot image :return: Contains boot_names_type tuple .. code:: python boot_names_type( kernel_name='INSTALLED_KERNEL', initrd_name='DRACUT_OUTPUT_NAME' ) :rtype: tuple """ boot_names_type = namedtuple('boot_names_type', ['kernel_name', 'initrd_name']) kernel = Kernel(self.boot_root_directory) kernel_info = kernel.get_kernel() if not kernel_info: raise KiwiDiskBootImageError( 'No kernel in boot image tree %s found' % self.boot_root_directory) dracut_output_format = self._get_dracut_output_file_format() return boot_names_type(kernel_name=kernel_info.name, initrd_name=dracut_output_format.format( kernel_version=kernel_info.version))
def get_boot_names(self) -> boot_names_type: """ Provides kernel and initrd names for the boot image :return: Contains boot_names_type tuple .. code:: python boot_names_type( kernel_name='INSTALLED_KERNEL', initrd_name='DRACUT_OUTPUT_NAME' ) :rtype: boot_names_type """ kernel = Kernel(self.boot_root_directory) kernel_info = kernel.get_kernel() if not kernel_info: if self.xml_state.get_initrd_system() == 'none': return boot_names_type(kernel_name='none', initrd_name='none') raise KiwiDiskBootImageError( 'No kernel in boot image tree %s found' % self.boot_root_directory) dracut_output_format = self._get_boot_image_output_file_format( kernel_info.version) return boot_names_type(kernel_name=kernel_info.name, initrd_name=dracut_output_format.format( kernel_version=kernel_info.version))
def _get_boot_names(self): boot_names_type = namedtuple( 'boot_names_type', ['kernel_name', 'initrd_name'] ) kernel = Kernel( self.boot_image.boot_root_directory ) kernel_info = kernel.get_kernel() if not kernel_info: raise KiwiDiskBootImageError( 'No kernel in boot image tree %s found' % self.boot_image.boot_root_directory ) if self.initrd_system and self.initrd_system == 'dracut': dracut_output_format = self._get_dracut_output_file_format() return boot_names_type( kernel_name=kernel_info.name, initrd_name=dracut_output_format.format( kernel_version=kernel_info.version ) ) else: return boot_names_type( kernel_name='linux.vmx', initrd_name='initrd.vmx' )
def get_boot_names(self): boot_names_type = namedtuple( 'boot_names_type', ['kernel_name', 'initrd_name'] ) kernel = Kernel( self.boot_root_directory ) kernel_info = kernel.get_kernel() if not kernel_info: raise KiwiDiskBootImageError( 'No kernel in boot image tree %s found' % self.boot_root_directory ) dracut_output_format = self._get_dracut_output_file_format() return boot_names_type( kernel_name=kernel_info.name, initrd_name=dracut_output_format.format( kernel_version=kernel_info.version ) )