Example #1
0
 def check_for_grub(self):
     """Check for grub multiboot boot loader and install its required packages if needed."""
     if sysfs_info.has_efi():
         _required_packages = ['shim-signed', 'grub-efi-amd64-signed']
         if self.install_packages(_required_packages):
             raise GeneralPostTargetError(
                 'Error installing required packages for grub2')
Example #2
0
    def check_for_grub(self):
        _required_packages = ['grub', 'grubby']
        if sysfs_info.has_efi():
            os_id, os_label = self.get_efi_label()
            self.grub_efi_bootloader_name = os_label

        if not self.packages_exist(_required_packages):
            if not self.install_packages(_required_packages):
                raise GeneralPostTargetError(
                    'Error installing required packages for grub')
Example #3
0
 def netplan_or_ifupdown(self):
     if self.install_packages(['netplan.io', 'ifupdown']):
         raise GeneralPostTargetError(
             'Error installing required network packages.')
     if self.use_netplan:
         log.info("Using Netplan network configuration")
         self.interfaces_path = self.netplan_interfaces_path
         self.ensure_netplan_enabled()
     else:
         log.info("Using ifupdown network configuration")
         self.interfaces_path = self.ifupdown_interfaces_path
         self.ensure_ifupdown_enabled()
Example #4
0
    def rebuild_initramfs(self):
        _required_packages = ['dracut', 'dracut-kernel']
        if not self.packages_exist(_required_packages):
            if not self.install_package(_required_packages):
                raise GeneralPostTargetError(
                    'Error install required packages for dracut')

        kernels = os.listdir(self.join_root('/lib/modules'))
        for kernel in kernels:
            initramfs_path = '/boot/initramfs-%s.img' % kernel
            if os.path.exists(self.join_root(initramfs_path)):
                log.info('Rebuilding %s' % initramfs_path)
                self.chroot('dracut -v -f %s %s' % (initramfs_path, kernel))
Example #5
0
 def check_for_grub(self):
     _required_packages = ['grub2', 'grub2-tools']
     if sysfs_info.has_efi():
         os_id, os_label = self.get_efi_label()
         _required_packages += ['grub2-efi', 'efibootmgr', 'shim']
         self.grub2_config_path = '/boot/efi/EFI/{}/grub.cfg'.format(os_id)
         self.grub2_efi_command = ('efibootmgr --create --gpt '
                                   '--disk {} --part 1 --write-signature '
                                   '--label "{}" '
                                   '--loader /EFI/{}/shim.efi'.format(
                                       self.disk_target, os_label, os_id))
     if not self.packages_exist(_required_packages):
         self.baseline_yum(self.proxy)
         if self.install_packages(_required_packages):
             raise GeneralPostTargetError(
                 'Error installing required packages for grub2')
         self.revert_yum(self.proxy)
Example #6
0
 def check_for_grub(self):
     if sysfs_info.has_efi():
         _required_packages = ['shim', 'grub-efi-amd64']
         if self.install_packages(_required_packages):
             raise GeneralPostTargetError(
                 'Error installing required packages for grub2')
Example #7
0
 def install_hwe_kernel(self):
     """16.04 needs HWE kernel for Dell 14 Gen and HPE Gen10 chassis"""
     if any(x in self.get_product_name() for x in ['R740', 'R840', 'Gen10']):
         _hwe_kernel = ['linux-generic-hwe-16.04']
         if self.install_packages(_hwe_kernel):
             raise GeneralPostTargetError('Error installing HWE kernel')