Class: Yast::InstBootloaderClient

Inherits:
Client
  • Object
show all
Defined in:
src/clients/inst_bootloader.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) main



18
19
20
21
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'src/clients/inst_bootloader.rb', line 18

def main
  textdomain "bootloader"

  Yast.import "Bootloader"
  Yast.import "BootCommon"
  Yast.import "Installation"
  Yast.import "GetInstArgs"
  Yast.import "Mode"

  Builtins.y2milestone("starting inst_bootloader")

  if GetInstArgs.going_back # going backwards?
    return :auto # don't execute this once more
  end

  # for upgrade that is from grub2 to grub2 and user do not want
  # any changes, just quit (bnc#951731)
  if Mode.update && !(BootCommon.was_read || BootCommon.was_proposed)
    Builtins.y2milestone("clean upgrade, do nothing")
    return :auto
  end

  # if BL config is created from scratch, prepare config files
  # in order not to touch old files (bnc#899743)
  if Mode.installation || !BootCommon.was_read
    Bootloader.blSave(false, false, false)
    @files = BootCommon.GetFilesContents

    Builtins.y2milestone("contents FILES: %1", @files)

    # F#300779 - Install diskless client (NFS-root)
    # kokso: bootloader will not be installed
    @device = BootCommon.getBootDisk

    if @device == "/dev/nfs"
      Builtins.y2milestone(
        "inst_bootloader -> Boot partition is nfs type, bootloader will not be installed."
      )
      BootCommon.InitializeLibrary(true, "none")
      BootCommon.setLoaderType("none")
    else
      Builtins.foreach(@files) do |file, content|
        last = Builtins.findlastof(file, "/")
        path_file = Builtins.substring(file, 0, last)
        WFM.Execute(
          path(".local.mkdir"),
          Ops.add(Installation.destdir, path_file)
        )
        Builtins.y2milestone("writing file: %1", file)
        WFM.Write(
          path(".local.string"),
          Ops.add(Installation.destdir, file),
          content
        )
      end
    end
  end

  # FATE #302245 save kernel args etc to /etc/sysconfig/bootloader
  sysconfig = ::Bootloader::Sysconfig.new(
    bootloader:  Bootloader.getLoaderType,
    secure_boot: BootCommon.getSystemSecureBootStatus(false)

  )
  sysconfig.pre_write

  Builtins.y2milestone("finish inst_bootloader")

  :auto
end