Class: Bootloader::DiskChangeDetector

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

Overview

Task of this class is to detect if user change storage proposal during installation, so bootloader configuration can be invalid.

Instance Method Summary (collapse)

Constructor Details

- (DiskChangeDetector) initialize

Returns a new instance of DiskChangeDetector



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

def initialize
  Yast.import "BootCommon"
  Yast.import "BootStorage"
  Yast.import "Mode"
  Yast.import "Storage"

  textdomain "bootloader"

  mp = Yast::Storage.GetMountPoints
  @actual_root = mp["/"] ? mp["/"].first : ""
  @actual_boot = mp["/boot"] ? mp["/boot"].first : actual_root
  @actual_extended = Yast::BootStorage.extended_partition_for(Yast::BootStorage.BootPartitionDevice)
end

Instance Method Details

- (Array<String>) changes

Check whether any disk settings for the disks we currently use were changed so if any change is found, then configuration can be invalid

Returns:

  • (Array<String>)

    list of localized messages with changes



26
27
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
# File 'src/lib/bootloader/disk_change_detector.rb', line 26

def changes
  ret = []
  return ret if Yast::Mode.config

  if boot_changed?
    ret << change_message('"/boot"', Yast::BootStorage.BootPartitionDevice)
  end

  if root_changed?
    ret << change_message('"/"', Yast::BootStorage.RootPartitionDevice)
  end

  ret << change_message("MBR", Yast::BootCommon.mbrDisk) if mbr_changed?

  if extended_changed?
    ret << change_message('"extended partition"', Yast::BootStorage.ExtendedPartitionDevice)
  end

  if invalid_custom?
    # TRANSLATORS: %s stands for partition
    ret <<
      _("Selected custom bootloader partition %s is not available any more.") %
        Yast::BootCommon.globals["boot_custom"]
  end

  ret
end