• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

yast / yast-yast2 / 13440235285

20 Feb 2025 04:40PM UTC coverage: 41.869% (-0.02%) from 41.889%
13440235285

push

github

web-flow
Merge pull request #1316 from yast/agama_kernel_conf

Respect Agama kernel parameters

2 of 4 new or added lines in 1 file covered. (50.0%)

265 existing lines in 40 files now uncovered.

12605 of 30106 relevant lines covered (41.87%)

10.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

79.55
/library/control/src/modules/Installation.rb
1
# ***************************************************************************
2
#
3
# Copyright (c) 2002 - 2012 Novell, Inc.
4
# All Rights Reserved.
5
#
6
# This program is free software; you can redistribute it and/or
7
# modify it under the terms of version 2 of the GNU General Public License as
8
# published by the Free Software Foundation.
9
#
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, contact Novell, Inc.
17
#
18
# To contact Novell about this file by physical or electronic mail,
19
# you may find current contact information at www.novell.com
20
#
21
# ***************************************************************************
22
# File:
23
#  Installation.ycp
24
#
25
# Module:
26
#  Installation
27
#
28
# Summary:
29
#  provide installation related information
30
#
31
# Author:
32
#  Klaus Kaempf <kkaempf@suse.de>
33
#  Lukas Ocilka <locilka@suse.cz>
34
#
35
# $Id$
36
require "yast"
1✔
37
require "fileutils"
1✔
38

39
module Yast
1✔
40
  class InstallationClass < Module
1✔
41
    # usual mountpoint for the source (i.e. CD)
42
    SOURCEDIR = "/run/YaST2/mount".freeze
1✔
43

44
    def main
1✔
45
      Yast.import "Stage"
1✔
46
      Yast.import "Linuxrc"
1✔
47
      Yast.import "Directory"
1✔
48

49
      # current scr handle
50
      # used in installation.ycp and inst_finish.ycp
51
      @scr_handle = 0
1✔
52

53
      # Usual mountpoint for the destination.
54
      @destdir = "/"
1✔
55

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

60
      @yast2dir = "/var/lib/YaST2"
1✔
61

62
      @mountlog = Ops.add(Directory.logdir, "/y2logMount")
1✔
63

64
      # encoding for the language
65
      @encoding = "ISO-8859-1"
1✔
66

67
      # remember if user was informed about text fallback
68
      # see general/installation.ycp
69
      @shown_text_mode_warning = false
1✔
70

71
      # remember that hardware has already been probed
72
      @probing_done = false
1✔
73

74
      @_text_fallback = nil
1✔
75
      @_no_x11 = nil
1✔
76

77
      # --> configuration from installation.ycp
78

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

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

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

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

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

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

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

100
      # Computer has been rebooted
101
      @reboot_file = Ops.add(Directory.vardir, "/reboot")
1✔
102

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

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

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

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

123
      # <-- configuration from installation.ycp
124

125
      # Initial settings for variables used in Installation Mode dialog
126
      # These settings needs to be persistent during the installation
127
      @add_on_selected = false
1✔
128
      # Preselected by default
129
      # bugzilla #299207
130
      @productsources_selected = true
1✔
131

132
      #
133
      # variables to store data of the installation clients
134
      #
135

136
      # inst_license
137

138
      # The license has already been accepted, the respectiev radio button
139
      # can be preselected
140
      @license_accepted = false
1✔
141

142
      # These maps are used by several YaST modules.
143

144
      # Version of the targetsystem (currently installed one).
145
      #
146
      #
147
      # **Structure:**
148
      #
149
      #     $[
150
      #        "name" : (string) "openSUSE",
151
      #        "version" : (string) "10.1",
152
      #        "nameandversion" : (string) "openSUSE 10.1",
153
      #        "major" : (integer) 10,
154
      #        "minor" : (integer) 1,
155
      #      ]
156
      @installedVersion = {}
1✔
157

158
      # Version of system to update to (will be installed, or is
159
      # just being installed).
160
      #
161
      #
162
      # **Structure:**
163
      #
164
      #     $[
165
      #        "name" : (string) "openSUSE",
166
      #        "version" : (string) "11.0",
167
      #        "nameandversion" : (string) "openSUSE 11.0",
168
      #        "major" : (integer) 11,
169
      #        "minor" : (integer) 0,
170
      #      ]
171
      @updateVersion = {}
1✔
172

173
      # Global variables moved here to break dependencies
174
      # on yast2-update
175
      @update_backup_modified = true
1✔
176

177
      @update_backup_sysconfig = true
1✔
178

179
      @update_remove_old_backups = false
1✔
180

181
      @update_backup_path = "/var/adm/backup"
1✔
182

183
      # dirinstall-related
184

185
      @dirinstall_installing_into_dir = false
1✔
186

187
      @dirinstall_target = "/var/tmp/dirinstall"
1✔
188

189
      @dirinstall_target_time = 0
1✔
190

191
      # image-based installation
192

193
      # Installation is performed form image(s)
194
      @image_installation = false
1✔
195

196
      # Installation is performed only from image(s), no additional
197
      # RPM (de)installation
198
      @image_only = false
1✔
199
      Installation()
1✔
200
    end
201

202
    #---------------------------------------------------------------
203
    # constructor
204

205
    def Installation
1✔
206
      # get setup data from linuxrc
207
      # check setup/descr/info for CD type
208

209
      if Stage.cont
3✔
210
        @destdir = "/"
×
211
        @scr_destdir = "/"
×
212
      elsif Stage.initial
3✔
213
        @destdir = "/mnt"
