Class: Yast::InstSystemAnalysisClient

Inherits:
Client
  • Object
show all
Includes:
Logger
Defined in:
src/lib/installation/clients/inst_system_analysis.rb

Instance Method Summary collapse

Constructor Details

#initializeInstSystemAnalysisClient

Returns a new instance of InstSystemAnalysisClient.


34
35
36
37
# File 'src/lib/installation/clients/inst_system_analysis.rb', line 34

def initialize
  super
  textdomain "installation"
end

Instance Method Details

#ActionFireWireObject

FireWire (ieee1394) initialization


174
175
176
177
178
# File 'src/lib/installation/clients/inst_system_analysis.rb', line 174

def ActionFireWire
  Hotplug.StartFireWire

  true
end

#ActionHDDProbeObject

Hard disks initialization

Raises:

  • (AbortException)

    if an error is found and the installation must be aborted because of such error


184
185
186
187
188
189
190
191
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
# File 'src/lib/installation/clients/inst_system_analysis.rb', line 184

def ActionHDDProbe
  inhibit_storage

  init_storage
  devicegraph = storage_manager.probed

  # additonal error when HW was not found
  drivers_info = _(
    "\nCheck 'drivers.suse.com' if you need specific hardware drivers for installation."
  )

  drivers_info = "" if !ProductFeatures.GetBooleanFeature("globals", "show_drivers_info")

  # This error message is only shown when no disks where found during a normal
  # installation. The autoinstallation case will be handled later by AutoYaST at
  # https://github.com/yast/yast-autoinstallation/blob/8e414637d8157462bee5e1ee29c5d2e747754670/src/modules/AutoinstStorage.rb#L334
  if devicegraph.empty? && !Mode.auto
    Report.Error(
      Builtins.sformat(
        # TRANSLATORS: Error pop-up
        _(
          "No hard disks were found for the installation.\n" \
          "Please check your hardware!\n" \
          "%1\n"
        ),
        drivers_info
      )
    )

    return false
  end

  true
end

#ActionUSBObject

USB initialization


167
168
169
170
171
# File 'src/lib/installation/clients/inst_system_analysis.rb', line 167

def ActionUSB
  Hotplug.StartUSB

  true
end

#FilesFromOlderSystemsObject


248
249
250
251
252
253
254
255
256
257
# File 'src/lib/installation/clients/inst_system_analysis.rb', line 248

def FilesFromOlderSystems
  # FATE #300421: Import ssh keys from previous installations
  # FATE #120103: Import Users From Existing Partition
  # FATE #302980: Simplified user config during installation
  Builtins.y2milestone("PreInstallFunctions -- start --")
  WFM.CallFunction("inst_pre_install", [])
  Builtins.y2milestone("PreInstallFunctions -- end --")

  true
end

#InitInstallationRepositoriesObject


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
# File 'src/lib/installation/clients/inst_system_analysis.rb', line 219

def InitInstallationRepositories
  # disable callbacks
  PackageCallbacks.RegisterEmptyProgressCallbacks

  ret = true

  Packages.InitializeCatalogs

  if Packages.InitFailed
    # popup message
    Popup.Message(
      _("Failed to initialize the software repositories.\nAborting the installation.")
    )
    ret = false
  else
    @packager_initialized = true
    Packages.InitializeAddOnProducts

    # bnc#886608: Adjusting product name (for &product; macro) right after we
    # initialize libzypp and get the base product name (intentionally not translated)
    UI.SetProductName(Product.name || "SUSE Linux")
  end

  # reregister callbacks
  PackageCallbacks.RestorePreviousProgressCallbacks

  ret
end

#mainObject


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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'src/lib/installation/clients/inst_system_analysis.rb', line 39

def main
  Yast.import "UI"

  # Require here to break dependency cycle (bsc#1070996)
  require "autoinstall/activate_callbacks"

  Yast.import "Arch"
  Yast.import "GetInstArgs"
  Yast.import "Hotplug"
  Yast.import "InstData"
  Yast.import "Kernel"
  Yast.import "Packages"
  Yast.import "Popup"
  Yast.import "Product"
  Yast.import "ProductFeatures"
  Yast.import "Progress"
  Yast.import "Report"
  Yast.import "Wizard"
  Yast.import "PackageCallbacks"

  Yast.include self, "installation/misc.rb"
  Yast.include self, "packager/storage_include.rb"
  Yast.include self, "packager/load_release_notes.rb"

  # This dialog in not interactive
  # always return `back when came from the previous dialog
  return :back if GetInstArgs.going_back

  @packager_initialized = false
  @inhibitors = nil

  Wizard.SetContents(_("Analyzing the Computer"), Empty(), "", false, false)

  # Do hardware probing
  #
  # This must happen before submodule descriptions are initialized; module
  # constructors might depend on it.
  # In autoinst mode, this has been called already.

  actions_todo = []
  actions_doing = []
  actions_functions = []

  Builtins.y2milestone("Probing done: %1", Installation.probing_done)
  # skip part of probes as it doesn't change, but some parts (mostly disks
  # that can be activated) need rerun see BNC#865579
  if !Installation.probing_done
    # TRANSLATORS: progress steps in system probing
    if !(Arch.s390 || Arch.board_iseries)
      actions_todo      << _("Probe USB devices")
      actions_doing     << _("Probing USB devices...")
      actions_functions << fun_ref(method(:ActionUSB), "boolean ()")

      actions_todo      << _("Probe FireWire devices")
      actions_doing     << _("Probing FireWire devices...")
      actions_functions << fun_ref(method(:ActionFireWire), "boolean ()")
    end

    WFM.CallFunction("inst_features", [])
  end

  actions_todo      << _("Probe hard disks")
  actions_doing     << _("Probing hard disks...")
  actions_functions << fun_ref(method(:ActionHDDProbe), "boolean ()")

  # FATE #302980: Simplified user config during installation
  actions_todo      << _("Search for system files")
  actions_doing     << _("Searching for system files...")
  actions_functions << fun_ref(method(:FilesFromOlderSystems), "boolean ()")

  # skip the repository initialization on both Online and Full medium,
  # do it only on the standard medium layout (openSUSE Leap)
  skip_software = Mode.update && !Y2Packager::MediumType.standard?
  # we cannot initialize during update software manager until we know target partition
  # as base product is not known
  if !skip_software
    actions_todo      << _("Initialize software manager")
    actions_doing     << _("Initializing software manager...")
    actions_functions << fun_ref(method(:InitInstallationRepositories), "boolean ()")
  end

  Progress.New(
    # TRANSLATORS: dialog caption
    _("System Probing"),
    " ",
    actions_todo.size,
    actions_todo,
    actions_doing,
    # TRANSLATORS: dialog help
    _("YaST is probing computer hardware and installed systems now.")
  )

  actions_functions.each do |run_function|
    Progress.NextStage
    # Bugzilla #298049
    # Allow to abort the probing
    ui_ret = UI.PollInput
    if ui_ret == :abort
      Builtins.y2milestone("Abort pressed")

      if Popup.ConfirmAbort(:painless)
        Builtins.y2warning("User decided to abort the installation")
        return :abort
      end
    end

    begin
      ret = run_function.call
      Builtins.y2milestone("Function %1 returned %2", run_function, ret)
    rescue AbortException
      return :abort
    end

    # Return in case of restart is needed
    return ret if ret == :restart_yast
  end
  Installation.probing_done = true

  Progress.Finish

  return :abort if !skip_software && !@packager_initialized

  :next
end