Module: Yast::BootloaderRoutinesSwitcherInclude

Defined in:
src/include/bootloader/routines/switcher.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) blDialogs

Get the loader-specific dialogs

Returns:

  • a map of loader-specific dialogs



230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'src/include/bootloader/routines/switcher.rb', line 230

def blDialogs
  functions = getFunctions(BootCommon.getLoaderType(false))
  toEval = Convert.convert(
    Ops.get(functions, "dialogs"),
    :from => "any",
    :to   => "map <string, symbol ()> ()"
  )
  if toEval != nil
    return toEval.call
  else
    return {}
  end
end

- (Hash) blExport

Export bootloader-specific settings

Returns:

  • (Hash)

    of settings



55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'src/include/bootloader/routines/switcher.rb', line 55

def blExport
  functions = getFunctions(BootCommon.getLoaderType(false))
  toEval = Convert.convert(
    Ops.get(
      functions,
      "export",
      fun_ref(BootCommon.method(:Export), "map ()")
    ),
    :from => "any",
    :to   => "map ()"
  )
  toEval.call
end

- (Boolean) blFlagOnetimeBoot(section)

Set section to boot on next reboot for this type of bootloader

Parameters:

  • section (String)

    string section to boot

Returns:

  • (Boolean)

    true on success



247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'src/include/bootloader/routines/switcher.rb', line 247

def blFlagOnetimeBoot(section)
  functions = getFunctions(BootCommon.getLoaderType(false))
  toEval = Convert.convert(
    Ops.get(functions, "flagonetimeboot"),
    :from => "any",
    :to   => "boolean (string)"
  )
  if toEval != nil
    return toEval.call(section)
  else
    return false
  end
end

- (Boolean) blImport(settings)

Import settings to bootloader

Parameters:

  • settings (Hash)

    map of settingss

Returns:

  • (Boolean)

    true on success



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'src/include/bootloader/routines/switcher.rb', line 72

def blImport(settings)
  settings = deep_copy(settings)
  functions = getFunctions(BootCommon.getLoaderType(false))
  toEval = Convert.convert(
    Ops.get(
      functions,
      "import",
      fun_ref(BootCommon.method(:Import), "boolean (map)")
    ),
    :from => "any",
    :to   => "boolean (map)"
  )
  toEval.call(settings)
end

- (Object) blPropose

Propose bootloader settings



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'src/include/bootloader/routines/switcher.rb', line 124

def blPropose
  functions = getFunctions(BootCommon.getLoaderType(false))
  toEval = Convert.convert(
    Ops.get(
      functions,
      "propose",
      fun_ref(BootCommon.method(:Propose), "void ()")
    ),
    :from => "any",
    :to   => "void ()"
  )
  toEval.call

  nil
end

- (Boolean) blRead(reread, avoid_reading_device_map)

Read bootloader-specific settings

Parameters:

  • reread (Boolean)

    boolean true to force rereading the settings from the disk

Returns:

  • (Boolean)

    true on success



90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'src/include/bootloader/routines/switcher.rb', line 90

def blRead(reread, avoid_reading_device_map)
  functions = getFunctions(BootCommon.getLoaderType(false))
  toEval = Convert.convert(
    Ops.get(
      functions,
      "read",
      fun_ref(BootCommon.method(:Read), "boolean (boolean, boolean)")
    ),
    :from => "any",
    :to   => "boolean (boolean, boolean)"
  )
  toEval.call(reread, avoid_reading_device_map)
end

- (Object) blReset(init)

Reset bootloader-specific settings settings should be done

Parameters:

  • init (Boolean)

    boolean true if basic initialization of system-dependent



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'src/include/bootloader/routines/switcher.rb', line 107

def blReset(init)
  functions = getFunctions(BootCommon.getLoaderType(false))
  toEval = Convert.convert(
    Ops.get(
      functions,
      "reset",
      fun_ref(BootCommon.method(:Reset), "void (boolean)")
    ),
    :from => "any",
    :to   => "void (boolean)"
  )
  toEval.call(init)

  nil
