Module: Yast::InstallationMiscInclude

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

Instance Method Summary collapse

Instance Method Details

#AdjustStepsAccordingToInstallationSettingsObject



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'src/include/installation/misc.rb', line 188

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

#confirm_button_labelString

Label for the confirmation button before starting the installation or update process

Returns:

  • (String)


150
151
152
# File 'src/include/installation/misc.rb', line 150

def confirm_button_label
  Mode.update ? _("Start &Update") : Label.InstallButton
end

#confirm_installation_textString

Text for confirmation popup before the installation really starts

Returns:

  • (String)


116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'src/include/installation/misc.rb', line 116

def confirm_installation_text
  result = ""

  result << HTML.Heading(_("Confirm Installation"))
  result << _("<p>Information required for the base installation is now complete.</p>")
  result << _(
    "<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>"
  )
  result << _(
    "<p>Go back and check the settings if you are unsure.</p>"
  )
end

#confirm_update_textString

Text for confirmation popup before the update really starts

Returns:

  • (String)


134
135
136
137
138
139
140
141
142
143
144
145
# File 'src/include/installation/misc.rb', line 134

def confirm_update_text
  result = ""

  result << HTML.Heading(_("Confirm Update"))
  result << _("<p>Information required to perform an update is now complete.</p>")
  result << _(
    "\n" \
    "<p>If you continue now, data on your hard disk will be overwritten\n" \
    "according to the settings in the previous dialogs.</p>"
  )
  result << _("<p>Go back and check the settings if you are unsure.</p>")
end

#confirmInstallationBooelan

Note:

moved from clients/inst_doit.ycp to fix bug #219097

Confirm installation or update

Returns:

  • (Booelan)

    true if the user confirms; false otherwise



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
# File 'src/include/installation/misc.rb', line 71

def confirmInstallation
  display_info = UI.GetDisplayInfo
  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(Mode.update ? confirm_update_text : confirm_installation_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

#EnableRequiredModulesObject

Some client calls have to be called even if using AC



155
156
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
182
183
184
185
186
# File 'src/include/installation/misc.rb', line 155

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

    @modules_to_enable_with_AC_on = if feature == "" || feature.nil? || feature == []
      []
    else
      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

#initialize_installation_misc(_include_target) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'src/include/installation/misc.rb', line 24

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"

  @modules_to_enable_with_AC_on = nil
end

#InjectFile(filename) ⇒ Object



42
43
44
45
46
47
48
49
# File 'src/include/installation/misc.rb', line 42

def InjectFile(filename)
  command = "/bin/cp #{filename.shellescape} #{File.join(Installation.destdir,
    filename).shellescape}"
  Builtins.y2milestone("InjectFile: <%1>", filename)
  Builtins.y2debug("Inject command: #{command}")
  WFM.Execute(path(".local.bash"), command)
  nil
end

#SetXENExceptionsObject



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'src/include/installation/misc.rb', line 213

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"), "/usr/bin/xset r off; /usr/bin/xset m 1")
      # bnc #433338
      # enabling key-repeating
    else
      Builtins.y2milestone("Enabling key-repeating")
      WFM.Execute(path(".local.bash"), "/usr/bin/xset r on")
    end
  end

  nil
end

#UpdateWizardStepsObject



51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'src/include/installation/misc.rb', line 51

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

#WriteSecondStageRequired(scst_required) ⇒ Object

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


237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# File 'src/include/installation/misc.rb', line 237

def WriteSecondStageRequired(scst_required)
  # writes 'SecondStageRequired' '1' or '0'
  # if such tag exists, it is removed before
  WFM.Execute(
    path(".local.bash"),
    Builtins.sformat(
      "/usr/bin/sed --in-place '/^SecondStageRequired: .*/D' /etc/install.inf; " \
      "/usr/bin/echo 'SecondStageRequired: %1' >> /etc/install.inf",
      (scst_required == false) ? "0" : "1"
    )
  )
  # Is it really needed? It will enforce a read of /etc/install.inf from
  # any step after resetting it.
  Linuxrc.ResetInstallInf

  nil
end