Class: Yast::InstallationClass

Inherits:
Module
  • Object
show all
Defined in:
library/control/src/modules/Installation.rb

Constant Summary collapse

SOURCEDIR =

usual mountpoint for the source (i.e. CD)

"/run/YaST2/mount".freeze

Instance Method Summary collapse

Instance Method Details

#bootObject

how we were booted (the type of the installation medium) /etc/install.inf: InstMode


245
246
247
# File 'library/control/src/modules/Installation.rb', line 245

def boot
  Linuxrc.InstallInf("InstMode") || "cd"
end

#finish_restarting!Object


259
260
261
# File 'library/control/src/modules/Installation.rb', line 259

def finish_restarting!
  ::FileUtils.remove_file(@restarting_file, true) if restarting?
end

#InitializeObject


220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'library/control/src/modules/Installation.rb', line 220

def Initialize
  arg_count = Builtins.size(WFM.Args)
  arg_no = 0

  @_text_fallback = false
  @_no_x11 = false

  while Ops.less_than(arg_no, arg_count)
    Builtins.y2debug("option #%1: %2", arg_no, WFM.Args(arg_no))

    if WFM.Args(arg_no) == "text_fallback"
      @_text_fallback = true
    elsif WFM.Args(arg_no) == "no_x11"
      @_no_x11 = true
    else
      Builtins.y2milestone("skipping unknown option %1", WFM.Args(arg_no))
    end
    arg_no = Ops.add(arg_no, 1)
  end

  nil
end

#InstallationObject


constructor


205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'library/control/src/modules/Installation.rb', line 205

def Installation  # get setup data from linuxrc
  # check setup/descr/info for CD type


  if Stage.cont
    @destdir = "/"
    @scr_destdir = "/"
  elsif Stage.initial
    @destdir = "/mnt"
    @scr_destdir = "/mnt"
  end

  nil
end

#mainObject


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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'library/control/src/modules/Installation.rb', line 44

