Class: Bootloader::DeviceMap
- Inherits:
-
Object
- Object
- Bootloader::DeviceMap
- Extended by:
- Forwardable
- Includes:
- Yast::Logger
- Defined in:
- src/lib/bootloader/device_map.rb
Overview
Class representing grub device map structure
Instance Method Summary collapse
- #clear_mapping ⇒ Object
- #contain_disk?(disk) ⇒ Boolean
- #disks_order ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ DeviceMap
constructor
A new instance of DeviceMap.
- #propose ⇒ Object
- #read ⇒ Object
- #size ⇒ Object
- #to_hash ⇒ Object
- #to_s ⇒ Object
- #write ⇒ Object
Constructor Details
Instance Method Details
#clear_mapping ⇒ Object
50 51 52 53 54 |
# File 'src/lib/bootloader/device_map.rb', line 50 def clear_mapping grub_devices.each do |grub_dev| remove_mapping(grub_dev) end end |
#contain_disk?(disk) ⇒ Boolean
56 57 58 59 60 61 |
# File 'src/lib/bootloader/device_map.rb', line 56 def contain_disk?(disk) disk = grub_device_for(disk) || grub_device_for(::Bootloader::UdevMapping.to_mountby_device(disk)) !disk.nil? end |
#disks_order ⇒ Object
63 64 65 |
# File 'src/lib/bootloader/device_map.rb', line 63 def disks_order sorted_disks.map { |d| system_device_for(d) } end |
#empty? ⇒ Boolean
46 47 48 |
# File 'src/lib/bootloader/device_map.rb', line 46 def empty? size == 0 end |
#propose ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'src/lib/bootloader/device_map.rb', line 67 def propose @model = CFA::Grub2::DeviceMap.new if Yast::Mode.config log.info("Skipping device map proposing in Config mode") return end fill_mapping order_boot_device reduce_to_bios_limit end |
#read ⇒ Object
33 34 35 |
# File 'src/lib/bootloader/device_map.rb', line 33 def read @model.load end |
#size ⇒ Object
42 43 44 |
# File 'src/lib/bootloader/device_map.rb', line 42 def size grub_devices.size end |
#to_hash ⇒ Object
82 83 84 |
# File 'src/lib/bootloader/device_map.rb', line 82 def to_hash grub_devices.each_with_object({}) { |k, r| r[k] = system_device_for(k) } end |
#to_s ⇒ Object
29 30 31 |
# File 'src/lib/bootloader/device_map.rb', line 29 def to_s "Device Map: #{to_hash}" end |
#write ⇒ Object
37 38 39 40 |
# File 'src/lib/bootloader/device_map.rb', line 37 def write log.info "writing device map: #{self}" @model.save end |