Module: Yast::BootloaderRoutinesLilolikeInclude
- Defined in:
- src/include/bootloader/routines/lilolike.rb
Instance Method Summary (collapse)
-
- (String) ConfigureLocation
ConfigureLocation() Where to install the bootloader.
-
- (Object) DetectDisks
Detect /boot and / (root) partition devices If loader_device is empty or the device is not available as a boot partition, also calls ConfigureLocation to configure loader_device, set selected_location and set the activate flag if needed all these settings are stored in internal variables.
-
- (String) DiskOrderSummary
Get the summary of disks order for the proposal.
-
- (String) FindMBRDisk
FindMbrDisk() try to find the system's mbr device.
- - (Object) getLargestSwapPartition
- - (Object) initialize_bootloader_routines_lilolike(include_target)
-
- (Object) RunDelayedUpdates
Run delayed updates.
-
- (Object) UpdateGlobals
Update global options of bootloader modifies internal sreuctures.
Instance Method Details
- (String) ConfigureLocation
ConfigureLocation() Where to install the bootloader. Returns the type of device where to install: one of “boot”, “root”, “mbr”, “mbr_md” Also sets internal global variable selected_location to this.
FIXME: replace with grub_ConfigureLocation() when lilo et al. have changed to stop using selected_location and loader_device.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'src/include/bootloader/routines/lilolike.rb', line 86 def ConfigureLocation @selected_location = "mbr" # default to mbr @loader_device = @mbrDisk # check whether the /boot partition # - is primary: is_logical -> false # - is on the first disk (with the MBR): disk_is_mbr -> true tm = Storage.GetTargetMap dp = Storage.GetDiskPartition(BootStorage.BootPartitionDevice) disk = Ops.get_string(dp, "disk", "") disk_is_mbr = disk == @mbrDisk dm = Ops.get_map(tm, disk, {}) partitions = Ops.get_list(dm, "partitions", []) is_logical = false extended = nil needed_devices = [BootStorage.BootPartitionDevice] md_info = Md2Partitions(BootStorage.BootPartitionDevice) if md_info != nil && Ops.greater_than(Builtins.size(md_info), 0) disk_is_mbr = false needed_devices = Builtins.maplist(md_info) do |d, b| pdp = Storage.GetDiskPartition(d) p_disk = Ops.get_string(pdp, "disk", "") disk_is_mbr = true if p_disk == @mbrDisk d end end Builtins.y2milestone("Boot partition devices: %1", needed_devices) Builtins.foreach(partitions) do |p| if Ops.get(p, "type") == :extended extended = Ops.get_string(p, "device") elsif Builtins.contains(needed_devices, Ops.get_string(p, "device", "")) && Ops.get(p, "type") == :logical is_logical = true end end Builtins.y2milestone("/boot is on 1st disk: %1", disk_is_mbr) Builtins.y2milestone("/boot is in logical partition: %1", is_logical) Builtins.y2milestone("The extended partition: %1", extended) exit = 0 # if is primary, store bootloader there if disk_is_mbr && !is_logical @selected_location = "boot" @loader_device = BootStorage.BootPartitionDevice @activate = true @activate_changed = true elsif Ops.greater_than(Builtins.size(needed_devices), 1) @loader_device = "mbr_md" @selected_location = "mbr_md" end if !Builtins.contains( BootStorage.getPartitionList(:boot, getLoaderType(false)), @loader_device ) @selected_location = "mbr" # default to mbr @loader_device = @mbrDisk end Builtins.y2milestone( "ConfigureLocation (%1 on %2)", @selected_location, @loader_device ) # set active flag if @selected_location == "mbr" # we are installing into MBR: # if there is an active partition, then we do not need to activate # one (otherwise we do) @activate = Builtins.size(Storage.GetBootPartition(@mbrDisk)) == 0 else # if not installing to MBR, always activate @activate = true end @selected_location end |
- (Object) DetectDisks
Detect /boot and / (root) partition devices If loader_device is empty or the device is not available as a boot partition, also calls ConfigureLocation to configure loader_device, set selected_location and set the activate flag if needed all these settings are stored in internal variables
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/include/bootloader/routines/lilolike.rb', line 169 def DetectDisks # #151501: AutoYaST needs to know the activate flag and the # loader_device; jsrain also said this code is probably a bug: # commenting out, but this may need to be changed and made dependent # on a "clone" flag (i.e. make the choice to provide minimal (i.e. let # YaST do partial proposals on the target system) or maximal (i.e. # stay as closely as possible to this system) info in the AutoYaST XML # file) # if (Mode::config ()) # return; mp = Storage.GetMountPoints mountdata_boot = Ops.get_list(mp, "/boot", Ops.get_list(mp, "/", [])) mountdata_root = Ops.get_list(mp, "/", []) Builtins.y2milestone("mountPoints %1", mp) Builtins.y2milestone("mountdata_boot %1", mountdata_boot) BootStorage.RootPartitionDevice = Ops.get_string(mp, ["/", 0], "") if BootStorage.RootPartitionDevice == "" Builtins.y2error("No mountpoint for / !!") end # if /boot changed, re-configure location BootStorage.BootPartitionDevice = Ops.get_string( mountdata_boot, 0, BootStorage.RootPartitionDevice ) if @mbrDisk == "" || @mbrDisk == nil # mbr detection. @mbrDisk = FindMBRDisk() end if @loader_device == nil || @loader_device == "" || !Builtins.contains( BootStorage.getPartitionList(:boot, getLoaderType(false)), @loader_device ) ConfigureLocation() end nil end |
- (String) DiskOrderSummary
Get the summary of disks order for the proposal
260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'src/include/bootloader/routines/lilolike.rb', line 260 def DiskOrderSummary order = BootStorage.DisksOrder ret = nil if Ops.greater_than(Builtins.size(order), 1) ret = Builtins.sformat( # part of summary, %1 is a list of hard disks device names _("Order of Hard Disks: %1"), Builtins.mergestring(order, ", ") ) end ret end |
- (String) FindMBRDisk
FindMbrDisk() try to find the system's mbr device
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'src/include/bootloader/routines/lilolike.rb', line 54 def FindMBRDisk # check the disks order, first has MBR order = BootStorage.DisksOrder if Ops.greater_than(Builtins.size(order), 0) ret = Ops.get(order, 0, "") Builtins.y2milestone("First disk in the order: %1, using for MBR", ret) return ret end # OK, order empty, use the disk with boot partition mp = Storage.GetMountPoints boot_disk = Ops.get_string( mp, ["/boot", 2], Ops.get_string(mp, ["/", 2], "") ) Builtins.y2milestone( "Disk with boot partition: %1, using for MBR", boot_disk ) boot_disk end |
- (Object) getLargestSwapPartition
238 239 240 241 242 243 244 245 |
# File 'src/include/bootloader/routines/lilolike.rb', line 238 def getLargestSwapPartition swap_sizes = getSwapPartitions swap_parts = Builtins.maplist(swap_sizes) { |name, size| name } swap_parts = Builtins.sort(swap_parts) do |a, b| Ops.greater_than(Ops.get(swap_sizes, a, 0), Ops.get(swap_sizes, b, 0)) end Ops.get(swap_parts, 0, "") end |
- (Object) initialize_bootloader_routines_lilolike(include_target)
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 |
# File 'src/include/bootloader/routines/lilolike.rb', line 23 def initialize_bootloader_routines_lilolike(include_target) textdomain "bootloader" Yast.import "Arch" Yast.import "Mode" Yast.import "Storage" Yast.import "StorageDevices" Yast.import "BootArch" Yast.import "Map" Yast.include include_target, "bootloader/routines/i386.rb" # fallback list for kernel flavors (adapted from Kernel.ycp), used if we have # no better information # order is from special to general, but prefer "default" in favor of "xen" # FIXME: handle "rt" and "vanilla"? # bnc #400526 there is not xenpae anymore... @generic_fallback_flavors = [ "s390", "iseries64", "ppc64", "bigsmp", "default", "xen" ] end |
- (Object) RunDelayedUpdates
Run delayed updates
This is used by perl-Bootloader when it cannot remove sections from the bootloader configuration from the postuninstall-script of the kernel. It writes a command to a delayed update script that is then called here to remove these sections.
The script is deleted after execution.
224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'src/include/bootloader/routines/lilolike.rb', line 224 def RunDelayedUpdates scriptname = "/boot/perl-BL_delayed_exec" cmd = Builtins.sformat("test -x %1 && { cat %1 ; %1 ; }", scriptname) Builtins.y2milestone("running delayed update command: %1", cmd) out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd)) Builtins.y2milestone("command returned %1", out) cmd = Builtins.sformat("rm -f %1", scriptname) out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd)) nil end |
- (Object) UpdateGlobals
Update global options of bootloader modifies internal sreuctures
250 251 252 253 254 255 256 |
# File 'src/include/bootloader/routines/lilolike.rb', line 250 def UpdateGlobals if Ops.get(@globals, "timeout", "") == "" Ops.set(@globals, "timeout", "8") end nil end |