Class: Yast::GRUB2Base
- Inherits:
-
Module
- Object
- Module
- Yast::GRUB2Base
- Defined in:
- src/lib/bootloader/grub2base.rb
Direct Known Subclasses
Instance Method Summary (collapse)
- - (Object) Dialogs
-
- (Object) Initializer
Initializer of GRUB bootloader.
- - (Object) main
-
- (Object) pmbr_setup(action, *devices)
set pmbr flags on boot disks.
- - (Object) Propose
-
- (Object) Reset(init)
Reset bootloader settings.
-
- (Object) Save(clean, init, flush)
overwrite Save to allow generation of modification scripts.
-
- (Object) StandardGlobals
Propose global options of bootloader.
-
- (Object) Update
Update read settings to new version of configuration files.
Instance Method Details
- (Object) Dialogs
87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'src/lib/bootloader/grub2base.rb', line 87 def Dialogs Builtins.y2milestone("Called GRUB2 Dialogs") { "installation" => fun_ref( method(:Grub2InstallDetailsDialog), "symbol ()" ), "loader" => fun_ref( method(:Grub2LoaderDetailsDialog), "symbol ()" ) } end |
- (Object) Initializer
Initializer of GRUB bootloader
166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'src/lib/bootloader/grub2base.rb', line 166 def Initializer Builtins.y2milestone("Called GRUB2 initializer") BootCommon.current_bootloader_attribs = { "propose" => false, "read" => false, "scratch" => false, "restore_mbr" => false, "bootloader_on_disk" => false } nil end |
- (Object) main
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'src/lib/bootloader/grub2base.rb', line 8 def main Yast.import "UI" textdomain "bootloader" Yast.import "Arch" Yast.import "BootArch" Yast.import "BootCommon" Yast.import "BootStorage" Yast.import "HTML" Yast.import "Initrd" Yast.import "Kernel" Yast.import "Mode" Yast.import "Pkg" Yast.import "Product" Yast.import "ProductFeatures" Yast.import "Stage" Yast.import "Storage" Yast.import "StorageDevices" # includes # for simplified widgets than other Yast.include self, "bootloader/grub2/dialogs.rb" # password can have three states # 1. nil -> remove password # 2. "" -> do not change it # 3. "something" -> set password to this value @password = "" end |
- (Object) pmbr_setup(action, *devices)
set pmbr flags on boot disks
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'src/lib/bootloader/grub2base.rb', line 43 def pmbr_setup(action, *devices) action_parted = case action when :add then "on" when :remove then "off" else raise "invalid action #{action}" end devices.each do |dev| res = SCR.Execute(path(".target.bash_output"), "parted '#{dev}' disk_set pmbr_boot #{action_parted}") Builtins.y2milestone("parted disk_set pmbr: #{res}") end end |
- (Object) Propose
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'src/lib/bootloader/grub2base.rb', line 101 def Propose if BootCommon.was_proposed # workaround autoyast config is Imported thus was_proposed always set if Mode.autoinst || Mode.autoupgrade 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 BootCommon.globals = StandardGlobals().merge(BootCommon.globals || {}) swap_parts = BootCommon.getSwapPartitions largest_swap_part = (swap_parts.max_by{|part, size| size} || [""]).first resume = BootArch.ResumeAvailable ? largest_swap_part : "" # try to use label or udev id for device name... FATE #302219 if resume != "" && resume != nil resume = ::Bootloader::DeviceMapping.to_mountby_device(resume) end BootCommon.globals["append"] ||= BootArch.DefaultKernelParams(resume) BootCommon.globals["append_failsafe"] ||= BootArch.FailsafeKernelParams # long name doesn't fit 800x600 GRUB screens, using short name by default # (bnc#873675) BootCommon.globals["distributor"] ||= Product.short_name if !BootCommon.globals["distributor"] || BootCommon.globals["distributor"].empty? BootCommon.globals["distributor"] = Product.name end # Propose bootloader serial settings from kernel cmdline during install (bnc#862388) serial = BootCommon.GetSerialFromAppend if !serial.empty? BootCommon.globals["terminal"] ||= "serial" BootCommon.globals["serial"] ||= serial end Builtins.y2milestone("Proposed globals: %1", BootCommon.globals) nil end |
- (Object) Reset(init)
Reset bootloader settings
82 83 84 85 |
# File 'src/lib/bootloader/grub2base.rb', line 82 def Reset(init) return if Mode.autoinst BootCommon.Reset end |
- (Object) Save(clean, init, flush)
overwrite Save to allow generation of modification scripts
152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'src/lib/bootloader/grub2base.rb', line 152 def Save(clean, init, flush) case @password when nil GRUB2Pwd.new.disable when "" #do nothing else GRUB2Pwd.new.enable @password end BootCommon.Save(clean, init, flush) end |
- (Object) StandardGlobals
Propose global options of bootloader
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'src/lib/bootloader/grub2base.rb', line 57 def StandardGlobals # s390 do not have os_prober, see bnc#868909#c2 disable_os_prober = Arch.s390 || ProductFeatures.GetBooleanFeature("globals", "disable_os_prober") { "timeout" => "8", "default" => "0", "vgamode" => "", "gfxmode" => "auto", "terminal" => Arch.s390 ? "console" : "gfxterm", "os_prober" => disable_os_prober ? "false" : "true", "activate" => Arch.ppc ? "true" : "false" } end |
- (Object) Update
Update read settings to new version of configuration files
72 73 74 75 76 77 78 |
# File 'src/lib/bootloader/grub2base.rb', line 72 def Update Read(true, true) BootCommon.UpdateGlobals nil end |