Class: Yast::BootZIPLClass

Inherits:
Module
  • Object
show all
Defined in:
../../src/modules/BootZIPL.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) BootZIPL

Constructor



304
305
306
307
308
309
310
311
312
313
314
315
316
# File '../../src/modules/BootZIPL.rb', line 304

def BootZIPL
  Ops.set(
    BootCommon.bootloader_attribs,
    "zipl",
    {
      "loader_name"       => "zipl",
      "required_packages" => ["s390-tools"],
      "initializer"       => fun_ref(method(:Initializer), "void ()")
    }
  )

  nil
end

- (Object) CreateLinuxSection(title)

wrapper function to adjust to special zipl needs



146
147
148
149
150
151
# File '../../src/modules/BootZIPL.rb', line 146

def CreateLinuxSection(title)
  section = BootCommon.CreateLinuxSection(title)
  Ops.set(section, "target", "/boot/zipl")

  deep_copy(section)
end

- (Object) Dialogs



227
228
229
# File '../../src/modules/BootZIPL.rb', line 227

def Dialogs
  {}
end

- (Boolean) FlagOnetimeBoot(section)

Set section to boot on next reboot.

Parameters:

  • section (String)

    string section to boot

Returns:

  • (Boolean)

    true on success



234
235
236
237
# File '../../src/modules/BootZIPL.rb', line 234

def FlagOnetimeBoot(section)
  # For now a dummy
  true
end

- (Object) GetFunctions

Return map of provided functions

Returns:

  • a map of functions (eg. $[“write”::Write])



249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# File '../../src/modules/BootZIPL.rb', line 249

def GetFunctions
  {
    #"export"		: Export,
    #"import"		: Import,
    "read"            => fun_ref(
      method(:Read),
      "boolean (boolean, boolean)"
    ),
    #"reset"		: Reset,
    "propose"         => fun_ref(
      method(:Propose),
      "void ()"
    ),
    "save"            => fun_ref(
      method(:Save),
      "boolean (boolean, boolean, boolean)"
    ),
    "summary"         => fun_ref(method(:Summary), "list <string> ()"),
    "update"          => fun_ref(method(:Update), "void ()"),
    "write"           => fun_ref(method(:Write), "boolean ()"),
    "widgets"         => fun_ref(
      method(:ziplWidgets),
      "map <string, map <string, any>> ()"
    ),
    "dialogs"         => fun_ref(
      method(:Dialogs),
      "map <string, symbol ()> ()"
    ),
    "section_types"   => fun_ref(
      method(:zipl_section_types),
      "list <string> ()"
    ),
    "flagonetimeboot" => fun_ref(
      method(:FlagOnetimeBoot),
      "boolean (string)"
    )
  }
end

- (Object) Initializer

Initializer of S390 bootloader



289
290
291
292
293
294
295
296
297
298
299
300
301
# File '../../src/modules/BootZIPL.rb', line 289

def Initializer
  Builtins.y2milestone("Called ZIPL initializer")
  BootCommon.current_bootloader_attribs = {
    "section_title" => "label",
    "propose"       => true,
    "read"          => true,
    "scratch"       => true
  }

  BootCommon.InitializeLibrary(false, "zipl")

  nil
end

- (Object) main



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
# File '../../src/modules/BootZIPL.rb', line 24

def main
  Yast.import "UI"

  textdomain "bootloader"

  Yast.import "BootArch"
  Yast.import "BootCommon"
  Yast.import "Installation"
  Yast.import "Kernel"
  Yast.import "Mode"
  Yast.import "Stage"

  Yast.include self, "bootloader/zipl/helps.rb"
  Yast.include self, "bootloader/routines/popups.rb"


  # local data
  @hw_descr = {
    "ctc"  => {
      "skeleton" => "hwcfg-ctc",
      "target"   => "ctc-bus-ccw-%1",
      "options"  => { "CCW_CHAN_IDS" => "%1 %2", "CCW_CHAN_MODE" => "%3" }
    },
    "qeth" => {
      "skeleton" => "hwcfg-qeth",
      "target"   => "qeth-bus-ccw-%1",
      "options"  => {
        "CCW_CHAN_IDS"  => "%1 %2 %3",
        "CCW_CHAN_MODE" => "%4"
      }
    },
    "iucv" => { "skeleton" => "hwcfg-iucv", "target" => "iucv-id-%1" }
  }
  BootZIPL()
end

- (Object) Propose

Propose bootloader settings



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File '../../src/modules/BootZIPL.rb', line 157

def Propose
  BootCommon.DetectDisks
  parameters = BootArch.DefaultKernelParams("")

  BootCommon.globals = { "default" => "menu" }

  BootCommon.sections = [
    {
      "name"    => "menu",
      "default" => "1",
      "prompt"  => "true",
      "target"  => "/boot/zipl",
      "timeout" => "10",
      "list"    => Ops.add(
        Ops.add(BootCommon.translateSectionTitle("ipl"), ","),
        BootCommon.translateSectionTitle("failsafe")
      ),
      "type"    => "menu"
    },
    CreateLinuxSection("ipl"),
    CreateLinuxSection("failsafe")
  ]

  nil
