-
Notifications
You must be signed in to change notification settings - Fork 44
/
inst_inc_all.rb
264 lines (226 loc) · 8.81 KB
/
inst_inc_all.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
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
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
# ------------------------------------------------------------------------------
# Copyright (c) 2006-2012 Novell, Inc. All Rights Reserved.
#
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of version 2 of the GNU General Public License as published by the
# Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, contact Novell, Inc.
#
# To contact Novell about this file by physical or electronic mail, you may find
# current contact information at www.novell.com.
# ------------------------------------------------------------------------------
# File: include/installation/inst_inc_all.ycp
# Module: System installation
# Summary: Miscelaneous functions
# Authors: Lukas Ocilka <locilka@suse.cz>
#
# $Id$
#
require "y2storage"
module Yast
module InstallationInstIncAllInclude
def initialize_installation_inst_inc_all(_include_target)
Yast.import "UI"
textdomain "installation"
Yast.import "ProductControl"
Yast.import "Label"
Yast.import "Linuxrc"
Yast.import "Wizard"
Yast.import "Arch"
Yast.import "Report"
Yast.import "Installation"
Yast.import "Stage"
Yast.import "Mode"
end
def SetInitializingUI
# dialog content - busy message
ui_message = ""
# help for the dialog - busy message
ui_help = _("<p>Initializing the installation...</p>")
# another texts for second stage
if Stage.cont
# dialog content - busy message
ui_message = _("Preparing the 1st system configuration...")
# help for the dialog - busy message
ui_help = _("<p>Please wait...</p>")
end
Wizard.SetContents(
# dialog caption
_("Initializing..."),
Label(ui_message),
ui_help,
false,
false
)
# gh#86 No control file found
if ProductControl.current_control_file.nil?
Yast.import "InstError"
InstError.ShowErrorPopupWithLogs(
# TRANSLATORS: Error message
_("No installation control file has been found,\nthe installer cannot continue.")
)
end
nil
end
def SetUIContent
# Wizard::OpenNextBackStepsDialog();
SetInitializingUI()
nil
end
def SetGlobalInstallationFeatures
# FATE #304395: Disabling (or handling) screensaver during installation
# Disabling screen-saver on startup
if WFM.Read(path(".local.size"), "/usr/bin/xset") != -1
Builtins.y2milestone("Disabling Energy Star (DPMS) features")
# DPMS off values, disable DPMS, disable screen-saver
WFM.Execute(
path(".local.bash"),
"/usr/bin/xset dpms 0 0 0; /usr/bin/xset -dpms; /usr/bin/xset s 0 0; /usr/bin/xset s off"
)
end
nil
end
def FinishInstallation(ret)
Builtins.y2milestone("Finishing the installation...")
if [:reboot, :restart_yast, :restart_same_step, :abort].include?(ret)
# TRANSLATORS: busy message
UI.OpenDialog(Label(_("Writing YaST configuration..."))) # #2
else
# FATE #304395: Disabling (or handling) screensaver during installation
# Enabling screen-saver on exit
if WFM.Read(path(".local.size"), "/usr/bin/xset") != -1
Builtins.y2milestone("Enabling Energy Star (DPMS) features")
# default DPMS values, enable DPMS, enable screen-saver
WFM.Execute(
path(".local.bash"),
"/usr/bin/xset dpms 1200 1800 2400; /usr/bin/xset +dpms; /usr/bin/xset s on; " \
"/usr/bin/xset s default;"
)
end
# TRANSLATORS: busy message
UI.OpenDialog(Label(_("Finishing the installation..."))) # #2
end
UI.CloseDialog # #2
nil
end
# Sets autoinstallation behavior.
def SetAutoinstHandling
return if !Mode.autoinst
reportMap = {
"errors" => { "timeout" => 0 },
"warnings" => { "timeout" => 10 },
"yesno_messages" => { "timeout" => 10 }
}
Report.Import(reportMap)
Report.DisplayErrors(true, 0)
Report.DisplayWarnings(true, 10)
Report.DisplayMessages(true, 10)
nil
end
# Sets autoupgrade behavior
def SetAutoupgHandling
# if profile is defined, first read it, then probe hardware
autoinstall = SCR.Read(path(".etc.install_inf.AutoYaST"))
if !autoinstall.nil? && Ops.is_string?(autoinstall) &&
Convert.to_string(autoinstall) != ""
ProductControl.DisableModule("system_analysis")
ProductControl.DisableModule("update_partition_auto")
end
nil
end
def ShowTextFallbackMessage
if (Installation.text_fallback || Installation.no_x11) &&
Installation.x11_setup_needed && Arch.x11_setup_needed &&
!Installation.shown_text_mode_warning
x11_msg = ""
if (Installation.no_x11 || Installation.text_fallback) && Stage.initial
# Somehow the graphical frontend failed and we're running in
# text mode. Inform the user about this fact.
x11_msg = Builtins.sformat(
_(
"Your computer does not fulfill all requirements for\n" \
"a graphical installation. There is either less than %1 MB\n" \
"memory or the X server could not be started.\n" \
"\n" \
"As fallback, the text front-end of YaST2 will guide you\n" \
"through the installation. This front-end offers the\n" \
"same functionality as the graphical one, but the screens\n" \
"differ from those in the manual.\n"
),
"96"
)
elsif (Installation.no_x11 || Installation.text_fallback) && Stage.cont
# The script YaST2 wants to inform about a problem with the
# option no_x11 but it's broken.
# else if (Installation::no_x11 ())
# Somehow the graphical frontend failed and we're running in
# text mode. Inform the user about this fact.
x11_msg = _(
"The graphical interface could not be started.\n" \
"\n" \
"Either the required packages were not installed (minimal installation) \n" \
"or the graphics card is not properly supported.\n" \
"\n" \
"As fallback, the text front-end of YaST2 will guide you\n" \
"through the installation. This front-end offers the\n" \
"same functionality as the graphical one, but the screens\n" \
"differ from those in the manual.\n"
)
end
if x11_msg == ""
Builtins.y2error(
"There should be a more detailed message displayed here,\n" \
"but something went wrong, that's why it is only in the log"
)
else
Report.Message(x11_msg)
end
# show this warning only once
Installation.shown_text_mode_warning = true
end
nil
end
# Re-translate static part of wizard dialog and other predefined messages
# after language change
def retranslateWizardDialog
Builtins.y2milestone("Retranslating messages")
# Make sure the labels for default function keys are retranslated, too.
# Using Label::DefaultFunctionKeyMap() from Label module.
UI.SetFunctionKeys(Label.DefaultFunctionKeyMap)
# Activate language changes on static part of wizard dialog
ProductControl.RetranslateWizardSteps
Wizard.RetranslateButtons
Wizard.SetFocusToNextButton
nil
end
def SetDiskActivationModule
# Connect all the discovered NVMe-over-Fabrics subsystems (jse#PED-318)
connect_nbft if Linuxrc.InstallInf("UseNBFT") == "1"
# update the workflow according to current situation
# disable disks activation if not needed
iscsi = Linuxrc.InstallInf("WithiSCSI") == "1"
fcoe = Linuxrc.InstallInf("WithFCoE") == "1"
no_disk = !::Y2Storage::StorageManager.instance.devices_for_installation?
if !((Arch.s390 && !Arch.is_zkvm) || iscsi || fcoe || no_disk)
Builtins.y2milestone("Disabling disk activation module")
ProductControl.DisableModule("disks_activate")
end
nil
end
# Convenience method for discovering and connecting all NVMe over Fabrics subsystems
def connect_nbft
require "yast2/execute"
# Replaced 'connect-nbft' by 'connect-all --nbft' (bsc#1222246).
Yast::Execute.locally!("nvme", "connect-all", "--nbft")
rescue Cheetah::ExecutionFailed
Builtins.y2error("Error connecting NBFT")
end
end
end