Class: Bootloader::AutoyastConverter

Inherits:
Object
  • Object
show all
Extended by:
Yast::Logger
Defined in:
src/lib/bootloader/autoyast_converter.rb

Overview

Converter between internal configuration model and autoyast serialization of configuration.

Constant Summary

Class Method Summary (collapse)

Class Method Details

+ (Object) export(config)



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'src/lib/bootloader/autoyast_converter.rb', line 44

def export(config)
  log.info "exporting config #{config.inspect}"

  bootloader_type = config.name
  res = { "loader_type" => bootloader_type }

  return res if bootloader_type == "none"

  res["global"] = {}
  global = res["global"]
  export_grub2(global, config) if config.name == "grub2"
  export_stage1(global, config.stage1) if config.respond_to?(:stage1)
  export_default(global, config.grub_default)
  # Do not export device map as device name are very unpredictable and is used only as
  # work-around when automatic ones do not work for what-ever reasons ( it can really safe
  # your day in L3 )

  res
end

+ (Object) import(data)



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'src/lib/bootloader/autoyast_converter.rb', line 25

def import(data)
  log.info "import data #{data.inspect}"

  bootloader = bootloader_from_data(data)
  return bootloader if bootloader.name == "none"
  # let it be empty if not defined to keep code simplier as effect is same
  data["global"] ||= {}

  import_grub2(data, bootloader)
  import_stage1(data, bootloader)
  import_default(data, bootloader.grub_default)
  import_device_map(data, bootloader)
  # TODO: import Initrd

  log.warn "autoyast profile contain sections which won't be processed" if data["sections"]

  bootloader
end