×
214
        @scr_destdir = "/mnt"
×
215
      elsif WFM.scr_chrooted?
3✔
216
        @destdir = WFM.scr_root
1✔
217
        @scr_destdir = WFM.scr_root
1✔
218
      end
219

220
      nil
3✔
221
    end
222

223
    def Initialize
1✔
224
      arg_count = Builtins.size(WFM.Args)
×
225
      arg_no = 0
×
226

227
      @_text_fallback = false
×
228
      @_no_x11 = false
×
229

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

233
        case WFM.Args(arg_no)
×
234
        when "text_fallback"
235
          @_text_fallback = true
×
236
        when "no_x11"
237
          @_no_x11 = true
×
238
        else
239
          Builtins.y2milestone("skipping unknown option %1", WFM.Args(arg_no))
×
240
        end
241
        arg_no = Ops.add(arg_no, 1)
×
242
      end
243

UNCOV
244
      nil
×
245
    end
246

247
    # how we were booted (the type of the installation medium)
248
    # /etc/install.inf: InstMode
249
    def boot
1✔
250
      Linuxrc.InstallInf("InstMode") || "cd"
×
251
    end
252

253
    def restart!
1✔
254
      ::FileUtils.touch(@restart_file)
×
255
      ::FileUtils.touch(@restarting_file)
×
256
      :restart_yast
×
257
    end
258

259
    def restarting?
1✔
260
      ::File.exist?(@restarting_file)
×
261
    end
262

263
    def finish_restarting!
1✔
264
      ::FileUtils.remove_file(@restarting_file, true) if restarting?
×
265
    end
266

267
    # run X11 configuration after inital boot
268
    # this is false in case of:
269
    # installation via serial console
270
    # installation via ssh
271
    # installation via vnc
272
    #
273
    # Also see Arch::x11_setup_needed ().
274
    def x11_setup_needed
1✔
275
      !(Linuxrc.serial_console || Linuxrc.vnc || Linuxrc.usessh)
×
276
    end
277

278
    # no resources/packages for X11
279
    def text_fallback
1✔
280
      Initialize() if @_text_fallback.nil?
×
281
      @_text_fallback
×
282
    end
283

284
    # somehow, no X11 was started
285
    # no x11 or not enough memory for qt
286
    def no_x11
1✔
287
      Initialize() if @_no_x11.nil?
×
288
      @_no_x11
×
289
    end
290

291
    # Gets directory suitable for source mount. It ensures that directory exists.
292
    # It does not ensure unmounting previous content.
293
    #
294
    # @return [String]
295
    def sourcedir
1✔
296
      ::FileUtils.mkdir_p(SOURCEDIR) unless ::File.exist?(SOURCEDIR)
2✔
297

298
      SOURCEDIR
2✔
299
    end
300

301
    publish variable: :scr_handle, type: "integer"
1✔
302
    publish variable: :destdir, type: "string"
1✔
303
    publish variable: :scr_destdir, type: "string"
1✔
304
    publish variable: :yast2dir, type: "string"
1✔
305
    publish variable: :mountlog, type: "string"
1✔
306
    publish variable: :encoding, type: "string"
1✔
307
    publish variable: :shown_text_mode_warning, type: "boolean"
1✔
308
    publish variable: :probing_done, type: "boolean"
1✔
309
    publish variable: :file_inst_aborted, type: "string"
1✔
310
    publish variable: :file_inst_failed, type: "string"
1✔
311
    publish variable: :run_yast_at_boot, type: "string"
1✔
312
    publish variable: :current_step, type: "string"
1✔
313
    publish variable: :file_update_mode, type: "string"
1✔
314
    publish variable: :file_live_install_mode, type: "string"
1✔
315
    publish variable: :restart_data_file, type: "string"
1✔
316
    publish variable: :reboot_file, type: "string"
1✔
317
    publish variable: :restart_file, type: "string"
1✔
318
    publish variable: :run_update_file, type: "string"
1✔
319
    publish variable: :reboot_net_settings, type: "string"
1✔
320
    publish variable: :add_on_selected, type: "boolean"
1✔
321
    publish variable: :productsources_selected, type: "boolean"
1✔
322
    publish variable: :license_accepted, type: "boolean"
1✔
323
    publish variable: :installedVersion, type: "map <string, any>"
1✔
324
    publish variable: :updateVersion, type: "map <string, any>"
1✔
325
    publish variable: :update_backup_modified, type: "boolean"
1✔
326
    publish variable: :update_backup_sysconfig, type: "boolean"
1✔
327
    publish variable: :update_remove_old_backups, type: "boolean"
1✔
328
    publish variable: :update_backup_path, type: "string"
1✔
329
    publish variable: :dirinstall_installing_into_dir, type: "boolean"
1✔
330
    publish variable: :dirinstall_target, type: "string"
1✔
331
    publish variable: :dirinstall_target_time, type: "integer"
1✔
332
    publish variable: :image_installation, type: "boolean"
1✔
333
    publish variable: :image_only, type: "boolean"
1✔
334
    publish function: :Installation, type: "void ()"
1✔
335
    publish function: :boot, type: "string ()"
1✔
336
    publish function: :x11_setup_needed, type: "boolean ()"
1✔
337
    publish function: :text_fallback, type: "boolean ()"
1✔
338
    publish function: :no_x11, type: "boolean ()"
1✔
339
    publish function: :sourcedir, type: "string ()"
1✔
340
  end
341

342
  Installation = InstallationClass.new
1✔
343
  Installation.main
1✔
344
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc