Class: Yast::BootGRUB2EFIClass
- Inherits:
-
GRUB2Base
- Object
- Module
- GRUB2Base
- Yast::BootGRUB2EFIClass
- Defined in:
- src/modules/BootGRUB2EFI.rb
Instance Method Summary (collapse)
-
- (Object) BootGRUB2EFI
Constructor.
-
- (Object) GetFunctions
Return map of provided functions.
- - (Object) main
- - (Object) Propose
-
- (Boolean) Read(reread, avoid_reading_device_map)
Read settings from disk internal data.
-
- (Object) Summary
Display bootloader summary.
-
- (Boolean) Write
Write bootloader settings to disk.
Methods inherited from GRUB2Base
#Dialogs, #Initializer, #Reset, #Save, #StandardGlobals, #Update, #pmbr_setup
Instance Method Details
- (Object) BootGRUB2EFI
Constructor
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'src/modules/BootGRUB2EFI.rb', line 132 def BootGRUB2EFI if Arch.i386 packages = ["grub2-i386-efi"] elsif Arch.x86_64 packages = ["grub2-x86_64-efi", "shim", "mokutil"] else # do not raise exception as we call constructor everywhere even if it doesn't make sense packages = [] end Ops.set( BootCommon.bootloader_attribs, "grub2-efi", { "required_packages" => packages, "loader_name" => "GRUB2-EFI", "initializer" => fun_ref(method(:Initializer), "void ()") } ) nil end |
- (Object) GetFunctions
Return map of provided functions
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'src/modules/BootGRUB2EFI.rb', line 113 def GetFunctions { "read" => fun_ref(method(:Read), "boolean (boolean, boolean)"), "reset" => fun_ref(method(:Reset), "void (boolean)"), "propose" => fun_ref(method(:Propose), "void ()"), "save" => fun_ref(method(:Save), "boolean (boolean, boolean, boolean)"), "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) main
26 27 28 29 30 31 |
# File 'src/modules/BootGRUB2EFI.rb', line 26 def main super textdomain "bootloader" BootGRUB2EFI() end |
- (Object) Propose
80 81 82 83 84 85 86 87 88 |
# File 'src/modules/BootGRUB2EFI.rb', line 80 def Propose super # for UEFI always set PMBR flag on disk (bnc#872054) BootCommon.pmbr_action = :add if !BootCommon.was_proposed || Mode.autoinst || Mode.autoupgrade # set secure boot always on (bnc #879486) BootCommon.setSystemSecureBootStatus(true) if !BootCommon.was_proposed && Arch.x86_64; end |
- (Boolean) Read(reread, avoid_reading_device_map)
Read settings from disk internal data
40 41 42 43 44 45 46 47 |
# File 'src/modules/BootGRUB2EFI.rb', line 40 def Read(reread, avoid_reading_device_map) BootCommon.InitializeLibrary(reread, "grub2-efi") BootCommon.ReadFiles(avoid_reading_device_map) if reread BootCommon.Read(false, avoid_reading_device_map) # read status of secure boot to boot common cache (bnc#892032) BootCommon.getSystemSecureBootStatus(reread) @orig_globals ||= deep_copy(BootCommon.globals) end |
- (Object) Summary
Display bootloader summary
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'src/modules/BootGRUB2EFI.rb', line 93 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 |
- (Boolean) Write
Write bootloader settings to disk
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'src/modules/BootGRUB2EFI.rb', line 51 def Write ret = BootCommon.UpdateBootloader # we do not have originals or it changed if !@orig_globals || @orig_globals["distributor"] != BootCommon.globals["distributor"] BootCommon.location_changed = true end 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 # something with PMBR needed if BootCommon.pmbr_action efi_disk = Storage.GetEntryForMountpoint("/boot/efi")["device"] efi_disk ||= Storage.GetEntryForMountpoint("/boot")["device"] efi_disk ||= Storage.GetEntryForMountpoint("/")["device"] pmbr_setup(BootCommon.pmbr_action, efi_disk) end ret end |