Class: Yast::BootloaderClass
- Inherits:
-
Module
- Object
- Module
- Yast::BootloaderClass
- Defined in:
- ../../src/modules/Bootloader.rb
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.
-
- (String) checkZiplDefault(_def)
bnc #364904 Function check if default section is menu if yes it tries to find default section in list of names from menu section.
-
- (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) getBootDevice
Get device containing /boot directory.
-
- (String) getDefaultSection
return default section label.
-
- (String) getKernelParam(section, key)
get kernel parameters from bootloader configuration file “true” if present key without value.
-
- (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.
-
- (String) getRootDevice
Get root fs device.
- - (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) main
-
- (String) parseListDefault(names, position)
bnc #364904 Function parse zipl list names if default section is menu.
-
- (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.
-
- (Object) setBootDevice(device)
Set device containing /boot directory.
-
- (Boolean) setKernelParam(section, key, value)
set kernel parameter to menu.lst.
-
- (Object) setLoaderType(bootloader)
Set type of bootloader Just a wrapper to BootCommon::setLoaderType.
-
- (Object) setRootDevice(device)
Set root fs device.
-
- (Object) SetWriteMode(settings)
Set settings how to write bootloader.
-
- (Object) Summary
Display bootloader summary.
-
- (Boolean) testAbort
Check whether abort was pressed.
-
- (Boolean) Update(iv, uv)
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
96 97 98 |
# File '../../src/modules/Bootloader.rb', line 96 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
781 782 783 784 785 786 787 |
# File '../../src/modules/Bootloader.rb', line 781 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
87 88 89 90 91 92 93 |
# File '../../src/modules/Bootloader.rb', line 87 def checkUsedStorage if !Storage.InitLibstorage(true) && Mode.normal return false else return true end end |
- (String) checkZiplDefault(_def)
bnc #364904 Function check if default section is menu if yes it tries to find default section in list of names from menu section
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 |
# File '../../src/modules/Bootloader.rb', line 1064 def checkZiplDefault(_def) def_section_name = _def Builtins.foreach(BootCommon.sections) do |section| if Ops.get_string(section, "name", "") == def_section_name if Ops.get_string(section, "type", "") == "menu" def_position = Ops.get_string(section, "default", "") def_section_name = parseListDefault( Ops.get_string(section, "list", ""), def_position ) else raise Break end end end if getLoaderType( ) == "zipl" Builtins.y2milestone("name of default section: %1", def_section_name) def_section_name 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...
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 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 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 |
# File '../../src/modules/Bootloader.rb', line 1430 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
794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 |
# File '../../src/modules/Bootloader.rb', line 794 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
1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 |
# File '../../src/modules/Bootloader.rb', line 1543 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
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 860 861 862 863 864 865 866 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 |
# File '../../src/modules/Bootloader.rb', line 816 def DelDuplicatedSections if CheckClientForSLERT() removeDummySections return end Builtins.y2milestone("Deleting duplicated boot sections") linux_default = {} linux_failsafe = {} linux_xen = {} if Arch.ppc linux_default = BootPOWERLILO.CreateImageSection("linux") else linux_default = BootCommon.CreateLinuxSection("linux") linux_failsafe = BootCommon.CreateLinuxSection("failsafe") linux_xen = BootCommon.CreateLinuxSection("xen") end 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
1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 |
# File '../../src/modules/Bootloader.rb', line 1598 def disableSELinuxPAM cmd_disable_se = "pam-config -d --selinux 2>/dev/null" cmd_enable_aa = "pam-config -a --apparmor 2>/dev/null" out = Convert.to_map(SCR.Execute(path(".target.bash"), cmd_disable_se)) Builtins.y2debug("result of disabling the SELinux PAM module is %1", out) out = Convert.to_map(SCR.Execute(path(".target.bash"), 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.
1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 |
# File '../../src/modules/Bootloader.rb', line 1371 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
1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 |
# File '../../src/modules/Bootloader.rb', line 1586 def enableSELinuxPAM cmd_enable_se = "pam-config -a --selinux 2>/dev/null" cmd_disable_aa = "pam-config -d --apparmor 2>/dev/null" out = Convert.to_map(SCR.Execute(path(".target.bash"), cmd_disable_aa)) Builtins.y2debug("result of disabling the AppArmor PAM module is %1", out) out = Convert.to_map(SCR.Execute(path(".target.bash"), cmd_enable_se)) Builtins.y2debug("result of enabling the SELinux PAM module is %1", out) nil end |
- (Object) Export
Export bootloader settings to a map
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File '../../src/modules/Bootloader.rb', line 102 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)
707 708 709 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 745 746 |
# File '../../src/modules/Bootloader.rb', line 707 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
1286 1287 1288 |
# File '../../src/modules/Bootloader.rb', line 1286 def FlagOnetimeBoot(section) blFlagOnetimeBoot(section) end |
- (String) getBootDevice
Get device containing /boot directory
1260 1261 1262 1263 |
# File '../../src/modules/Bootloader.rb', line 1260 def getBootDevice ReadOrProposeIfNeeded() BootStorage.BootPartitionDevice end |
- (String) getDefaultSection
return default section label
1088 1089 1090 1091 1092 1093 1094 |
# File '../../src/modules/Bootloader.rb', line 1088 def getDefaultSection ReadOrProposeIfNeeded() default_name = checkZiplDefault( Ops.get(BootCommon.globals, "default", "") ) default_name end |
- (String) getKernelParam(section, key)
get kernel parameters from bootloader configuration file "true" if present key without value
1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 |
# File '../../src/modules/Bootloader.rb', line 1128 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
1229 1230 1231 |
# File '../../src/modules/Bootloader.rb', line 1229 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
1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 |
# File '../../src/modules/Bootloader.rb', line 1101 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 |
- (String) getRootDevice
Get root fs device
1244 1245 1246 1247 |
# File '../../src/modules/Bootloader.rb', line 1244 def getRootDevice ReadOrProposeIfNeeded() BootStorage.RootPartitionDevice end |
- (Object) handleSELinuxPAM
1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 |
# File '../../src/modules/Bootloader.rb', line 1568 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
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 163 164 165 166 |
# File '../../src/modules/Bootloader.rb', line 124 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 Ops.get(settings, "loader_type") == "" Ops.set(settings, "loader_type", nil) end loader_type = Ops.get_string(settings, "loader_type") BootCommon.setLoaderType(loader_type) BootCommon.getLoaderType(false) 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 lilo and grub, always correct the bootloader device according to # selected_location (or fall back to value of loader_device) # Why only for lilo and grub? if loader_type == "lilo" || loader_type == "grub" || 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.
1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 |
# File '../../src/modules/Bootloader.rb', line 1411 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.
1397 1398 1399 1400 1401 1402 1403 1404 |
# File '../../src/modules/Bootloader.rb', line 1397 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) 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 71 72 73 |
# 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 "BootELILO" Yast.import "BootLILO" Yast.import "BootGRUB" Yast.import "BootPOWERLILO" # The ppc-LILO File #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 |
- (String) parseListDefault(names, position)
bnc #364904 Function parse zipl list names if default section is menu
1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 |
# File '../../src/modules/Bootloader.rb', line 1031 def parseListDefault(names, position) ret = "" Builtins.y2milestone( "section names (string) list: %1 and default name position in list: %2", names, position ) return ret if names == "" || position == "" if Builtins.search(names, ",") != nil tmp_names = Builtins.deletechars(names, " ") list_names = Builtins.splitstring(tmp_names, ",") ret = Ops.get( list_names, Ops.subtract(Builtins.tointeger(position), 1), "" ) else ret = names end ret end |
- (Object) PreUpdate
Process update actions needed before packages update starts
346 347 348 349 350 |
# File '../../src/modules/Bootloader.rb', line 346 def PreUpdate Builtins.y2milestone("Running bootloader pre-update stuff") nil end |
- (Object) Propose
Propose bootloader settings
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File '../../src/modules/Bootloader.rb', line 244 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
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 215 216 217 218 |
# File '../../src/modules/Bootloader.rb', line 169 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
1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 |
# File '../../src/modules/Bootloader.rb', line 1292 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 Arch.ia64 && Mode.update # FIXME && BootELILO::efi_layout_changed) Builtins.y2milestone( "Reproposing new configuration - IPF, EFI layout has changed" ) Propose() 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"
752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 |
# File '../../src/modules/Bootloader.rb', line 752 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
240 241 242 |
# File '../../src/modules/Bootloader.rb', line 240 def Reset ResetEx(true) end |
- (Object) ResetEx(init)
Reset bootloader settings settings should be done
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
# File '../../src/modules/Bootloader.rb', line 222 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
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 965 |
# File '../../src/modules/Bootloader.rb', line 926 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)
971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 |
# File '../../src/modules/Bootloader.rb', line 971 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 !Builtins.regexpmatch(Ops.get_string(s, "image", ""), "^(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 !Builtins.regexpmatch(Ops.get_string(s, "initrd", ""), "^(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
1277 1278 1279 1280 1281 |
# File '../../src/modules/Bootloader.rb', line 1277 def RunDelayedUpdates # perl-BL delayed section removal BootCommon.RunDelayedUpdates nil end |
- (Object) setBootDevice(device)
Set device containing /boot directory
1267 1268 1269 1270 1271 1272 |
# File '../../src/modules/Bootloader.rb', line 1267 def setBootDevice(device) ReadOrProposeIfNeeded() BootStorage.BootPartitionDevice = device nil end |
- (Boolean) setKernelParam(section, key, value)
set kernel parameter to menu.lst
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 |
# File '../../src/modules/Bootloader.rb', line 1162 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 return false if section == nil 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 false if sectnum == -1 slabel = "" return false if (key == "vga" || key == "root") && value == "true" 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 ret = true ret end |
- (Object) setLoaderType(bootloader)
Set type of bootloader Just a wrapper to BootCommon::setLoaderType
1236 1237 1238 1239 1240 |
# File '../../src/modules/Bootloader.rb', line 1236 def setLoaderType(bootloader) BootCommon.setLoaderType(bootloader) nil end |
- (Object) setRootDevice(device)
Set root fs device
1251 1252 1253 1254 1255 1256 |
# File '../../src/modules/Bootloader.rb', line 1251 def setRootDevice(device) ReadOrProposeIfNeeded() BootStorage.RootPartitionDevice = device nil end |
- (Object) SetWriteMode(settings)
Set settings how to write bootloader
910 911 912 913 914 915 916 917 918 |
# File '../../src/modules/Bootloader.rb', line 910 def SetWriteMode(settings) settings = deep_copy(settings) Builtins.y2milestone("Setting mode for writing: %1", settings) Builtins.foreach(settings) do |k, v| Ops.set(BootCommon.write_settings, k, v) end nil end |
- (Object) Summary
Display bootloader summary
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 314 315 316 317 |
# File '../../src/modules/Bootloader.rb', line 264 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
77 78 79 80 |
# File '../../src/modules/Bootloader.rb', line 77 def testAbort return false if @test_abort == nil @test_abort.call end |
- (Boolean) Update(iv, uv)
Update the whole configuration
337 338 339 340 341 342 343 |
# File '../../src/modules/Bootloader.rb', line 337 def Update(iv, uv) iv = deep_copy(iv) uv = deep_copy(uv) BootCommon.installed_version = deep_copy(iv) BootCommon.update_version = deep_copy(uv) Write() # write also reads the configuration and updates it end |
- (Hash{String => Object}) updateAppend(section)
Function update append -> add console to append
1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 |
# File '../../src/modules/Bootloader.rb', line 1350 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
320 321 322 323 324 325 326 327 328 329 330 331 |
# File '../../src/modules/Bootloader.rb', line 320 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
1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 |
# File '../../src/modules/Bootloader.rb', line 1329 def UpdateGfxMenu return true if getLoaderType != "lilo" && getLoaderType != "grub" ret = BootCommon.UpdateGfxMenuContents return true if !Mode.normal if getLoaderType == "lilo" # This is extreme boolshit, Bootloader::Library has to be called bl_command = "/sbin/lilo >> /var/log/YaST2/y2log_bootloader 2>&1" command_ret = 0 == SCR.Execute(path(".target.bash"), bl_command) if !command_ret Builtins.y2error("Execution of installation command failed") return false end end ret end |
- (Boolean) Write
Write bootloader settings to disk
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 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 |
# File '../../src/modules/Bootloader.rb', line 354 def Write ret = true # proposing anything is irrelevant during update, this forces reading # if settings weren't read before if Mode.update BootCommon.was_proposed = false BootCommon.changed = true BootCommon.location_changed = true BootCommon.getLoaderType(!@repeating_write) end 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"), " ", 2, 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 # Initialize device mapper and LVM in target system if Stage.initial || Mode.update # FIXME: should be handled by partitioner out = Convert.to_map( SCR.Execute( path(".target.bash_output"), "test -f /sbin/devmap_mknod.sh && /sbin/devmap_mknod.sh;" + "test -f /sbin/vgscan && /sbin/vgscan --mknodes" ) ) if Ops.get_integer(out, "exit", 0) != 0 Builtins.y2error("Failed to initialize device mapper") end Builtins.y2milestone( "Device mapper and LVM initialization output: %1", out ) 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.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 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
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 661 662 663 664 665 666 667 668 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 |
# File '../../src/modules/Bootloader.rb', line 571 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 |