Class: Bootloader::SystemdBoot
- Inherits:
-
BootloaderBase
- Object
- BootloaderBase
- Bootloader::SystemdBoot
- Includes:
- Yast::I18n, Yast::Logger
- Defined in:
- src/lib/bootloader/systemdboot.rb
Overview
Represents systemd bootloader with efi target
Instance Attribute Summary collapse
-
#menue_timeout ⇒ Integer
Menue timeout.
-
#secure_boot ⇒ Boolean
Current secure boot setting.
Instance Method Summary collapse
- #delete ⇒ Object
-
#initialize ⇒ SystemdBoot
constructor
A new instance of SystemdBoot.
- #merge(other) ⇒ Object
- #name ⇒ Object
- #packages ⇒ Object
- #propose ⇒ Object
- #read ⇒ Object
-
#secure_boot_summary ⇒ String
Secure boot setting shown in summary screen.
- #status_string(status) ⇒ Object
-
#summary ⇒ Object
Display bootloader summary.
-
#write(etc_only: false) ⇒ Object
Write bootloader settings to disk.
-
#write_sysconfig(prewrite: false) ⇒ Object
overwrite BootloaderBase version to save secure boot.
Methods inherited from BootloaderBase
Constructor Details
#initialize ⇒ SystemdBoot
Returns a new instance of SystemdBoot.
29 30 31 32 33 |
# File 'src/lib/bootloader/systemdboot.rb', line 29 def initialize super textdomain "bootloader" end |
Instance Attribute Details
#menue_timeout ⇒ Integer
Returns menue timeout.
23 24 25 |
# File 'src/lib/bootloader/systemdboot.rb', line 23 def @menue_timeout end |
#secure_boot ⇒ Boolean
Returns current secure boot setting.
27 28 29 |
# File 'src/lib/bootloader/systemdboot.rb', line 27 def secure_boot @secure_boot end |
Instance Method Details
#delete ⇒ Object
123 124 125 |
# File 'src/lib/bootloader/systemdboot.rb', line 123 def delete log.warn("is currently not supported") end |
#merge(other) ⇒ Object
35 36 37 38 39 40 41 |
# File 'src/lib/bootloader/systemdboot.rb', line 35 def merge(other) log.info "merging with system: timeout=#{other.} " \ "secure_boot=#{other.secure_boot}" super self. = other. unless other..nil? self.secure_boot = other.secure_boot unless other.secure_boot.nil? end |
#name ⇒ Object
105 106 107 |
# File 'src/lib/bootloader/systemdboot.rb', line 105 def name "systemd-boot" end |
#packages ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'src/lib/bootloader/systemdboot.rb', line 109 def packages res = super res << "sdbootutil" << "systemd-boot" case Yast::Arch.architecture when "x86_64" res << "shim" if secure_boot else log.warn "Unknown architecture #{Yast::Arch.architecture} for systemdboot" end res end |
#propose ⇒ Object
63 64 65 66 67 68 |
# File 'src/lib/bootloader/systemdboot.rb', line 63 def propose super log.info("Propose settings...") self. = Yast::ProductFeatures.GetIntegerFeature("globals", "boot_timeout").to_i self.secure_boot = Systeminfo.secure_boot_supported? end |
#read ⇒ Object
43 44 45 46 47 48 |
# File 'src/lib/bootloader/systemdboot.rb', line 43 def read super self.secure_boot = Systeminfo.secure_boot_active? end |
#secure_boot_summary ⇒ String
Secure boot setting shown in summary screen. sdbootutil intialize secure boot if shim has been installed.
82 83 84 85 86 87 88 89 90 |
# File 'src/lib/bootloader/systemdboot.rb', line 82 def secure_boot_summary link = if secure_boot "<a href=\"disable_secure_boot\">(#{_("disable")})</a>" else "<a href=\"enable_secure_boot\">(#{_("enable")})</a>" end "#{_("Secure Boot:")} #{status_string(secure_boot)} #{link}" end |
#status_string(status) ⇒ Object
70 71 72 73 74 75 76 |
# File 'src/lib/bootloader/systemdboot.rb', line 70 def status_string(status) if status _("enabled") else _("disabled") end end |
#summary ⇒ Object
Display bootloader summary
94 95 96 97 98 99 100 101 102 103 |
# File 'src/lib/bootloader/systemdboot.rb', line 94 def summary(*) result = [ Yast::Builtins.sformat( _("Boot Loader Type: %1"), "Systemd Boot" ) ] result << secure_boot_summary if Systeminfo.secure_boot_available?(name) result end |
#write(etc_only: false) ⇒ Object
Write bootloader settings to disk
51 52 53 54 55 56 57 58 59 60 61 |
# File 'src/lib/bootloader/systemdboot.rb', line 51 def write(etc_only: false) super log.info("Writing settings...") if Yast::Stage.initial # while new installation only (currently) install_bootloader end true end |
#write_sysconfig(prewrite: false) ⇒ Object
overwrite BootloaderBase version to save secure boot
128 129 130 131 132 133 |
# File 'src/lib/bootloader/systemdboot.rb', line 128 def write_sysconfig(prewrite: false) sysconfig = Bootloader::Sysconfig.new(bootloader: name, secure_boot: secure_boot, trusted_boot: false, update_nvram: false) prewrite ? sysconfig.pre_write : sysconfig.write end |