Class: Yast::BootloaderClass
- Inherits:
-
Module
- Object
- Module
- Yast::BootloaderClass
- Defined in:
- src/modules/Bootloader.rb
Constant Summary
- FLAVOR_KERNEL_LINE_MAP =
{ :common => "append", :recovery => "append_failsafe", :xen_guest => "xen_append", :xen_host => "xen_kernel_append" }
Instance Method Summary (collapse)
-
- (Boolean) checkUsedStorage
bnc #419197 yast2-bootloader does not correctly initialise libstorage Function try initialize yast2-storage if other module used it then don't continue with initialize.
-
- (Boolean) CopyKernelInird
Copy initrd and kernel on the end of instalation (1st stage) fate #303395 Use kexec to avoid booting between first and second stage copy kernel and initrd to /var/lib/YaST run kernel via kexec instead of reboot if not success then reboot…
-
- (String) DMIRead(bios_data, section, key)
Get entry from DMI data returned by .probe.bios.
-
- (Object) Export
Export bootloader settings to a map.
-
- (Boolean) FlagOnetimeBoot(section)
Set section to boot on next reboot.
-
- (String) getDefaultSection
return default section label.
-
- (String) getKernelParam(section, key)
deprecated
Deprecated.
Use kernel_param instead
-
- (String) getLoaderType
Get currently used bootloader, detect if not set yet.
-
- (Object) getProposedDefaultSection
Get default section as proposed during installation if not known, return current default section if it is of type “image”, if not found return first linux section, if no present, return empty string.
-
- (Boolean) Import(settings)
Import settings from a map.
-
- (Boolean) IsHyperV(bios_data)
Check if we run in a hyperv vm.
-
- (Boolean) IsVirtualBox(bios_data)
Check if we run in a vbox vm.
-
- (Object) kernel_param(flavor, key)
Gets value for given parameter in kernel parameters for given flavor.
- - (Object) main
-
- (Object) modify_kernel_params(*args)
Modify kernel parameters for installed kernels according to values.
-
- (Object) PreUpdate
Process update actions needed before packages update starts.
-
- (Object) Propose
Propose bootloader settings.
-
- (Boolean) Read
Read settings from disk.
-
- (Object) ReadOrProposeIfNeeded
Check whether settings were read or proposed, if not, decide what to do and read or propose settings.
-
- (Object) Reset
Reset bootloader settings.
-
- (Object) ResetEx(init)
Reset bootloader settings settings should be done.
-
- (Boolean) RunDelayedUpdates
Set section to boot on next reboot.
-
- (Object) setLoaderType(bootloader)
Set type of bootloader Just a wrapper to BootCommon::setLoaderType.
-
- (Object) Summary
Display bootloader summary.
-
- (Boolean) testAbort
Check whether abort was pressed.
-
- (Boolean) Update
Update the whole configuration.
-
- (Hash{String => Object}) updateAppend(section)
Function update append -> add console to append.
-
- (Object) UpdateConfiguration
Update read settings to new version of configuration files.
-
- (Boolean) Write
Write bootloader settings to disk.
-
- (Boolean) WriteInstallation
Write bootloader settings during installation.
Instance Method Details
- (Boolean) checkUsedStorage
bnc #419197 yast2-bootloader does not correctly initialise libstorage Function try initialize yast2-storage if other module used it then don't continue with initialize
82 83 84 85 86 87 88 |
# File 'src/modules/Bootloader.rb', line 82 def checkUsedStorage if !Storage.InitLibstorage(true) && Mode.normal return false else return true end end |
- (Boolean) CopyKernelInird
Copy initrd and kernel on the end of instalation (1st stage) fate #303395 Use kexec to avoid booting between first and second stage copy kernel and initrd to /var/lib/YaST run kernel via kexec instead of reboot if not success then reboot…
892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 |
# File 'src/modules/Bootloader.rb', line 892 def CopyKernelInird Builtins.y2milestone("CopyKernelInird: start copy kernel and inird") if Mode.live_installation Builtins.y2milestone("Running live_installation without using kexec") return true end if ProductFeatures.GetBooleanFeature("globals", "kexec_reboot") != true Builtins.y2milestone( "Option kexec_reboot is false. kexec will not be used." ) return true end # check architecture for using kexec instead of reboot if Arch.ppc || Arch.s390 Builtins.y2milestone("Skip using of kexec on this architecture") return true end bios_data = Convert.convert( SCR.Read(path(".probe.bios")), :from => "any", :to => "list <map>" ) Builtins.y2milestone("CopyKernelInird::bios_data = %1", bios_data) if IsVirtualBox(bios_data) Builtins.y2milestone( "Installation run on VirtualBox, skip kexec loading" ) return false end if IsHyperV(bios_data) Builtins.y2milestone("Installation run on HyperV, skip kexec loading") return false end # create directory /var/lib/YaST2 WFM.Execute(path(".local.mkdir"), "/var/lib/YaST2") cmd = Builtins.sformat( "/bin/cp -L %1/%2 %1/%3 %4", Installation.destdir, "vmlinuz", "initrd", Directory.vardir ) Builtins.y2milestone("Command for copy: %1", cmd) out = Convert.to_map(WFM.Execute(path(".local.bash_output"), cmd)) if Ops.get(out, "exit") != 0 Builtins.y2error("Copy kernel and initrd failed, output: %1", out) return false end true end |
- (String) DMIRead(bios_data, section, key)
Get entry from DMI data returned by .probe.bios.
833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 |
# File 'src/modules/Bootloader.rb', line 833 def DMIRead(bios_data, section, key) bios_data = deep_copy(bios_data) result = "" Builtins.foreach(Ops.get_list(bios_data, [0, "smbios"], [])) do |x| if Ops.get_string(x, "type", "") == section result = Ops.get_string(x, key, "") raise Break end end Builtins.y2milestone( "Bootloader::DMIRead(%1, %2) = %3", section, key, result ) result end |
- (Object) Export
Export bootloader settings to a map
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'src/modules/Bootloader.rb', line 92 def Export ReadOrProposeIfNeeded() out = { "loader_type" => getLoaderType, "initrd" => Initrd.Export, "specific" => blExport, "write_settings" => BootCommon.write_settings } loader_type = Ops.get_string(out, "loader_type") # export loader_device and selected_location only for bootloaders # that have not phased them out yet Ops.set(out, "loader_device", BootCommon.loader_device) Ops.set(out, "loader_location", BootCommon.selected_location) Builtins.y2milestone("Exporting settings: %1", out) deep_copy(out) end |
- (Boolean) FlagOnetimeBoot(section)
Set section to boot on next reboot
773 774 775 |
# File 'src/modules/Bootloader.rb', line 773 def FlagOnetimeBoot(section) blFlagOnetimeBoot(section) end |
- (String) getDefaultSection
return default section label
584 585 586 587 |
# File 'src/modules/Bootloader.rb', line 584 def getDefaultSection ReadOrProposeIfNeeded() BootCommon.globals["default"] || "" end |
- (String) getKernelParam(section, key)
Use kernel_param instead
get kernel parameters from bootloader configuration file “true” if present key without value
622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 |
# File 'src/modules/Bootloader.rb', line 622 def getKernelParam(section, key) ReadOrProposeIfNeeded() if section == "DEFAULT" section = getDefaultSection elsif section == "LINUX_DEFAULT" section = getProposedDefaultSection end return "" if section == nil params = Convert.to_map(BootCommon.getAnyTypeAttrib("kernel_params", {})) sectnum = -1 index = -1 Builtins.foreach(BootCommon.sections) do |s| index = Ops.add(index, 1) sectnum = index if Ops.get_string(s, "name", "") == section end return "" if sectnum == -1 line = "" if Builtins.contains(["root", "vgamode"], key) return Ops.get_string(BootCommon.sections, [sectnum, key], "false") else line = Ops.get_string(BootCommon.sections, [sectnum, "append"], "") return BootCommon.getKernelParamFromLine(line, key) end end |
- (String) getLoaderType
Get currently used bootloader, detect if not set yet
748 749 750 |
# File 'src/modules/Bootloader.rb', line 748 def getLoaderType BootCommon.getLoaderType(false) end |
- (Object) getProposedDefaultSection
Get default section as proposed during installation if not known, return current default section if it is of type “image”, if not found return first linux section, if no present, return empty string
594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 |
# File 'src/modules/Bootloader.rb', line 594 def getProposedDefaultSection ReadOrProposeIfNeeded() defaultv = "" first_image = "" default_image = "" Builtins.foreach(BootCommon.sections) do |s| title = Ops.get_string(s, "name", "") if Ops.get(s, "image") != nil first_image = title if first_image == "" default_image = title if title == getDefaultSection end if defaultv == "" && Ops.get_string(s, "original_name", "") == "linux" defaultv = title end end return defaultv if defaultv != "" return default_image if default_image != "" return first_image if first_image != "" "" end |
- (Boolean) Import(settings)
Import settings from a map
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 150 151 |
# File 'src/modules/Bootloader.rb', line 112 def Import(settings) settings = deep_copy(settings) Builtins.y2milestone("Importing settings: %1", settings) Reset() BootCommon.was_read = true BootCommon.was_proposed = true BootCommon.changed = true BootCommon.location_changed = true if settings["loader_type"] == "" settings["loader_type"] = nil end # if bootloader is not set, then propose it loader_type = settings["loader_type"] || BootCommon.getLoaderType(true) # Explitelly set it to ensure it is installed BootCommon.setLoaderType(loader_type) # import loader_device and selected_location only for bootloaders # that have not phased them out yet BootCommon.loader_device = Ops.get_string(settings, "loader_device", "") BootCommon.selected_location = Ops.get_string( settings, "loader_location", "custom" ) # FIXME: obsolete for grub (but inactive through the outer "if" now anyway): # for grub, always correct the bootloader device according to # selected_location (or fall back to value of loader_device) if Arch.i386 || Arch.x86_64 BootCommon.loader_device = BootCommon.GetBootloaderDevice end if Ops.get_map(settings, "initrd", {}) != nil Initrd.Import(Ops.get_map(settings, "initrd", {})) end ret = blImport(Ops.get_map(settings, "specific", {})) BootCommon.write_settings = Ops.get_map(settings, "write_settings", {}) ret end |
- (Boolean) IsHyperV(bios_data)
Check if we run in a hyperv vm.
873 874 875 876 877 878 879 880 881 882 |
# File 'src/modules/Bootloader.rb', line 873 def IsHyperV(bios_data) bios_data = deep_copy(bios_data) r = DMIRead(bios_data, "sysinfo", "manufacturer") == "Microsoft Corporation" && DMIRead(bios_data, "sysinfo", "product") == "Virtual Machine" Builtins.y2milestone("Bootloader::IsHyperV = %1", r) r end |
- (Boolean) IsVirtualBox(bios_data)
Check if we run in a vbox vm.
859 860 861 862 863 864 865 866 |
# File 'src/modules/Bootloader.rb', line 859 def IsVirtualBox(bios_data) bios_data = deep_copy(bios_data) r = DMIRead(bios_data, "sysinfo", "product") == "VirtualBox" Builtins.y2milestone("Bootloader::IsVirtualBox = %1", r) r end |
- (Object) kernel_param(flavor, key)
Gets value for given parameter in kernel parameters for given flavor.
673 674 675 676 677 678 679 680 681 682 683 684 685 |
# File 'src/modules/Bootloader.rb', line 673 def kernel_param(flavor, key) ReadOrProposeIfNeeded() # ensure we have some data kernel_line_key = FLAVOR_KERNEL_LINE_MAP[flavor] raise ArgumentError, "Unknown flavor #{flavor}" unless kernel_line_key line = BootCommon.globals[kernel_line_key] ret = BootCommon.getKernelParamFromLine(line, key) # map old api response to new one api_mapping = { "true" => :present, "false" => :missing } return api_mapping[ret] || ret end |
- (Object) main
22 23 24 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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'src/modules/Bootloader.rb', line 22 def main Yast.import "UI" textdomain "bootloader" Yast.import "Arch" Yast.import "BootCommon" Yast.import "BootStorage" Yast.import "Installation" Yast.import "Initrd" Yast.import "Kernel" Yast.import "Mode" Yast.import "Progress" Yast.import "Stage" Yast.import "Storage" Yast.import "Directory" #fate 303395 Yast.import "ProductFeatures" # Write is repeating again # Because of progress bar during inst_finish @repeating_write = false # installation proposal help variables # Configuration was changed during inst. proposal if true @proposed_cfg_changed = false # Cache for the installation proposal @cached_proposal = nil @cached_settings = {} # old vga value handling function # old value of vga parameter of default bootloader section @old_vga = nil # UI helping variables Yast.include self, "bootloader/routines/switcher.rb" Yast.include self, "bootloader/routines/popups.rb" # general functions @test_abort = nil end |
- (Object) modify_kernel_params(*args)
Modify kernel parameters for installed kernels according to values
710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 |
# File 'src/modules/Bootloader.rb', line 710 def modify_kernel_params(*args) values = args.pop if !values.is_a? Hash raise ArgumentError, "Missing parameters to modify #{args.inspect}" end args = [:common] if args.empty? # by default change common kernels only args = args.first if args.first.is_a? Array # support array like syntax # remap symbols to something that setKernelParamToLine understand remap_values = { :missing => "false", :present => "true" } values.each_key do |key| values[key] = remap_values[values[key]] || values[key] end values.each do |key, value| next if key == "root" # grub2 does not support modifying root if key == "vga" BootCommon.globals["vgamode"] = value == "false" ? "" : value next else kernel_lines = args.map do |a| FLAVOR_KERNEL_LINE_MAP[a] || raise(ArgumentError, "Invalid argument #{a.inspect}") end kernel_lines.each do |line_key| BootCommon.globals[line_key] = BootCommon.setKernelParamToLine(BootCommon.globals[line_key], key, value) end end BootCommon.globals["__modified"] = "1" BootCommon.changed = true end end |
- (Object) PreUpdate
Process update actions needed before packages update starts
291 292 293 294 295 |
# File 'src/modules/Bootloader.rb', line 291 def PreUpdate Builtins.y2milestone("Running bootloader pre-update stuff") nil end |
- (Object) Propose
Propose bootloader settings
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
# File 'src/modules/Bootloader.rb', line 227 def Propose Builtins.y2milestone("Proposing configuration") # always have a current target map available in the log Builtins.y2milestone("unfiltered target map: %1", Storage.GetTargetMap) BootCommon.UpdateInstallationKernelParameters blPropose BootCommon.was_proposed = true BootCommon.changed = true BootCommon.location_changed = true BootCommon.backup_mbr = true Builtins.y2milestone("Proposed settings: %1", Export()) nil end |
- (Boolean) Read
Read settings from disk
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 195 196 197 198 199 200 201 202 203 |
# File 'src/modules/Bootloader.rb', line 154 def Read Builtins.y2milestone("Reading configuration") # run Progress bar stages = [ # progress stage, text in dialog (short, infinitiv) _("Check boot loader"), # progress stage, text in dialog (short, infinitiv) _("Read partitioning"), # progress stage, text in dialog (short, infinitiv) _("Load boot loader settings") ] titles = [ # progress step, text in dialog (short) _("Checking boot loader..."), # progress step, text in dialog (short) _("Reading partitioning..."), # progress step, text in dialog (short) _("Loading boot loader settings...") ] # dialog header Progress.New( _("Initializing Boot Loader Configuration"), " ", 3, stages, titles, "" ) Progress.NextStage return false if testAbort Progress.NextStage return false if !checkUsedStorage getLoaderType BootCommon.DetectDisks Progress.NextStage return false if testAbort ret = blRead(true, false) BootCommon.was_read = true @old_vga = getKernelParam(getDefaultSection, "vgamode") Progress.Finish return false if testAbort Builtins.y2debug("Read settings: %1", Export()) ret end |
- (Object) ReadOrProposeIfNeeded
Check whether settings were read or proposed, if not, decide what to do and read or propose settings
779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 |
# File 'src/modules/Bootloader.rb', line 779 def ReadOrProposeIfNeeded if !(BootCommon.was_read || BootCommon.was_proposed) Builtins.y2milestone( "Stage::initial (): %1, update: %2, config: %3", Stage.initial, Mode.update, Mode.config ) if Mode.config Builtins.y2milestone("Not reading settings in Mode::config ()") BootCommon.was_read = true BootCommon.was_proposed = true elsif Stage.initial && !Mode.update Propose() else progress_orig = Progress.set(false) Read() Progress.set(progress_orig) if Mode.update UpdateConfiguration() BootCommon.changed = true BootCommon.location_changed = true end end end nil end |
- (Object) Reset
Reset bootloader settings
223 224 225 |
# File 'src/modules/Bootloader.rb', line 223 def Reset ResetEx(true) end |
- (Object) ResetEx(init)
Reset bootloader settings settings should be done
207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'src/modules/Bootloader.rb', line 207 def ResetEx(init) return if Mode.autoinst Builtins.y2milestone("Reseting configuration") BootCommon.was_proposed = false BootCommon.was_read = false BootCommon.loader_device = "" # BootCommon::setLoaderType (nil); BootCommon.changed = false BootCommon.location_changed = false BootCommon.write_settings = {} blReset(init) nil end |
- (Boolean) RunDelayedUpdates
Set section to boot on next reboot
764 765 766 767 768 |
# File 'src/modules/Bootloader.rb', line 764 def RunDelayedUpdates # perl-BL delayed section removal BootCommon.RunDelayedUpdates nil end |
- (Object) setLoaderType(bootloader)
Set type of bootloader Just a wrapper to BootCommon::setLoaderType
755 756 757 758 759 |
# File 'src/modules/Bootloader.rb', line 755 def setLoaderType(bootloader) BootCommon.setLoaderType(bootloader) nil end |
- (Object) Summary
Display bootloader summary
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'src/modules/Bootloader.rb', line 246 def Summary ret = [] # F#300779 - Install diskless client (NFS-root) # kokso: additional warning that root partition is nfs type -> bootloader will not be installed device = BootCommon.getBootDisk if device == "/dev/nfs" ret = Builtins.add( ret, _( "The boot partition is of type NFS. Bootloader cannot be installed." ) ) Builtins.y2milestone( "Bootloader::Summary() -> Boot partition is nfs type, bootloader will not be installed." ) return deep_copy(ret) end # F#300779 - end blSummary end |
- (Boolean) testAbort
Check whether abort was pressed
72 73 74 75 |
# File 'src/modules/Bootloader.rb', line 72 def testAbort return false if @test_abort == nil @test_abort.call end |
- (Boolean) Update
Update the whole configuration
286 287 288 |
# File 'src/modules/Bootloader.rb', line 286 def Update Write() # write also reads the configuration and updates it end |
- (Hash{String => Object}) updateAppend(section)
Function update append -> add console to append
812 813 814 815 816 817 818 819 820 821 822 823 824 |
# File 'src/modules/Bootloader.rb', line 812 def updateAppend(section) section = deep_copy(section) ret = deep_copy(section) if Ops.get_string(section, "append", "") != "" && Ops.get_string(section, "console", "") != "" updated_append = BootCommon.UpdateSerialConsole( Ops.get_string(section, "append", ""), Ops.get_string(section, "console", "") ) Ops.set(ret, "append", updated_append) if updated_append != nil end deep_copy(ret) end |
- (Object) UpdateConfiguration
Update read settings to new version of configuration files
271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'src/modules/Bootloader.rb', line 271 def UpdateConfiguration # first run bootloader-specific update function blUpdate # remove no more needed Kernel modules from /etc/modules-load.d/ ["cdrom", "ide-cd", "ide-scsi"].each do |kernel_module| Kernel.RemoveModuleToLoad(kernel_module) if Kernel.module_to_be_loaded?(kernel_module) end Kernel.SaveModulesToLoad nil end |
- (Boolean) Write
Write bootloader settings to disk
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 |
# File 'src/modules/Bootloader.rb', line 299 def Write ret = true if @repeating_write BootCommon.was_read = true else ReadOrProposeIfNeeded() end if Ops.get_boolean(BootCommon.write_settings, "save_all", false) BootCommon.save_all = true end if BootCommon.save_all BootCommon.changed = true BootCommon.location_changed = true Initrd.changed = true end Builtins.y2milestone("Writing bootloader configuration") # run Progress bar stages = [ # progress stage, text in dialog (short) _("Create initrd"), # progress stage, text in dialog (short) _("Save boot loader configuration files"), # progress stage, text in dialog (short) _("Install boot loader") ] titles = [ # progress step, text in dialog (short) _("Creating initrd..."), # progress step, text in dialog (short) _("Saving boot loader configuration files..."), # progress step, text in dialog (short) _("Installing boot loader...") ] # progress bar caption if Mode.normal # progress line Progress.New( _("Saving Boot Loader Configuration"), " ", stages.size, stages, titles, "" ) Progress.NextStage else Progress.Title(Ops.get(titles, 0, "")) end params_to_save = {} new_vga = getKernelParam(getDefaultSection, "vgamode") if new_vga != @old_vga && new_vga != "false" && new_vga != "" && new_vga != "ask" Initrd.setSplash(new_vga) Ops.set(params_to_save, "vgamode", new_vga) if Stage.initial end # save initrd if (Initrd.changed || !Mode.normal) && !Ops.get_boolean( BootCommon.write_settings, "forbid_save_initrd", false ) vga = getKernelParam(getDefaultSection, "vgamode") if vga != "false" && vga != "" && vga != "ask" Initrd.setSplash(vga) Ops.set(params_to_save, "vgamode", new_vga) if Stage.initial end ret = Initrd.Write BootCommon.changed = true end Builtins.y2error("Error occurred while creating initrd") if !ret BootCommon.changed = true if Mode.commandline if !(BootCommon.changed || Ops.get_boolean( BootCommon.write_settings, "initrd_changed_externally", false )) Builtins.y2milestone("No bootloader cfg. file saving needed, exiting") # return true; end if Mode.normal Progress.NextStage else Progress.NextStep if !@repeating_write Progress.Title(Ops.get(titles, 1, "")) end # Write settings to /etc/sysconfig/bootloader Builtins.y2milestone("Saving configuration files") lt = getLoaderType SCR.Write(path(".sysconfig.bootloader.LOADER_TYPE"), lt) SCR.Write(path(".sysconfig.bootloader"), nil) Ops.set( params_to_save, "additional_failsafe_params", BootCommon.GetAdditionalFailsafeParams ) Ops.set(params_to_save, "installation_kernel_params", Kernel.GetCmdLine) if Stage.initial SCR.Write( path(".target.ycp"), "/var/lib/YaST2/bootloader.ycp", params_to_save ) end return ret if getLoaderType == "none" #F#300779 - Install diskless client (NFS-root) #kokso: bootloader will not be installed device = BootCommon.getBootDisk if device == "/dev/nfs" Builtins.y2milestone( "Bootloader::Write() -> Boot partition is nfs type, bootloader will not be installed." ) return ret end #F#300779 -end # save bootloader settings reinit = !Mode.normal Builtins.y2milestone( "Reinitialize bootloader library before saving: %1", reinit ) ret = blSave(true, reinit, true) && ret if !ret Builtins.y2error("Error before configuration files saving finished") end if Mode.normal Progress.NextStage else Progress.NextStep if !@repeating_write Progress.Title(Ops.get(titles, 2, "")) end # call bootloader executable Builtins.y2milestone("Calling bootloader executable") ret = ret && blWrite if !ret Builtins.y2error("Installing bootloader failed") if writeErrorPopup @repeating_write = true res = Convert.to_map( WFM.call( "bootloader_proposal", ["AskUser", { "has_next" => false }] ) ) return Write() if Ops.get(res, "workflow_sequence") == :next end end ret end |
- (Boolean) WriteInstallation
Write bootloader settings during installation
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 |
# File 'src/modules/Bootloader.rb', line 476 def WriteInstallation Builtins.y2milestone( "Writing bootloader configuration during installation" ) ret = true if Ops.get_boolean(BootCommon.write_settings, "save_all", false) BootCommon.save_all = true end if BootCommon.save_all BootCommon.changed = true BootCommon.location_changed = true Initrd.changed = true end params_to_save = {} new_vga = getKernelParam(getDefaultSection, "vgamode") if new_vga != @old_vga && new_vga != "false" && new_vga != "" Initrd.setSplash(new_vga) Ops.set(params_to_save, "vgamode", new_vga) if Stage.initial end # save initrd if (Initrd.changed || !Mode.normal) && !Ops.get_boolean( BootCommon.write_settings, "forbid_save_initrd", false ) vga = getKernelParam(getDefaultSection, "vgamode") if vga != "false" && vga != "" Initrd.setSplash(vga) Ops.set(params_to_save, "vgamode", new_vga) if Stage.initial end ret = Initrd.Write BootCommon.changed = true end Builtins.y2error("Error occurred while creating initrd") if !ret Ops.set( params_to_save, "additional_failsafe_params", BootCommon.GetAdditionalFailsafeParams ) Ops.set(params_to_save, "installation_kernel_params", Kernel.GetCmdLine) if Stage.initial SCR.Write( path(".target.ycp"), "/var/lib/YaST2/bootloader.ycp", params_to_save ) end return ret if getLoaderType == "none" # F#300779 - Install diskless client (NFS-root) # kokso: bootloader will not be installed device = BootCommon.getBootDisk if device == "/dev/nfs" Builtins.y2milestone( "Bootloader::Write() -> Boot partition is nfs type, bootloader will not be installed." ) return ret end # F#300779 -end # save bootloader settings reinit = !(Mode.update || Mode.normal) Builtins.y2milestone( "Reinitialize bootloader library before saving: %1", reinit ) ret = blSave(true, reinit, true) && ret if !ret Builtins.y2error("Error before configuration files saving finished") end # call bootloader executable Builtins.y2milestone("Calling bootloader executable") ret = ret && blWrite if !ret Builtins.y2error("Installing bootloader failed") if writeErrorPopup @repeating_write = true res = Convert.to_map( WFM.call( "bootloader_proposal", ["AskUser", { "has_next" => false }] ) ) return Write() if Ops.get(res, "workflow_sequence") == :next end end ret end |