Class: Bootloader::Pmbr

Inherits:
Object
  • Object
show all
Defined in:
src/lib/bootloader/pmbr.rb

Overview

Helper methods for PMBR

Class Method Summary collapse

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


13
14
15
16
# File 'src/lib/bootloader/pmbr.rb', line 13

def available?
  (Yast::Arch.x86_64 || Yast::Arch.i386) &&
    Yast::BootStorage.gpt_boot_disk?
end

.write_efi(action) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'src/lib/bootloader/pmbr.rb', line 22

def write_efi(action)
  fs = filesystems
  efi_partition = fs.find { |f| f.mount_path == "/boot/efi" }
  efi_partition ||= fs.find { |f| f.mount_path == "/boot" }
  efi_partition ||= fs.find { |f| f.mount_path == "/" }

  raise "could not find boot partiton" unless efi_partition

  disks = Yast::BootStorage.stage1_disks_for(efi_partition)
  # set only gpt disks
  disks.select! { |disk| disk.gpt? }
  pmbr_setup(*disks.map(&:name), action)
end

.write_none_efi(action, stage1) ⇒ Object



18
19
20
# File 'src/lib/bootloader/pmbr.rb', line 18

def write_none_efi(action, stage1)
  pmbr_setup(*::Yast::BootStorage.gpt_disks(stage1.devices), action)
end