def main
  Yast.import "Stage"
  Yast.import "Linuxrc"
  Yast.import "Directory"

  # current scr handle
  # used in installation.ycp and inst_finish.ycp
  @scr_handle = 0

  # Usual mountpoint for the destination.
  @destdir = "/"

  # Usual mountpoint for the destination seen from the (default) SCR.  It's
  # set to "/" when the SCR is restarted in the target system.
  @scr_destdir = "/"

  @yast2dir = "/var/lib/YaST2"

  @mountlog = Ops.add(Directory.logdir, "/y2logMount")

  # encoding for the language
  @encoding = "ISO-8859-1"

  # remember if user was informed about text fallback
  # see general/installation.ycp
  @shown_text_mode_warning = false

  # remember that hardware has already been probed
  @probing_done = false

  @_text_fallback = nil
  @_no_x11 = nil

  # --> configuration from installation.ycp

  # Second stage installation has been aborted by user
  @file_inst_aborted = Ops.add(Directory.vardir, "/second_stage_aborted")

  # Second stage installation has been killed or just somehow failed
  @file_inst_failed = Ops.add(Directory.vardir, "/second_stage_failed")

  # Installation scripts (YaST) will be started at boot time
  @run_yast_at_boot = Ops.add(Directory.vardir, "/runme_at_boot")

  # The current installation step (useful for restarting YaST or rebooting)
  @current_step = Ops.add(Directory.vardir, "/step")

  # Update instead on New Installation
  @file_update_mode = Ops.add(Directory.vardir, "/update_mode")

  # Live installation instead on standard Installation
  @file_live_install_mode = Ops.add(Directory.vardir, "/live_install_mode")

  # Second stage installation (Stage::cont())
  @restart_data_file = Ops.add(Directory.vardir, "/continue_installation")

  # Computer has been rebooted
  @reboot_file = Ops.add(Directory.vardir, "/reboot")

  # Just restarting YaST (handled by startup scripts)
  @restart_file = Ops.add(Directory.vardir, "/restart_yast")

  # Running YaST in upgrade mode (initiated from running system)
  @run_update_file = Ops.add(Directory.vardir, "/run_system_update")

  # A flag to know if current installation is restarting skipping dialogs or
  # recovering values until the step just before the yast restart was done
  @restarting_file = Ops.add(Directory.vardir, "/restarting_yast")

  # Network should be started before the installation starts (continues)
  # bugzilla #258742
  #
  # File contains a YCP map with services and their status when Installation was about to reboot
  # e.g., $[ "network" : true, "portmap" : false, "SuSEfirewall2" : true ]
  @reboot_net_settings = Ops.add(
    Directory.vardir,
    "/reboot_network_settings"
  )

  # <-- configuration from installation.ycp

  # Initial settings for variables used in Installation Mode dialog
  # These settings needs to be persistent during the installation
  @add_on_selected = false  # Preselected by default
  # bugzilla #299207

  @productsources_selected = true

  #
  # variables to store data of the installation clients
  #

  # inst_license

  # The license has already been accepted, the respectiev radio button
  # can be preselected
  @license_accepted = false

  # These maps are used by several YaST modules.

  # Version of the targetsystem (currently installed one).
  #
  #
  # **Structure:**
  #
  #     $[
  #        "name" : (string) "openSUSE",
  #        "version" : (string) "10.1",
  #        "nameandversion" : (string) "openSUSE 10.1",
  #        "major" : (integer) 10,
  #        "minor" : (integer) 1,
  #      ]
  @installedVersion = {}

  # Version of system to update to (will be installed, or is
  # just being installed).
  #
  #
  # **Structure:**
  #
  #     $[
  #        "name" : (string) "openSUSE",
  #        "version" : (string) "11.0",
  #        "nameandversion" : (string) "openSUSE 11.0",
  #        "major" : (integer) 11,
  #        "minor" : (integer) 0,
  #      ]
  @updateVersion = {}

  # Global variables moved here to break dependencies
  # on yast2-update
  @update_backup_modified = true

  @update_backup_sysconfig = true

  @update_remove_old_backups = false

  @update_backup_path = "/var/adm/backup"

  # dirinstall-related

  @dirinstall_installing_into_dir = false

  @dirinstall_target = "/var/tmp/dirinstall"

  @dirinstall_target_time = 0

  # image-based installation

  # Installation is performed form image(s)
  @image_installation = false

  # Installation is performed only from image(s), no additional
  # RPM (de)installation
  @image_only = false
  Installation()
end

#no_x11Object

somehow, no X11 was started no x11 or not enough memory for qt


282
283
284
285
# File 'library/control/src/modules/Installation.rb', line 282

def no_x11
  Initialize() if @_no_x11.nil?
  @_no_x11
end

#restart!Object


249
250
251
252
253
# File 'library/control/src/modules/Installation.rb', line 249

def restart!
  ::FileUtils.touch(@restart_file)
  ::FileUtils.touch(@restarting_file)
  :restart_yast
end

#restarting?Boolean


255
256
257
# File 'library/control/src/modules/Installation.rb', line 255

def restarting?
  ::File.exist?(@restarting_file)
end

#sourcedirString

Gets directory suitable for source mount. It ensures that directory exists. It does not ensure unmounting previous content.


291
292
293
294
295
# File 'library/control/src/modules/Installation.rb', line 291

def sourcedir
  ::FileUtils.mkdir_p(SOURCEDIR) unless ::File.exist?(SOURCEDIR)

  SOURCEDIR
end

#text_fallbackObject

no resources/packages for X11


275
276
277
278
# File 'library/control/src/modules/Installation.rb', line 275

def text_fallback
  Initialize() if @_text_fallback.nil?
  @_text_fallback
end

#x11_setup_neededObject

run X11 configuration after inital boot this is false in case of: installation via serial console installation via ssh installation via vnc

Also see Arch::x11_setup_needed ().


270
271
272
# File 'library/control/src/modules/Installation.rb', line 270

def x11_setup_needed
  !(Linuxrc.serial_console || Linuxrc.vnc || Linuxrc.usessh)
end