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(stage1)

Returns a new instance of DiskChangeDetector



11
12
13
14
15
16
17
# File 'src/lib/bootloader/disk_change_detector.rb', line 11

def initialize(stage1)
  Yast.import "BootStorage"
  Yast.import "Mode"

  textdomain "bootloader"
  @stage1 = stage1
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



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

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

  @stage1.devices.each_with_object([]) do |device, ret|
    next unless invalid_device?(device)

    # TRANSLATORS: %s stands for partition
    ret << _("Selected bootloader partition %s is not available any more.") % device
  end
end