Class: Bootloader::MBRUpdate

Inherits:
Object
  • Object
show all
Includes:
Yast::Logger
Defined in:
src/lib/bootloader/mbr_update.rb

Overview

this class place generic MBR wherever it is needed and also mark needed partitions with boot flag and legacy_boot FIXME: make it single responsibility class

Constant Summary

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) run

Update contents of MBR (active partition and booting code)

Returns:

  • (Boolean)

    true on success



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'src/lib/bootloader/mbr_update.rb', line 21

def run
  # s390 do not use MBR at all, so nothing to do
  return true if Yast::Arch.s390

  activate = Yast::BootCommon.globals["activate"] == "true"
  generic_mbr = Yast::BootCommon.globals["generic_mbr"] == "true"

  log.info "MBRUpdate: activate: #{activate} generic: #{generic_mbr}"

  # After a proposal is done, Bootloader::Propose() always sets
  # backup_mbr to true. The default is false. No other parts of the code
  # currently change this flag.
  create_backups if Yast::BootCommon.backup_mbr

  ret = true
  # Rewrite MBR with generic boot code only if we do not plan to install
  # there bootloader stage1
  if generic_mbr && !bootloader_devices.include?(mbr_disk)
    ret &&= install_generic_mbr
  end

  ret &&= activate_partitions if activate

  ret
end