Class: Yast::BootGRUB2EFIClass
- Inherits:
-
Module
- Object
- Module
- Yast::BootGRUB2EFIClass
- Defined in:
- ../../src/modules/BootGRUB2EFI.rb
Instance Method Summary (collapse)
-
- (Object) BootGRUB2EFI
Constructor.
- - (Object) Dialogs
-
- (Object) GetFunctions
Return map of provided functions.
-
- (Object) Initializer
Initializer of GRUB2EFI bootloader.
- - (Object) main
-
- (Object) Propose
Propose bootloader settings.
-
- (Boolean) Read(reread, avoid_reading_device_map)
Read settings from disk internal data.
-
- (Object) Reset(init)
Reset bootloader settings.
-
- (Object) StandardGlobals
Propose global options of bootloader.
-
- (Object) Summary
Display bootloader summary.
-
- (Object) Update
Update read settings to new version of configuration files.
-
- (Boolean) Write
Write bootloader settings to disk.
Instance Method Details
- (Object) BootGRUB2EFI
Constructor
256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File '../../src/modules/BootGRUB2EFI.rb', line 256 def BootGRUB2EFI Ops.set( BootCommon.bootloader_attribs, "grub2-efi", { "required_packages" => ["grub2-efi", "shim"], "loader_name" => "GRUB2-EFI", "initializer" => fun_ref(method(:Initializer), "void ()") } ) nil end |
- (Object) Dialogs
217 218 219 220 |
# File '../../src/modules/BootGRUB2EFI.rb', line 217 def Dialogs Builtins.y2milestone("Called GRUB2 Dialogs") { "loader" => fun_ref(method(:Grub2LoaderDetailsDialog), "symbol ()") } end |
- (Object) GetFunctions
Return map of provided functions
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File '../../src/modules/BootGRUB2EFI.rb', line 224 def GetFunctions { "read" => fun_ref(method(:Read), "boolean (boolean, boolean)"), "reset" => fun_ref(method(:Reset), "void (boolean)"), "propose" => fun_ref(method(:Propose), "void ()"), "summary" => fun_ref(method(:Summary), "list <string> ()"), "update" => fun_ref(method(:Update), "void ()"), "widgets" => fun_ref( method(:grub2efiWidgets), "map <string, map <string, any>> ()" ), "dialogs" => fun_ref(method(:Dialogs), "map <string, symbol ()> ()"), "write" => fun_ref(method(:Write), "boolean ()") } end |
- (Object) Initializer
Initializer of GRUB2EFI bootloader
242 243 244 245 246 247 248 249 250 251 252 253 |
# File '../../src/modules/BootGRUB2EFI.rb', line 242 def Initializer Builtins.y2milestone("Called GRUB2EFI initializer") BootCommon.current_bootloader_attribs = { "propose" => false, "read" => false, "scratch" => false, "restore_mbr" => false, "bootloader_on_disk" => false } nil end |
- (Object) main
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File '../../src/modules/BootGRUB2EFI.rb', line 25 def main Yast.import "UI" textdomain "bootloader" Yast.import "BootArch" Yast.import "BootCommon" Yast.import "BootStorage" Yast.import "Kernel" Yast.import "Mode" Yast.import "Stage" Yast.import "Storage" Yast.import "StorageDevices" Yast.import "Pkg" Yast.import "HTML" Yast.import "Initrd" Yast.import "Product" # includes # for shared some routines with grub # include "bootloader/grub/misc.ycp"; # for simplified widgets than other Yast.include self, "bootloader/grub2/dialogs.rb" BootGRUB2EFI() end |
- (Object) Propose
Propose bootloader settings
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File '../../src/modules/BootGRUB2EFI.rb', line 126 def Propose if BootCommon.was_proposed # workaround autoyast config is Imported thus was_proposed always set if Mode.autoinst Builtins.y2milestone( "autoinst mode we ignore meaningless was_proposed as it always set" ) else Builtins.y2milestone( "calling Propose with was_proposed set is really bogus, clear it to force a re-propose" ) return end end if BootCommon.globals == nil || Builtins.size(BootCommon.globals) == 0 BootCommon.globals = StandardGlobals() else BootCommon.globals = Convert.convert( Builtins.union(BootCommon.globals, StandardGlobals()), :from => "map", :to => "map <string, string>" ) end swap_sizes = BootCommon.getSwapPartitions swap_parts = Builtins.maplist(swap_sizes) { |name, size| name } swap_parts = Builtins.sort(swap_parts) do |a, b| Ops.greater_than(Ops.get(swap_sizes, a, 0), Ops.get(swap_sizes, b, 0)) end largest_swap_part = Ops.get(swap_parts, 0, "") resume = BootArch.ResumeAvailable ? largest_swap_part : "" # try to use label or udev id for device name... FATE #302219 if resume != "" && resume != nil resume = BootStorage.Dev2MountByDev(resume) end Ops.set( BootCommon.globals, "append", BootArch.DefaultKernelParams(resume) ) Ops.set( BootCommon.globals, "append_failsafe", BootArch.FailsafeKernelParams ) Ops.set( BootCommon.globals, "distributor", Ops.add(Ops.add(Product.short_name, " "), Product.version) ) BootCommon.kernelCmdLine = Kernel.GetCmdLine Builtins.y2milestone("Proposed globals: %1", BootCommon.globals) # Let grub2 scripts detects correct root= for us. :) # BootCommon::globals["root"] = BootStorage::Dev2MountByDev(BootStorage::RootPartitionDevice); # We don't set vga= if Grub2 gfxterm enabled, because the modesettings # will be delivered to kernel by Grub2's gfxpayload set to "keep" #if (BootArch::VgaAvailable () && Kernel::GetVgaType () != "") #{ # BootCommon::globals["vgamode"] = Kernel::GetVgaType (); #} nil end |
- (Boolean) Read(reread, avoid_reading_device_map)
Read settings from disk internal data
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File '../../src/modules/BootGRUB2EFI.rb', line 70 def Read(reread, avoid_reading_device_map) BootCommon.InitializeLibrary(reread, "grub2-efi") BootCommon.ReadFiles(avoid_reading_device_map) if reread # TODO: check if necessary for grub2efi # grub_DetectDisks (); ret = BootCommon.Read(false, avoid_reading_device_map) # TODO: check if necessary for grub2 # refresh device map if not read # if (BootStorage::device_mapping == nil # || size (BootStorage::device_mapping) == 0) # { # BootStorage::ProposeDeviceMap (); # } ret end |
- (Object) Reset(init)
Reset bootloader settings
117 118 119 120 121 122 |
# File '../../src/modules/BootGRUB2EFI.rb', line 117 def Reset(init) return if Mode.autoinst BootCommon.Reset(init) nil end |
- (Object) StandardGlobals
Propose global options of bootloader
54 55 56 57 58 59 60 61 62 63 |
# File '../../src/modules/BootGRUB2EFI.rb', line 54 def StandardGlobals { "timeout" => "8", "default" => "0", "vgamode" => "", "gfxmode" => "auto", "terminal" => "gfxterm", "os_prober" => "true" } end |
- (Object) Summary
Display bootloader summary
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File '../../src/modules/BootGRUB2EFI.rb', line 199 def Summary result = [ Builtins.sformat( _("Boot Loader Type: %1"), BootCommon.getLoaderName(BootCommon.getLoaderType(false), :summary) ) ] result = Builtins.add( result, Builtins.sformat( _("Enable Secure Boot: %1"), BootCommon.getSystemSecureBootStatus(false) ) ) deep_copy(result) end |
- (Object) Update
Update read settings to new version of configuration files
89 90 91 92 93 94 95 96 97 |
# File '../../src/modules/BootGRUB2EFI.rb', line 89 def Update Read(true, true) #we don't handle sections, grub2 section create them for us #BootCommon::UpdateSections (); BootCommon.UpdateGlobals nil end |
- (Boolean) Write
Write bootloader settings to disk
101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File '../../src/modules/BootGRUB2EFI.rb', line 101 def Write ret = BootCommon.UpdateBootloader if BootCommon.location_changed grub_ret = BootCommon.InitializeBootloader grub_ret = false if grub_ret == nil Builtins.y2milestone("GRUB2EFI return value: %1", grub_ret) ret = ret && grub_ret end ret end |