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
|
# File 'src/lib/installation/clients/inst_network_check.rb', line 21
def main
Yast.import "UI"
textdomain "installation"
Yast.import "NetworkService"
Yast.import "Wizard"
Yast.import "Popup"
Yast.import "GetInstArgs"
Yast.import "Directory"
Yast.import "Icon"
@enable_next = true
@enable_back = true
@argmap = GetInstArgs.argmap
Builtins.y2milestone("Script args: %1", @argmap)
if NetworkService.isNetworkRunning
if Ops.get_boolean(@argmap, "dontskip", false) == true
Builtins.y2milestone(
"Network is already running, not skipping (forced)..."
)
else
Builtins.y2milestone("Network is already running, skipping...")
return :next
end
else
Builtins.y2milestone(
"No network configuration found, offering to set it up..."
)
end
@displayinfo = UI.GetDisplayInfo
@supports_images = Ops.get_boolean(@displayinfo, "HasImageSupport", false)
Wizard.SetContents(
_("Network Setup"),
VBox(
VStretch(),
RadioButtonGroup(
Id("to_do_a_network_setup_or_not_to_do"),
HBox(
HStretch(),
VBox(
HBox(
@supports_images ? HBox(Icon.Simple("warning"), HSpacing(2)) : Empty(),
Left(
Label(
_(
"No network setup has been found.\n" \
"It is important if using remote repositories,\n" \
"otherwise you can safely skip it.\n"
)
)
)
),
VSpacing(2),
Left(Label(_("Configure your network card now?"))),
VSpacing(1),
Frame(
_("Select"),
MarginBox(
1.5,
1,
VBox(
Left(
RadioButton(
Id("yes_do_run_setup"),
_("&Yes, Run the Network Setup"),
true
)
),
Left(
RadioButton(
Id("no_do_not_run_setup"),
_("No, &Skip the Network Setup")
)
)
)
)
)
),
HStretch()
)
),
VStretch()
),
_(
"<p>The current installation system does not\nhave a configured network.</p>\n"
) +
_(
"<p>A configured network is needed for using remote repositories\n" \
"or add-on products. If you do not use remote repositories, " \
"skip the configuration.</p>\n"
),
@enable_next,
@enable_back
)
@ret = nil
@run_setup = nil
@return_this = :next
loop do
@ret = UI.UserInput
case @ret
when :next
@option_selected = Convert.to_string(
UI.QueryWidget(
Id("to_do_a_network_setup_or_not_to_do"),
:CurrentButton
)
)
Builtins.y2milestone("Network setup? %1", @option_selected)
if @option_selected == "yes_do_run_setup"
Builtins.y2milestone("Running inst_lan")
@ret2 = WFM.call(
"inst_lan",
[GetInstArgs.argmap.merge("skip_detection" => true), { "hide_abort_button" => true }]
)
Builtins.y2milestone("inst_lan ret: %1", @ret2)
if @ret2 == :next
@return_this = :next
break
else
if @ret2.nil?
Popup.Message(
Builtins.sformat(
_(
"Network configuration has failed.\nCheck the log file %1 for details."
),
Ops.add(Directory.logdir, "/y2log")
)
)
end
UI.ChangeWidget(
Id("to_do_a_network_setup_or_not_to_do"),
:CurrentButton,
"no_do_not_run_setup"
)
next
end
else
Builtins.y2milestone("Skipping network setup")
@return_this = :next
break
end
when :back
Builtins.y2milestone("Going back")
@return_this = :back
break
when :abort
if Popup.ConfirmAbort(:painless)
@return_this = :abort
break
end
else
Builtins.y2error("Unknown ret: %1", @ret)
end
end
@return_this
end
|