end

- (Boolean) blSave(clean, init, flush)

Save bootloader cfg. files to the cache of the pluglib

Parameters:

  • clean (Boolean)

    boolean true to perform checks on the settings

  • init (Boolean)

    boolean true to reinitialize the library

  • flush (Boolean)

    boolean true to flush the settings to the disk

Returns:

  • (Boolean)

    true on success



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'src/include/bootloader/routines/switcher.rb', line 145

def blSave(clean, init, flush)
  functions = getFunctions(BootCommon.getLoaderType(false))

  toEval = Convert.convert(
    Ops.get(
      functions,
      "save",
      fun_ref(
        BootCommon.method(:Save),
        "boolean (boolean, boolean, boolean)"
      )
    ),
    :from => "any",
    :to   => "boolean (boolean, boolean, boolean)"
  )
  toEval.call(clean, init, flush)
end

- (Object) blSummary

Get cfg. summary

Returns:

  • a list summary items



165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'src/include/bootloader/routines/switcher.rb', line 165

def blSummary
  functions = getFunctions(BootCommon.getLoaderType(false))
  toEval = Convert.convert(
    Ops.get(
      functions,
      "summary",
      fun_ref(BootCommon.method(:Summary), "list <string> ()")
    ),
    :from => "any",
    :to   => "list <string> ()"
  )
  toEval.call
end

- (Object) blUpdate

Update bootloader-specific settings



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'src/include/bootloader/routines/switcher.rb', line 180

def blUpdate
  functions = getFunctions(BootCommon.getLoaderType(false))
  toEval = Convert.convert(
    Ops.get(
      functions,
      "update",
      fun_ref(BootCommon.method(:Update), "void ()")
    ),
    :from => "any",
    :to   => "void ()"
  )
  toEval.call

  nil
end

- (Object) blWidgetMaps

Get description maps of loader-specific widgets

Returns:

  • a map containing description of all loader-specific widgets



214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'src/include/bootloader/routines/switcher.rb', line 214

def blWidgetMaps
  functions = getFunctions(BootCommon.getLoaderType(false))
  toEval = Convert.convert(
    Ops.get(functions, "widgets"),
    :from => "any",
    :to   => "map <string, map <string, any>> ()"
  )
  if toEval != nil
    return toEval.call
  else
    return {}
  end
end

- (Boolean) blWrite

Do the bootloader installation

Returns:

  • (Boolean)

    true on success



198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'src/include/bootloader/routines/switcher.rb', line 198

def blWrite
  functions = getFunctions(BootCommon.getLoaderType(false))
  toEval = Convert.convert(
    Ops.get(
      functions,
      "write",
      fun_ref(BootCommon.method(:Write), "boolean ()")
    ),
    :from => "any",
    :to   => "boolean ()"
  )
  toEval.call
end

- (Hash) getFunctions(bootloader)

Get map of main functions for bootloader

Parameters:

  • bootloader (String)

    string bootloader name

Returns:

  • (Hash)

    of function



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'src/include/bootloader/routines/switcher.rb', line 29

def getFunctions(bootloader)
  return {} if bootloader == nil || bootloader == ""
  bl_functions = {
    "grub2"     => fun_ref(
      BootGRUB2.method(:GetFunctions),
      "map <string, any> ()"
    ),
    "grub2-efi" => fun_ref(
      BootGRUB2EFI.method(:GetFunctions),
      "map <string, any> ()"
    )
  }
  gf = Convert.convert(
    Ops.get(bl_functions, bootloader),
    :from => "any",
    :to   => "map <string, any> ()"
  )
  if gf == nil
    Builtins.y2warning("No bootloader-specific functions specified")
    return {}
  end
  gf.call
end

- (Object) initialize_bootloader_routines_switcher(include_target)



20
21
22
23
24
# File 'src/include/bootloader/routines/switcher.rb', line 20

def initialize_bootloader_routines_switcher(include_target)
  Yast.import "BootGRUB2"
  Yast.import "BootGRUB2EFI"
  Yast.import "BootCommon"
end