Class: Bootloader::Sections
- Inherits:
-
Object
- Object
- Bootloader::Sections
- Includes:
- Yast::Logger
- Defined in:
- src/lib/bootloader/sections.rb
Overview
Represents available sections and handling of default boot entry
Instance Attribute Summary collapse
-
#all ⇒ Array<String>
readonly
List of all available boot titles if initialized with grub_cfg otherwise it is empty array.
-
#default ⇒ String
Title of default boot section.
Instance Method Summary collapse
-
#initialize(grub_cfg = nil) ⇒ Sections
constructor
or nil if not available yet.
-
#write ⇒ Object
writes default to system making it persistent.
Constructor Details
#initialize(grub_cfg = nil) ⇒ Sections
or nil if not available yet
23 24 25 26 27 |
# File 'src/lib/bootloader/sections.rb', line 23 def initialize(grub_cfg = nil) @data = grub_cfg ? grub_cfg.boot_entries : [] @all = @data.map { |e| e[:title] } @default = grub_cfg ? read_default : "" end |
Instance Attribute Details
#all ⇒ Array<String> (readonly)
Returns list of all available boot titles if initialized with grub_cfg otherwise it is empty array.
15 16 17 |
# File 'src/lib/bootloader/sections.rb', line 15 def all @all end |
#default ⇒ String
Returns title of default boot section. It is not full path, so it should be reasonable short.
19 20 21 |
# File 'src/lib/bootloader/sections.rb', line 19 def default @default end |
Instance Method Details
#write ⇒ Object
writes default to system making it persistent
45 46 47 48 49 |
# File 'src/lib/bootloader/sections.rb', line 45 def write return if default.empty? Yast::Execute.on_target("/usr/sbin/grub2-set-default", title_to_path(default)) end |