Exception: Bootloader::ProposalClient::MismatchBootloader

Inherits:
RuntimeError
  • Object
show all
Includes:
Yast::I18n
Defined in:
src/lib/bootloader/proposal_client.rb

Overview

Error when during update media is booted by different technology than target system.

Instance Method Summary collapse

Constructor Details

#initialize(old_bootloader, new_bootloader) ⇒ MismatchBootloader

Returns a new instance of MismatchBootloader.



20
21
22
23
24
25
26
27
28
# File 'src/lib/bootloader/proposal_client.rb', line 20

def initialize(old_bootloader, new_bootloader)
  @old_bootloader = old_bootloader
  @new_bootloader = new_bootloader

  raise "Invalid old bootloader #{old_bootloader}" unless boot_map[old_bootloader]
  raise "Invalid new bootloader #{new_bootloader}" unless boot_map[new_bootloader]

  super("Mismatching bootloaders")
end

Instance Method Details

#boot_mapObject



30
31
32
33
34
35
36
37
38
39
40
41
# File 'src/lib/bootloader/proposal_client.rb', line 30

def boot_map
  textdomain "bootloader"

  {
    # TRANSLATORS: kind of boot. It is term for way how x86_64 can boot
    "grub2"        => _("Legacy BIOS boot"),
    # TRANSLATORS: kind of boot. It is term for way how x86_64 can boot
    "grub2-efi"    => _("EFI boot"),
    # TRANSLATORS: kind of boot. It is term for way how can boot.
    "systemd-boot" => _("Systemd boot")
  }
end

#user_messageObject



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'src/lib/bootloader/proposal_client.rb', line 43

def user_message
  textdomain "bootloader"

  # TRANSLATORS: keep %{} intact. It will be replaced by kind of boot
  format(_(
           "Cannot upgrade the bootloader because of a mismatch of the boot technology. " \
           "The upgraded system uses <i>%{old_boot}</i> while the installation medium " \
           "has been booted using <i>%{new_boot}</i>.<br><br>" \
           "This scenario is not supported, the upgraded system may not boot " \
           "or the upgrade process can fail later."
         ),
    old_boot: boot_map[@old_bootloader], new_boot: boot_map[@new_bootloader])
end