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)
-
- (Object) Bootloader
Constructor.
-
- (Boolean) CheckClientForSLERT
bnc #450153 YaST bootloader doesn't handle kernel from add-on products in installation Function check if client kernel_bl_proposal exist.
-
- (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…
-
- (Fixnum) CountSection(find_section)
Find “same” boot sections and return numbers of sections from BootCommon::sections.
- - (Object) createSELinuxDir
-
- (Object) DelDuplicatedSections
Delete duplicated boot sections from BootCommon::sections.
- - (Object) disableSELinuxPAM
-
- (String) DMIRead(bios_data, section, key)
Get entry from DMI data returned by .probe.bios.
- - (Object) enableSELinuxPAM
-
- (Object) Export
Export bootloader settings to a map.
- - (Object) FindAndSelectDefault(default_sec)
-
- (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.
- - (Object) handleSELinuxPAM
-
- (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 For grub1 for backward compatibility modify default section.
-
- (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) removeDummySections
bnc #450153 YaST bootloader doesn't handle kernel from add-on products in installation Remove all section with empty keys “image” and “initrd”.
-
- (Object) Reset
Reset bootloader settings.
-
- (Object) ResetEx(init)
Reset bootloader settings settings should be done.
-
- (Object) ResolveSymlink(section, key)
Resolve a single symlink in key image_key in section map s.
-
- (Object) ResolveSymlinksInSections
Resolve symlinks in kernel and initrd paths, for existing linux, xen and failsafe sections FIXME: this is the plan B solution, try to solve plan A in BootCommon.ycp:CreateLinuxSection() (line 435).
-
- (Boolean) RunDelayedUpdates
Set section to boot on next reboot.
-
- (Boolean) setKernelParam(section, key, value)
deprecated
Deprecated.
use modify_kernel_param instead
-
- (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) UpdateGfxMenu
Update the language of GFX menu according to currently selected language.
-
- (Boolean) Write
Write bootloader settings to disk.
-
- (Boolean) WriteInstallation
Write bootloader settings during installation.
Instance Method Details
- (Object) Bootloader
Constructor
93 94 95 |
# File '../../src/modules/Bootloader.rb', line 93 def Bootloader nil end |
- (Boolean) CheckClientForSLERT
bnc #450153 YaST bootloader doesn't handle kernel from add-on products in installation Function check if client kernel_bl_proposal exist
743 744 745 746 747 748 749 |
# File '../../src/modules/Bootloader.rb', line 743 def CheckClientForSLERT if WFM.ClientExists("kernel_bl_proposal") return true else return false end end |
- (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
84 85 86 87 88 89 90 |
# File '../../src/modules/Bootloader.rb', line 84 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…
1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 |
# File '../../src/modules/Bootloader.rb', line 1386 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.ia64 || 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 default sections linux_default = BootCommon.CreateLinuxSection("linux") Builtins.y2milestone("linux_default: %1", linux_default) default_section = {} name = getDefaultSection # find default section in BootCommon::sections Builtins.foreach(BootCommon.sections) do |section| if Builtins.search( Builtins.tostring(Ops.get_string(section, "name", "")), name ) != nil && Ops.get(section, "root") == Ops.get(linux_default, "root") && Ops.get_string(section, "original_name", "") != "failsafe" Builtins.y2milestone("default section: %1", section) default_section = deep_copy(section) end end # create directory /var/lib/YaST2 WFM.Execute(path(".local.mkdir"), "/var/lib/YaST2") # build command for copy kernel and initrd to /var/lib/YaST during instalation cmd = nil default_section = updateAppend(default_section) cmd = Builtins.sformat( "/bin/cp %1%2 %1%3 %4", Installation.destdir, Builtins.tostring(Ops.get_string(default_section, "image", "")), Builtins.tostring(Ops.get_string(default_section, "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 if Ops.get_string(default_section, "root", "") == "" Builtins.y2milestone("root is not defined in default section.") return false end if Ops.get_string(default_section, "vgamode", "") == "" Builtins.y2milestone("vgamode is not defined in default section.") return false end # flush kernel options into /var/lib/YaST/kernel_params cmd = Builtins.sformat( "echo \"root=%1 %2 vga=%3\" > %4/kernel_params", Builtins.tostring(Ops.get_string(default_section, "root", "")), Builtins.tostring(Ops.get_string(default_section, "append", "")), Builtins.tostring(Ops.get_string(default_section, "vgamode", "")), Directory.vardir ) Builtins.y2milestone("Command for flushing kernel args: %1", cmd) out = Convert.to_map(WFM.Execute(path(".local.bash_output"), cmd)) if Ops.get(out, "exit") != 0 Builtins.y2error("Flushing kernel params failed, output: %1", out) return false end true end |
- (Fixnum) CountSection(find_section)
Find “same” boot sections and return numbers of sections from BootCommon::sections
756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 |
# File '../../src/modules/Bootloader.rb', line 756 def CountSection(find_section) find_section = deep_copy(find_section) Builtins.y2milestone("Finding same boot sections") num_sections = 0 Builtins.foreach(BootCommon.sections) do |section| if Ops.get(section, "root") == Ops.get(find_section, "root") && Ops.get(section, "original_name") == Ops.get(find_section, "original_name") num_sections = Ops.add(num_sections, 1) end end Builtins.y2milestone( "Number of similar section is %2 with %1", find_section, num_sections ) num_sections end |
- (Object) createSELinuxDir
1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 |
# File '../../src/modules/Bootloader.rb', line 1499 def createSELinuxDir path_file = "/selinux" cmd = "ls -d /selinux 2>/dev/null" if BootCommon.enable_selinux if Mode.normal || Mode.installation out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd)) Builtins.y2milestone( "runnning command: \"%1\" and return: %2", cmd, out ) if Ops.get_string(out, "stdout", "") != "/selinux\n" SCR.Execute(path(".target.mkdir"), path_file) else Builtins.y2milestone("Directory /selinux already exist") end else Builtins.y2milestone("Skip creating /selinux directory -> wrong mode") end else Builtins.y2milestone("Skip creating /selinux directory") end nil end |
- (Object) DelDuplicatedSections
Delete duplicated boot sections from BootCommon::sections
778 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 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 |
# File '../../src/modules/Bootloader.rb', line 778 def DelDuplicatedSections if CheckClientForSLERT() removeDummySections return end Builtins.y2milestone("Deleting duplicated boot sections") linux_default = BootCommon.CreateLinuxSection("linux") linux_failsafe = BootCommon.CreateLinuxSection("failsafe") linux_xen = BootCommon.CreateLinuxSection("xen") Builtins.y2milestone( "Proposed section for linux_default: %1", linux_default ) Builtins.y2milestone( "Proposed section for linux_failsafe: %1", linux_failsafe ) Builtins.y2milestone("Proposed section for linux_xen: %1", linux_xen) Builtins.y2milestone( "Boot sections BEFORE deleting: %1", BootCommon.sections ) # obtain number of relative same boot sections for linux_default num_linux_default = CountSection(linux_default) # obtain number of relative same boot sections for linux_failsafe num_linux_failsafe = CountSection(linux_failsafe) # obtain number of relative same boot sections for linux_failsafe num_linux_xen = CountSection(linux_xen) BootCommon.sections = Builtins.filter(BootCommon.sections) do |section| if (Ops.get(section, "name") == Ops.get(linux_default, "name") || Ops.get_string(section, "description", "") == Ops.get(linux_default, "name")) && Ops.greater_than(num_linux_default, 1) || (Ops.get(section, "name") == Ops.get(linux_failsafe, "name") || Ops.get_string(section, "description", "") == Ops.get(linux_failsafe, "name")) && Ops.greater_than(num_linux_failsafe, 1) || (Ops.get(section, "name") == Ops.get(linux_xen, "name") || Ops.get_string(section, "description", "") == Ops.get(linux_xen, "name")) && Ops.greater_than(num_linux_xen, 1) if Ops.get(section, "root") == Ops.get(linux_default, "root") || Ops.get(section, "root") == Ops.get(linux_failsafe, "root") || Ops.get(section, "root") == Ops.get(linux_xen, "root") if Ops.get_string(section, "original_name", "") == "failsafe" num_linux_failsafe = Ops.subtract(num_linux_failsafe, 1) end if Ops.get_string(section, "original_name", "") == "linux" num_linux_default = Ops.subtract(num_linux_default, 1) end if Ops.get_string(section, "original_name", "") == "xen" num_linux_xen = Ops.subtract(num_linux_xen, 1) end Builtins.y2milestone("deleted boot section: %1", section) next false else next true end else next true end true end ResolveSymlinksInSections() FindAndSelectDefault(linux_default) Builtins.y2milestone( "Boot sections AFTER deleting: %1", BootCommon.sections ) nil end |
- (Object) disableSELinuxPAM
1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 |
# File '../../src/modules/Bootloader.rb', line 1554 def disableSELinuxPAM cmd_disable_se = "pam-config -d --selinux 2>/dev/null" cmd_enable_aa = "pam-config -a --apparmor 2>/dev/null" out = SCR.Execute(path(".target.bash_output"), cmd_disable_se) Builtins.y2debug("result of disabling the SELinux PAM module is %1", out) out = SCR.Execute(path(".target.bash_output"), cmd_enable_aa) Builtins.y2debug("result of enabling the AppArmor PAM module is %1", out) nil end |
- (String) DMIRead(bios_data, section, key)
Get entry from DMI data returned by .probe.bios.
1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 |
# File '../../src/modules/Bootloader.rb', line 1327 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) enableSELinuxPAM
1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 |
# File '../../src/modules/Bootloader.rb', line 1542 def enableSELinuxPAM cmd_enable_se = "pam-config -a --selinux 2>/dev/null" cmd_disable_aa = "pam-config -d --apparmor 2>/dev/null" out = SCR.Execute(path(".target.bash_output"), cmd_disable_aa) Builtins.y2debug("result of disabling the AppArmor PAM module is %1", out) out = SCR.Execute(path(".target.bash_output"), cmd_enable) Builtins.y2debug("result of enabling the SELinux PAM module is %1", out) nil end |
- (Object) Export
Export bootloader settings to a map
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File '../../src/modules/Bootloader.rb', line 99 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") if !(loader_type == "grub") # 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) end Builtins.y2milestone("Exporting settings: %1", out) deep_copy(out) end |
- (Object) FindAndSelectDefault(default_sec)
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 |
# File '../../src/modules/Bootloader.rb', line 669 def FindAndSelectDefault(default_sec) default_sec = deep_copy(default_sec) ret = false set_candidate = false default_name = Ops.get(BootCommon.globals, "default", "") default_candidate = "" Builtins.foreach(BootCommon.sections) do |section| if Ops.get(section, "name") == default_name Builtins.y2milestone("Default section was found.") ret = true raise Break else if Ops.get_string(section, "root", "") == Ops.get_string(default_sec, "root", "") && Ops.get_string(section, "type", "") == "image" && Ops.get_string(section, "original_name", "") == "linux" default_candidate = Ops.get_string(section, "name", "") Builtins.y2milestone( "Candidate for default section is: %1", section ) set_candidate = true end end end if !ret if set_candidate && default_candidate != "" Builtins.y2milestone( "Default section will be update to: %1", default_candidate ) Ops.set(BootCommon.globals, "default", default_candidate) ret = true else Builtins.y2error("Default section was not found") end end ret end |
- (Boolean) FlagOnetimeBoot(section)
Set section to boot on next reboot
1256 1257 1258 |
# File '../../src/modules/Bootloader.rb', line 1256 def FlagOnetimeBoot(section) blFlagOnetimeBoot(section) end |
- (String) getDefaultSection
return default section label
968 969 970 971 |
# File '../../src/modules/Bootloader.rb', line 968 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
1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 |
# File '../../src/modules/Bootloader.rb', line 1006 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
1231 1232 1233 |
# File '../../src/modules/Bootloader.rb', line 1231 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
978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 |
# File '../../src/modules/Bootloader.rb', line 978 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 |
- (Object) handleSELinuxPAM
1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 |
# File '../../src/modules/Bootloader.rb', line 1524 def handleSELinuxPAM Builtins.y2milestone("handleSELinuxPAM called") if Mode.normal || Mode.installation if BootCommon.enable_selinux Builtins.y2milestone("call enableSELinuxPAM") enableSELinuxPAM else Builtins.y2milestone("call disableSELinuxPAM") disableSELinuxPAM end else Builtins.y2milestone( "Skip changing SELinux/AppArmor PAM config -> wrong mode" ) end nil end |
- (Boolean) Import(settings)
Import settings from a map
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 152 153 154 155 156 157 158 159 160 161 162 |
# File '../../src/modules/Bootloader.rb', line 121 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) if !(loader_type == "grub") # 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 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.
1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 |
# File '../../src/modules/Bootloader.rb', line 1367 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.
1353 1354 1355 1356 1357 1358 1359 1360 |
# File '../../src/modules/Bootloader.rb', line 1353 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)
For grub1 it returns value for default section and its kernel parameter
Gets value for given parameter in kernel parameters for given flavor.
1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 |
# File '../../src/modules/Bootloader.rb', line 1058 def kernel_param(flavor, key) bl = getLoaderType if bl == "grub" ret = getKernelParam("DEFAULT", key) else 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) end # 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 69 70 |
# 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" Yast.import "BootGRUB" #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 Bootloader() end |
- (Object) modify_kernel_params(*args)
Modify kernel parameters for installed kernels according to values For grub1 for backward compatibility modify default section
1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 |
# File '../../src/modules/Bootloader.rb', line 1101 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 bl = getLoaderType if bl =="grub" # for backward compatibility for grub ret = true values.each do |key, value| ret &&= setKernelParam("DEFAULT", key, value) end return ret 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
336 337 338 339 340 |
# File '../../src/modules/Bootloader.rb', line 336 def PreUpdate Builtins.y2milestone("Running bootloader pre-update stuff") nil end |
- (Object) Propose
Propose bootloader settings
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File '../../src/modules/Bootloader.rb', line 240 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.partitioning_last_change = Storage.GetTargetChangeTime BootCommon.backup_mbr = true Builtins.y2milestone("Proposed settings: %1", Export()) nil end |
- (Boolean) Read
Read settings from disk
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 204 205 206 207 208 209 210 211 212 213 214 |
# File '../../src/modules/Bootloader.rb', line 165 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
1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 |
# File '../../src/modules/Bootloader.rb', line 1262 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() ResolveSymlinksInSections() BootCommon.changed = true BootCommon.location_changed = true end end end nil end |
- (Object) removeDummySections
bnc #450153 YaST bootloader doesn't handle kernel from add-on products in installation Remove all section with empty keys “image” and “initrd”
714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 |
# File '../../src/modules/Bootloader.rb', line 714 def removeDummySections BootCommon.sections = Builtins.filter(BootCommon.sections) do |section| if Ops.get_string(section, "original_name", "") == "linux" || Ops.get_string(section, "original_name", "") == "failsafe" if Builtins.search( Ops.get_string(section, "image", ""), "dummy_image" ) != nil && Builtins.search( Ops.get_string(section, "initrd", ""), "dummy_initrd" ) != nil Builtins.y2milestone("Removed dummy boot section: %1", section) next false else next true end end true end nil end |
- (Object) Reset
Reset bootloader settings
236 237 238 |
# File '../../src/modules/Bootloader.rb', line 236 def Reset ResetEx(true) end |
- (Object) ResetEx(init)
Reset bootloader settings settings should be done
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File '../../src/modules/Bootloader.rb', line 218 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::other_bl = $[]; BootCommon.files_edited = false BootCommon.write_settings = {} blReset(init) nil end |
- (Object) ResolveSymlink(section, key)
Resolve a single symlink in key image_key in section map s
867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 |
# File '../../src/modules/Bootloader.rb', line 867 def ResolveSymlink(section, key) section = deep_copy(section) # The "-m" is needed in case the link is an absolute link, so that it does # not fail to resolve when the root partition is mounted in # Installation::destdir. readlink_cmd = Ops.add("/usr/bin/readlink -n -m ", Installation.destdir) out = {} newval = "" # FIXME: find out why we need WFM::Execute() here (as olh used it above) out = Convert.to_map( WFM.Execute( path(".local.bash_output"), Ops.add(readlink_cmd, Ops.get_string(section, key, "")) ) ) if Ops.get_integer(out, "exit", 0) == 0 && Ops.get_string(out, "stdout", "") != "" newval = Builtins.substring( Ops.get_string(out, "stdout", ""), Builtins.size(Installation.destdir) ) Builtins.y2milestone( "section %1: converting old %2 parameter from %3 to %4", Ops.get_string(section, "name", ""), key, Ops.get_string(section, key, ""), newval ) Ops.set(section, key, newval) else Builtins.y2error( "section %1: failed to remap %2 parameter", Ops.get_string(section, "name", ""), key ) end deep_copy(section) end |
- (Object) ResolveSymlinksInSections
Resolve symlinks in kernel and initrd paths, for existing linux, xen and failsafe sections FIXME: this is the plan B solution, try to solve plan A in BootCommon.ycp:CreateLinuxSection() (line 435)
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 953 954 955 956 957 958 959 960 961 962 963 964 |
# File '../../src/modules/Bootloader.rb', line 912 def ResolveSymlinksInSections Builtins.y2milestone("sections before remapping: %1", BootCommon.sections) # change only linux, failsafe and xen sections BootCommon.sections = Builtins.maplist(BootCommon.sections) do |s| # skip sections that are not linux, xen or failsafe, # or that are not of type "image" (or "xen" <- needed?) if !Builtins.contains( ["linux", "xen", "failsafe"], Ops.get_string(s, "original_name", "") ) || !Builtins.contains(["image", "xen"], Ops.get_string(s, "type", "")) Builtins.y2milestone( "section %1: not linux, xen or failsafe, skipping kernel and initrd remapping", Ops.get_string(s, "name", "") ) next deep_copy(s) end # first, resolve kernel link name if Builtins.haskey(s, "image") # also skip sections that start with a grub device name # "(hd0,7)/boot/vmlinuz", and are not on the default (currently # mounted) boot partition if s["image"].to_s !~ /^\(hd.*\)/ s = ResolveSymlink(s, "image") else Builtins.y2milestone( "section %1: skipping remapping kernel symlink on other partition: %2", Ops.get_string(s, "name", ""), Ops.get_string(s, "image", "") ) end end # resolve initrd link name, but skip if it is on a non-default boot # partition (see above) if Builtins.haskey(s, "initrd") if s["image"].to_s !~ /^\(hd.*\)/ s = ResolveSymlink(s, "initrd") else Builtins.y2milestone( "section %1: skipping remapping initrd symlink on other partition: %2", Ops.get_string(s, "name", ""), Ops.get_string(s, "initrd", "") ) end end deep_copy(s) end Builtins.y2milestone("sections after remapping: %1", BootCommon.sections) nil end |
- (Boolean) RunDelayedUpdates
Set section to boot on next reboot
1247 1248 1249 1250 1251 |
# File '../../src/modules/Bootloader.rb', line 1247 def RunDelayedUpdates # perl-BL delayed section removal BootCommon.RunDelayedUpdates nil end |
- (Boolean) setKernelParam(section, key, value)
use modify_kernel_param instead
set kernel parameter to menu.lst
1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 |
# File '../../src/modules/Bootloader.rb', line 1153 def setKernelParam(section, key, value) if !Mode.config && key == "vga" && (Arch.s390 || Arch.ppc) Builtins.y2warning( "Kernel of this architecture does not support the vga parameter" ) return true end ReadOrProposeIfNeeded() if section == "DEFAULT" section = getDefaultSection elsif section == "LINUX_DEFAULT" section = getProposedDefaultSection end if section.nil? Builtins.y2error("section is nil, so kernel parameter cannot be set") return false end sectnum = -1 index = -1 Builtins.foreach(BootCommon.sections) do |s| index += 1 sectnum = index if Ops.get_string(s, "name", "") == section end if sectnum == -1 Builtins.y2error "Cannot find given section #{section} in sections #{BootCommon.sections.inspect}" return false end if (key == "vga" || key == "root") && value == "true" Builtins.y2error "invalid values passed as kernel param #{key.inspect} => #{value.inspect}" return false end if Builtins.contains(["root", "vga"], key) if value != "false" if key == "vga" Ops.set(BootCommon.sections, [sectnum, "vgamode"], value) else Ops.set(BootCommon.sections, [sectnum, key], value) end # added flag that section was modified bnc #432651 Ops.set(BootCommon.sections, [sectnum, "__changed"], true) else if key == "vga" Ops.set( BootCommon.sections, sectnum, Builtins.remove( Ops.get(BootCommon.sections, sectnum, {}), "vgamode" ) ) else Ops.set( BootCommon.sections, sectnum, Builtins.remove(Ops.get(BootCommon.sections, sectnum, {}), key) ) end end else line = Ops.get_string(BootCommon.sections, [sectnum, "append"], "") line = BootCommon.setKernelParamToLine(line, key, value) Ops.set(BootCommon.sections, [sectnum, "append"], line) # added flag that section was modified bnc #432651 Ops.set(BootCommon.sections, [sectnum, "__changed"], true) end BootCommon.changed = true return true end |
- (Object) setLoaderType(bootloader)
Set type of bootloader Just a wrapper to BootCommon::setLoaderType
1238 1239 1240 1241 1242 |
# File '../../src/modules/Bootloader.rb', line 1238 def setLoaderType(bootloader) BootCommon.setLoaderType(bootloader) nil end |
- (Object) Summary
Display bootloader summary
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
# File '../../src/modules/Bootloader.rb', line 260 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 ret = blSummary # check if default section was changed or not main_section = getProposedDefaultSection return deep_copy(ret) if main_section == nil return deep_copy(ret) if getLoaderType == "none" sectnum = BootCommon.Section2Index(main_section) return deep_copy(ret) if sectnum == -1 if Ops.get_boolean(BootCommon.sections, [sectnum, "__changed"], false) return deep_copy(ret) end filtered_cmdline = Builtins.filterchars( Kernel.GetCmdLine, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" ) if Ops.greater_than(Builtins.size(filtered_cmdline), 0) ret = Builtins.add( ret, Builtins.sformat( # part of summary, %1 is a part of kernel command line _("Added Kernel Parameters: %1"), Kernel.GetCmdLine ) ) end deep_copy(ret) end |
- (Boolean) testAbort
Check whether abort was pressed
74 75 76 77 |
# File '../../src/modules/Bootloader.rb', line 74 def testAbort return false if @test_abort == nil @test_abort.call end |
- (Boolean) Update
Update the whole configuration
331 332 333 |
# File '../../src/modules/Bootloader.rb', line 331 def Update Write() # write also reads the configuration and updates it end |
- (Hash{String => Object}) updateAppend(section)
Function update append -> add console to append
1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 |
# File '../../src/modules/Bootloader.rb', line 1306 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
316 317 318 319 320 321 322 323 324 325 326 327 |
# File '../../src/modules/Bootloader.rb', line 316 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) UpdateGfxMenu
Update the language of GFX menu according to currently selected language
1294 1295 1296 1297 1298 1299 1300 |
# File '../../src/modules/Bootloader.rb', line 1294 def UpdateGfxMenu return true if getLoaderType != "grub" ret = BootCommon.UpdateGfxMenuContents return true if !Mode.normal ret end |
- (Boolean) Write
Write bootloader settings to disk
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 472 473 474 475 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 |
# File '../../src/modules/Bootloader.rb', line 344 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 # update graphics menu where possible UpdateGfxMenu() # 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 # FATE#305557: Enable SELinux for 11.2 createSELinuxDir handleSELinuxPAM 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 else if BootCommon.InstallingToFloppy BootCommon.updateTimeoutPopupForFloppy( BootCommon.getLoaderName(getLoaderType, :summary) ) end end ret end |
- (Boolean) WriteInstallation
Write bootloader settings during installation
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 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 |
# File '../../src/modules/Bootloader.rb', line 533 def WriteInstallation Builtins.y2milestone( "Writing bootloader configuration during installation" ) ret = true if !Mode.live_installation # bnc#449785 - Installing of GRUB fails when using live installer from a USB stick # read current settings... ret = blRead(true, false) # delete duplicated sections DelDuplicatedSections() else # resolve sim links for image and initrd # bnc #393030 - live-CD kernel install/remove leaves broken system ResolveSymlinksInSections() 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 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 # update graphics menu where possible UpdateGfxMenu() # 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 # FATE#305557: Enable SELinux for 11.2 createSELinuxDir handleSELinuxPAM 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 else if BootCommon.InstallingToFloppy BootCommon.updateTimeoutPopupForFloppy( BootCommon.getLoaderName(getLoaderType, :summary) ) end end ret end |