Class: Bootloader::ConfigDialog

Inherits:
Object
  • Object
show all
Includes:
Yast::I18n, Yast::Logger, Yast::UIShortcuts
Defined in:
src/lib/bootloader/config_dialog.rb

Overview

Dialog for whole bootloader configuration

Instance Method Summary collapse

Constructor Details

#initialize(initial_tab: :boot_code) ⇒ ConfigDialog

param initial_tab [:boot_code|:kernel|:bootloader] initial tab when dialog open



24
25
26
# File 'src/lib/bootloader/config_dialog.rb', line 24

def initialize(initial_tab: :boot_code)
  @initial_tab = initial_tab
end

Instance Method Details

#runObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'src/lib/bootloader/config_dialog.rb', line 28

def run
  guarded_run
rescue ::Bootloader::NoRoot
  Yast::Report.Error(
    _("YaST cannot configure the bootloader because it failed to find the root file system.")
  )
  :abort
rescue ::Bootloader::BrokenConfiguration, ::Bootloader::UnsupportedOption => e
  msg = if e.is_a?(::Bootloader::BrokenConfiguration)
    # TRANSLATORS: %s stands for readon why yast cannot process it
    _("YaST cannot process current bootloader configuration (%s). " \
      "Propose new configuration from scratch?") % e.reason
  else
    e.message
  end

  ret = Yast::Report.AnyQuestion(_("Unsupported Configuration"),
    msg,
    _("Propose"),
    _("Quit"),
    :yes) # focus proposing new one
  return :abort unless ret

  ::Bootloader::BootloaderFactory.current = ::Bootloader::BootloaderFactory.proposed
  ::Bootloader::BootloaderFactory.current.propose

  retry
end