end

- (Boolean) Read(reread, avoid_reading_device_map)

Read settings from disk internal data

Parameters:

  • reread (Boolean)

    boolean true to force reread settings from system

  • avoid_reading_device_map (Boolean)

    do not read new device map from file, use

Returns:

  • (Boolean)

    true on success



135
136
137
138
139
140
141
# File '../../src/modules/BootZIPL.rb', line 135

def Read(reread, avoid_reading_device_map)
  BootCommon.InitializeLibrary(reread, "zipl")
  BootCommon.ReadFiles(avoid_reading_device_map) if reread
  BootCommon.DetectDisks
  ret = BootCommon.Read(false, avoid_reading_device_map)
  ret
end

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

Save all bootloader configuration files to the cache of the PlugLib PlugLib must be initialized properly !!!

Parameters:

  • clean (Boolean)

    boolean true if settings should be cleaned up (checking their correctness, supposing all files are on the disk

  • init (Boolean)

    boolean true to init the library

  • flush (Boolean)

    boolean true to flush settings to the disk

Returns:

  • (Boolean)

    true if success



191
192
193
194
195
196
197
198
# File '../../src/modules/BootZIPL.rb', line 191

def Save(clean, init, flush)
  ret = BootCommon.Save(clean, init, flush)

  return ret if Mode.normal

  updateHardwareConfig
  ret
end

- (Object) Summary

Display bootloader summary

Returns:

  • a list of summary lines



203
204
205
206
# File '../../src/modules/BootZIPL.rb', line 203

def Summary
  # summary
  [_("Install S390 Boot Loader")]
end

- (Object) Update

Update read settings to new version of configuration files



210
211
212
213
214
# File '../../src/modules/BootZIPL.rb', line 210

def Update
  Builtins.y2milestone("No update functionality implemented")

  nil
end

- (Boolean) updateHardwareConfig

Update /etc/sysconfig/hardware configuration Use data from install.inf file

Returns:

  • (Boolean)

    true on success



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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
# File '../../src/modules/BootZIPL.rb', line 65

def updateHardwareConfig
  return true if !Stage.initial || Mode.update

  failed = false
  cfg = Convert.to_string(SCR.Read(path(".etc.install_inf.Hardware")))
  Builtins.y2milestone(
    "Read hardware configuration from install.inf: %1",
    cfg
  )
  l = Builtins.splitstring(cfg, ";")
  Builtins.foreach(l) do |s|
    args = Builtins.splitstring(s, ",")
    args = Builtins.maplist(args) do |a|
      while a != "" && Builtins.substring(a, 0, 1) == " "
        a = Builtins.substring(a, 1)
      end
      while a != "" &&
          Builtins.substring(a, Ops.subtract(Builtins.size(a), 1), 1) == " "
        a = Builtins.substring(a, 0, Ops.subtract(Builtins.size(a), 1))
      end
      a
    end
    key = Ops.get(args, 0, "")
    a1 = Ops.get(args, 1, "")
    a2 = Ops.get(args, 2, "")
    a3 = Ops.get(args, 3, "")
    a4 = Ops.get(args, 4, "")
    if key != ""
      descr = Ops.get(@hw_descr, key, {})
      src = Ops.get_string(descr, "skeleton", "")
      dst = Builtins.sformat(
        Ops.get_string(descr, "target", ""),
        a1,
        a2,
        a3,
        a4
      )
      Builtins.y2milestone("Template: %1, Target: %2", src, dst)
      command = Builtins.sformat(
        "/bin/cp /etc/sysconfig/hardware/skel/%1 /etc/sysconfig/hardware/hwcfg-%2",
        src,
        dst
      )
      if 0 != SCR.Execute(path(".target.bash"), command)
        Report.Error(
          # error report
          _("Copying hardware configuration template failed.")
        )
        failed = true
      end
      p = Builtins.add(path(".sysconfig.hardware.value"), dst)
      Builtins.foreach(Ops.get_map(descr, "options", {})) do |k, v|
        op = Builtins.add(p, k)
        v = Builtins.sformat(v, a1, a2, a3, a4)
        failed = true if !SCR.Write(op, v)
      end
    end
  end
  failed = true if !SCR.Write(path(".sysconfig.hardware"), nil)
  failed
end

- (Boolean) Write

Write bootloader settings to disk

Returns:

  • (Boolean)

    true on success



219
220
221
222
223
224
# File '../../src/modules/BootZIPL.rb', line 219

def Write
  ret = BootCommon.UpdateBootloader
  ret = ret && BootCommon.InitializeBootloader
  ret = false if ret == nil
  ret
end

- (Object) zipl_section_types



239
240
241
# File '../../src/modules/BootZIPL.rb', line 239

def zipl_section_types
  ["image", "menu", "dump"]
end

- (Object) ziplWidgets



243
244
245
# File '../../src/modules/BootZIPL.rb', line 243

def ziplWidgets
  {}
end