Class: Bootloader::ProposalClient

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

Overview

Proposal client for bootloader configuration

Constant Summary

[
  "enable_boot_mbr",
  "disable_boot_mbr",
  "enable_boot_root",
  "disable_boot_root",
  "enable_boot_boot",
  "disable_boot_boot"
]

Instance Method Summary (collapse)

Constructor Details

- (ProposalClient) initialize

Returns a new instance of ProposalClient



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'src/lib/bootloader/proposal_client.rb', line 8

def initialize
  Yast.import "UI"
  textdomain "bootloader"

  Yast.import "Arch"
  Yast.import "BootCommon"
  Yast.import "Bootloader"
  Yast.import "Installation"
  Yast.import "Storage"
  Yast.import "Mode"
  Yast.import "BootSupportCheck"
  Yast.import "Product"

  Yast.include self, "bootloader/routines/wizards.rb"
end

Instance Method Details

- (Object) ask_user(param)



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'src/lib/bootloader/proposal_client.rb', line 64

def ask_user(param)
  chosen_id = param["chosen_id"]
  result = :next

  # enable boot from MBR
  case chosen_id
  when *PROPOSAL_LINKS
    value = chosen_id =~ /enable/ ? "true" : "false"
    option = chosen_id[/(enable|disable)_(.*)/, 2]
    single_click_action(option, value)
  else
    settings = Yast::Bootloader.Export
    # don't ask for abort confirm if nothing was changed (#29496)
    Yast::BootCommon.changed = false
    result = BootloaderAutoSequence()
    # set to true, simply because must be saved during installation
    Yast::BootCommon.changed = true
    if result != :next
      Yast::Bootloader.Import(settings)
    else
      Yast::Bootloader.proposed_cfg_changed = true
    end
  end
  # Fill return map
  { "workflow_sequence" => result }
end

- (Object) description



91
92
93
94
95
96
97
98
99
# File 'src/lib/bootloader/proposal_client.rb', line 91

def description
  {
    # proposal part - bootloader label
    "rich_text_title" => _("Booting"),
    # menubutton entry
    "menu_title"      => _("&Booting"),
    "id"              => "bootloader_stuff"
  }
end

- (Object) make_proposal(attrs)



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'src/lib/bootloader/proposal_client.rb', line 33

def make_proposal(attrs)
  force_reset = attrs["force_reset"]
  auto_mode = Yast::Mode.autoinst || Yast::Mode.autoupgrade

  if (force_reset || !Yast::Bootloader.proposed_cfg_changed) &&
      !auto_mode
    # force re-calculation of bootloader proposal
    # this deletes any internally cached values, a new proposal will
    # not be partially based on old data now any more
    log.info "Recalculation of bootloader configuration"
    Yast::Bootloader.Reset
  end

  if Yast::Mode.update
    return { "raw_proposal" => [_("do not change")] } unless propose_for_update(force_reset)
  else
    # in installation always propose missing stuff
    Yast::Bootloader.Propose
  end

  # to make sure packages will get installed
  Yast::BootCommon.setLoaderType(Yast::BootCommon.getLoaderType(false))

  ret = construct_proposal_map

  # cache the values
  Yast::BootCommon.cached_settings_base_data_change_time = Yast::Storage.GetTargetChangeTime()

  ret
end