Module: Yast::InstallationMiscInclude

Defined in:
../../src/include/installation/misc.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) AdjustModprobeBlacklist

Function appends blacklisted modules to the /etc/modprobe.d/50-blacklist.conf file.

More information in bugzilla #221815 and #485980



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
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/include/installation/misc.rb', line 61

def AdjustModprobeBlacklist
  # check whether we need to run it
  brokenmodules = Linuxrc.InstallInf("BrokenModules")
  if brokenmodules == "" || brokenmodules == nil
    Builtins.y2milestone("No BrokenModules in install.inf, skipping...")
    return
  end

  # comma-separated list of modules
  blacklisted_modules = Builtins.splitstring(brokenmodules, ", ")

  # run before SCR switch
  blacklist_file = Ops.add(
    Installation.destdir,
    "/etc/modprobe.d/50-blacklist.conf"
  )

  # read the content
  content = ""
  if FileUtils.Exists(blacklist_file)
    content = Convert.to_string(
      SCR.Read(path(".target.string"), blacklist_file)
    )
    if content == nil
      Builtins.y2error("Cannot read %1 file", blacklist_file)
      content = ""
    end
  else
    Builtins.y2warning(
      "File %1 does not exist, installation will create new one",
      blacklist_file
    )
  end

  # creating new entries with comment
  blacklist_file_added = "# Note: Entries added during installation/update (Bug 221815)\n"
  Builtins.foreach(blacklisted_modules) do |blacklisted_module|
    blacklist_file_added = Ops.add(
      blacklist_file_added,
      Builtins.sformat("blacklist %1\n", blacklisted_module)
    )
  end

  # newline if the file is not empty
  content = Ops.add(
    Ops.add(content, content != "" ? "\n\n" : ""),
    blacklist_file_added
  )

  Builtins.y2milestone(
    "Blacklisting modules: %1 in %2",
    blacklisted_modules,
    blacklist_file
  )
  if !SCR.Write(path(".target.string"), blacklist_file, content)
    Builtins.y2error("Cannot write into %1 file", blacklist_file)
  else
    Builtins.y2milestone(
      "Changes into file %1 were written successfully",
      blacklist_file
    )
  end

  nil
end

- (Object) AdjustStepsAccordingToInstallationSettings



347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# File '../../src/include/installation/misc.rb', line 347

def AdjustStepsAccordingToInstallationSettings

  if Installation.add_on_selected == true ||
      Linuxrc.InstallInf("addon") != nil
    ProductControl.EnableModule("add-on")
  else
    ProductControl.DisableModule("add-on")
  end

  if Installation.productsources_selected == true
    ProductControl.EnableModule("productsources")
  else
    ProductControl.DisableModule("productsources")
  end

  Builtins.y2milestone(
    "Disabled Modules: %1, Proposals: %2",
    ProductControl.GetDisabledModules,
    ProductControl.GetDisabledProposals
  )

  UpdateWizardSteps()

  nil
end

- (Object) confirmInstallation

Confirm installation or update. Returns 'true' if the user confirms, 'false' otherwise.



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File '../../src/include/installation/misc.rb', line 192

def confirmInstallation
  heading = ""
  body = ""
  confirm_button_label = ""

  if !Mode.update
    # Heading for confirmation popup before the installation really starts
    heading = HTML.Heading(_("Confirm Installation"))

    # Text for confirmation popup before the installation really starts 1/3
    body = _(
      "<p>Information required for the base installation is now complete.</p>"
    )

    some_destructive = Builtins.find(Storage.GetCommitInfos) do |info|
      Ops.get_boolean(info, :destructive, false)
    end != nil

    if some_destructive
      # Text for confirmation popup before the installation really starts 2/3
      body = Ops.add(
        body,
        _(
          "<p>If you continue now, <b>existing\n" +
            "partitions</b> on your hard disk will be <b>deleted</b> or <b>formatted</b>\n" +
            "(<b>erasing any existing data</b> in those partitions) according to the\n" +
            "installation settings in the previous dialogs.</p>"
        )
      )
    else
      # Text for confirmation popup before the installation really starts 2/3
      body = Ops.add(
        body,
        _(
          "<p>If you continue now, partitions on your\n" +
            "hard disk will be modified according to the installation settings in the\n" +
            "previous dialogs.</p>"
        )
      )
    end

    # Text for confirmation popup before the installation really starts 3/3
    body = Ops.add(
      body,
      _("<p>Go back and check the settings if you are unsure.</p>")
    )

    confirm_button_label = Label.InstallButton
  else
    # Heading for confirmation popup before the update really starts
    heading = "<h3>" + _("Confirm Update") + "</h3>"

    body =
      # Text for confirmation popup before the update really starts 1/3
      _("<p>Information required to perform an update is now complete.</p>") +
        # Text for confirmation popup before the update really starts 2/3
        _(
          "\n" +
            "<p>If you continue now, data on your hard disk will be overwritten\n" +
            "according to the settings in the previous dialogs.</p>"
        ) +
        # Text for confirmation popup before the update really starts 3/3
        _("<p>Go back and check the settings if you are unsure.</p>") 


    # Label for the button that confirms startint the installation
    confirm_button_label = _("Start &Update")
  end

  heading_bg_color = "#A9CEDD"

  display_info = UI.GetDisplayInfo
  text = Ops.get_boolean(display_info, "RichTextSupportsTable", false) ?
    Builtins.sformat(
      "<table bgcolor=\"%1\"><tr><td>%2</td></tr></table>%3",
      heading_bg_color,
      heading,
      body
    ) :
    Ops.add(heading, body)

  size_x = Builtins.tointeger(Ops.get_integer(display_info, "Width", 800))
  size_y = Builtins.tointeger(Ops.get_integer(display_info, "Height", 600))

  # 576x384 support for for ps3
  # bugzilla #273147
  if Ops.greater_or_equal(size_x, 800) && Ops.greater_or_equal(size_y, 600)
    size_x = 70
    size_y = 18
  else
    size_x = 54
    size_y = 15
  end

  UI.OpenDialog(
    VBox(
      VSpacing(0.4),
      HSpacing(size_x), # force width
      HBox(
        HSpacing(0.7),
        VSpacing(size_y), # force height
        RichText(text),
        HSpacing(0.7)
      ),
      ButtonBox(
        PushButton(
          Id(:cancel),
          Opt(:cancelButton, :key_F10, :default),
          Label.BackButton
        ),
        PushButton(Id(:ok), Opt(:okButton, :key_F9), confirm_button_label)
      )
    )
  )

  button = Convert.to_symbol(UI.UserInput)
  UI.CloseDialog

  button == :ok
end

- (Object) EnableRequiredModules

Some client calls have to be called even if using AC



314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# File '../../src/include/installation/misc.rb', line 314

def EnableRequiredModules
  # Lazy init
  if @modules_to_enable_with_AC_on == nil
    feature = ProductFeatures.GetFeature(
      "globals",
      "autoconfiguration_enabled_modules"
    )

    if feature == "" || feature == nil || feature == []
      @modules_to_enable_with_AC_on = []
    else
      @modules_to_enable_with_AC_on = Convert.convert(
        feature,
        :from => "any",
        :to   => "list <string>"
      )
    end

    Builtins.y2milestone(
      "Steps to enable with AC in use: %1",
      @modules_to_enable_with_AC_on
    )
  end

  if @modules_to_enable_with_AC_on != nil
    Builtins.foreach(@modules_to_enable_with_AC_on) do |one_module|
      ProductControl.EnableModule(one_module)
    end
  end

  nil
end

- (Object) initialize_installation_misc(include_target)



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File '../../src/include/installation/misc.rb', line 38

def initialize_installation_misc(include_target)
  Yast.import "UI"

  textdomain "installation"

  Yast.import "Installation"
  Yast.import "Mode"
  Yast.import "ProductControl"
  Yast.import "ProductFeatures"
  Yast.import "Label"
  Yast.import "FileUtils"
  Yast.import "Linuxrc"
  Yast.import "InstData"
  Yast.import "HTML"
  Yast.import "Storage"

  @modules_to_enable_with_AC_on = nil
end

- (Object) InjectFile(filename)



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File '../../src/include/installation/misc.rb', line 127

def InjectFile(filename)
  Builtins.y2milestone("InjectFile: <%1>", filename)
  WFM.Execute(
    path(".local.bash"),
    Ops.add(
      Ops.add(
        Ops.add(Ops.add("/bin/cp ", filename), " "),
        Installation.destdir
      ),
      filename
    )
  )
  nil 

  # this just needs too much memory
  #byteblock copy_buffer = WFM::Read (.local.byte, filename);
  #return SCR::Write (.target.byte, filename, copy_buffer);
end

- (Object) InjectRenamedFile(dir, src_name, target_name)



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File '../../src/include/installation/misc.rb', line 147

def InjectRenamedFile(dir, src_name, target_name)
  Builtins.y2milestone(
    "InjectRenamedFile: <%1/%2> -> <%3/%4/%5>",
    dir,
    src_name,
    Installation.destdir,
    dir,
    target_name
  )
  WFM.Execute(
    path(".local.bash"),
    Builtins.sformat(
      "/bin/cp %1/%2 %3/%4/%5",
      dir,
      src_name,
      Installation.destdir,
      dir,
      target_name
    )
  )
  nil
end

- (Object) SetXENExceptions



373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
# File '../../src/include/installation/misc.rb', line 373

def SetXENExceptions
  # not in text-mode
  if !UI.TextMode
    # bnc #376945
    # problems with keyboard in xen
    if SCR.Read(path(".probe.xen")) == true
      Builtins.y2milestone("XEN in X detected: running xset")
      WFM.Execute(path(".local.bash"), "xset r off; xset m 1") 
      # bnc #433338
      # enabling key-repeating
    else
      Builtins.y2milestone("Enabling key-repeating")
      WFM.Execute(path(".local.bash"), "xset r on")
    end
  end

  nil
end

- (Object) UpdateWizardSteps



170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File '../../src/include/installation/misc.rb', line 170

def UpdateWizardSteps
  wizard_mode = Mode.mode
  Builtins.y2milestone("Switching Steps to %1 ", wizard_mode)

  stage_mode = [
    { "stage" => "initial", "mode" => wizard_mode },
    { "stage" => "continue", "mode" => wizard_mode }
  ]
  Builtins.y2milestone("Updating wizard steps: %1", stage_mode)

  ProductControl.UpdateWizardSteps(stage_mode)

  nil
end

- (Object) WriteSecondStageRequired(scst_required)

Writes to /etc/install.inf whether running the second stage is required This is written to inst-sys and not copied to the installed system (which is already umounted in that time).

See Also:

  • #439572


397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
# File '../../src/include/installation/misc.rb', line 397

def WriteSecondStageRequired(scst_required)
  # writes 'SecondStageRequired' '1' or '0'
  # if such tag exists, it is removed before
  WFM.Execute(
    path(".local.bash"),
    Builtins.sformat(
      "sed --in-place '/^%1: .*/D' %3; echo '%1: %2' >> %3",
      "SecondStageRequired",
      scst_required == false ? "0" : "1",
      "/etc/install.inf"
    )
  )
  Linuxrc.ResetInstallInf

  nil
end