Class: Bootloader::BootloaderBase
- Inherits:
-
Object
- Object
- Bootloader::BootloaderBase
- Includes:
- Yast::I18n
- Defined in:
- src/lib/bootloader/bootloader_base.rb
Overview
Represents base for all kinds of bootloaders
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize ⇒ BootloaderBase
constructor
A new instance of BootloaderBase.
-
#merge(other) ⇒ Object
merges other bootloader configuration into this one.
-
#packages ⇒ Array<String>
Packages required to configure given bootloader.
-
#prepare ⇒ Boolean
Prepares the system to (before write the configuration).
-
#propose ⇒ Object
Proposes new configuration.
-
#proposed? ⇒ Boolean
True if configuration is already proposed.
-
#read ⇒ Object
reads configuration from target disk.
-
#read? ⇒ Boolean
True if configuration is already read.
-
#summary ⇒ Array<String>
Description for proposal summary page for given bootloader.
-
#write(etc_only: false) ⇒ Object
writes configuration to target disk.
-
#write_sysconfig(prewrite: false) ⇒ Object
done in common write but also in installation pre write as kernel update need it.
Constructor Details
#initialize ⇒ BootloaderBase
Returns a new instance of BootloaderBase.
16 17 18 19 20 21 22 |
# File 'src/lib/bootloader/bootloader_base.rb', line 16 def initialize textdomain "bootloader" @read = false @proposed = false @initial_sysconfig = Sysconfig.from_system end |
Instance Method Details
#merge(other) ⇒ Object
merges other bootloader configuration into this one. It have to be same bootloader type.
98 99 100 101 102 103 |
# File 'src/lib/bootloader/bootloader_base.rb', line 98 def merge(other) raise "Invalid merge argument #{other.name} for #{name}" if name != other.name @read ||= other.read? @proposed ||= other.proposed? # rubocop:disable Naming/MemoizedInstanceVariableName end |
#packages ⇒ Array<String>
Returns packages required to configure given bootloader.
79 80 81 82 83 84 85 86 87 |
# File 'src/lib/bootloader/bootloader_base.rb', line 79 def packages # require dracut to have initrd to be able to boot res = ["dracut"] # added kexec-tools fate#303395 res << "kexec-tools" if include_kexec_tools_package? res end |
#prepare ⇒ Boolean
Prepares the system to (before write the configuration)
Writes the new sysconfig and, when the Mode.normal is set, tries to install the required packages. If user decides to cancel the installation, it restores the previous sysconfig.
31 32 33 34 35 36 37 38 39 40 |
# File 'src/lib/bootloader/bootloader_base.rb', line 31 def prepare write_sysconfig return true unless Yast::Mode.normal return true if Yast::Package.InstallAll(packages) restore_initial_sysconfig false end |
#propose ⇒ Object
Proposes new configuration
59 60 61 |
# File 'src/lib/bootloader/bootloader_base.rb', line 59 def propose @proposed = true end |
#proposed? ⇒ Boolean
Returns true if configuration is already proposed.
74 75 76 |
# File 'src/lib/bootloader/bootloader_base.rb', line 74 def proposed? @proposed end |
#read ⇒ Object
reads configuration from target disk
54 55 56 |
# File 'src/lib/bootloader/bootloader_base.rb', line 54 def read @read = true end |
#read? ⇒ Boolean
Returns true if configuration is already read.
69 70 71 |
# File 'src/lib/bootloader/bootloader_base.rb', line 69 def read? @read end |
#summary ⇒ Array<String>
Returns description for proposal summary page for given bootloader.
64 65 66 |
# File 'src/lib/bootloader/bootloader_base.rb', line 64 def summary [] end |
#write(etc_only: false) ⇒ Object
writes configuration to target disk
45 46 47 48 49 50 51 |
# File 'src/lib/bootloader/bootloader_base.rb', line 45 def write(etc_only: false) return if etc_only # reset eventl. already installed systemd bootloader systemd_boot = BootloaderFactory.bootloader_by_name("systemd-boot") systemd_boot&.delete end |
#write_sysconfig(prewrite: false) ⇒ Object
done in common write but also in installation pre write as kernel update need it
91 92 93 94 |
# File 'src/lib/bootloader/bootloader_base.rb', line 91 def write_sysconfig(prewrite: false) sysconfig = Bootloader::Sysconfig.new(bootloader: name) prewrite ? sysconfig.pre_write : sysconfig.write end |