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
|
# File 'src/clients/bootloader_proposal.rb', line 14
def main
Yast.import "UI"
textdomain "bootloader"
Yast.import "Arch"
Yast.import "BootCommon"
Yast.import "Bootloader"
Yast.import "Installation"
Yast.import "Storage"
Yast.import "Mode"
Yast.import "BootSupportCheck"
Yast.include self, "bootloader/routines/wizards.rb"
@func = Convert.to_string(WFM.Args(0))
@param = Convert.to_map(WFM.Args(1))
@ret = {}
if @func == "MakeProposal"
@force_reset = Ops.get_boolean(@param, "force_reset", false)
@language_changed = Ops.get_boolean(@param, "language_changed", false)
if @force_reset && !Mode.autoinst && !Mode.autoupgrade
Builtins.y2milestone(
"Recalculation of bootloader configuration forced"
)
Bootloader.Reset
end
if !Bootloader.proposed_cfg_changed && !Mode.autoinst && !Mode.autoupgrade
Builtins.y2milestone "Proposal not modified, so repropose from scratch"
Bootloader.ResetEx(false)
end
if Mode.update
if ["grub2", "grub2-efi"].include? old_bootloader
Builtins.y2milestone "update of grub2, do not repropose"
if !BootCommon.was_read || @force_reset
Bootloader.blRead(true, true)
BootCommon.was_read = true
end
else
if !BootCommon.was_proposed || @force_reset
BootCommon.setLoaderType(nil)
Bootloader.Reset
Bootloader.Propose
end
end
else
Bootloader.Propose
end
if Bootloader.getLoaderType == "grub2"
@ret["links"] = [
"enable_boot_mbr",
"disable_boot_mbr",
"enable_boot_root",
"disable_boot_root",
"enable_boot_boot",
"disable_boot_boot"
]
end
BootCommon.setLoaderType(BootCommon.getLoaderType(false))
@ret["raw_proposal"] = Bootloader.Summary
@device = BootCommon.getBootDisk
if @device == "/dev/nfs"
Builtins.y2milestone(
"bootlader_proposal::MakeProposal -> Boot partition is nfs type, bootloader will not be installed."
)
Builtins.y2milestone("Type of BootPartitionDevice: %1", @device)
return deep_copy(@ret)
end
Builtins.y2milestone("Type of BootPartitionDevice: %1", @device)
if Bootloader.getLoaderType == ""
Builtins.y2error("No bootloader selected")
@ret = Builtins.add(@ret, "warning_level", :error)
@ret = Builtins.add(
@ret,
"warning",
_(
"No boot loader is selected for installation. Your system might not be bootable."
)
)
end
if !BootCommon.BootloaderInstallable
@ret = {
"warning_level" => :error,
"warning" => _(
"Because of the partitioning, the bootloader cannot be installed properly"
)
}
end
if !BootSupportCheck.SystemSupported
@ret = Convert.convert(
Builtins.union(
@ret,
{
"warning_level" => :error,
"warning" => BootSupportCheck.StringProblems,
"raw_proposal" => Bootloader.Summary
}
),
:from => "map",
:to => "map <string, any>"
)
end
Bootloader.cached_settings = Bootloader.Export
BootCommon.cached_settings_base_data_change_time = Storage.GetTargetChangeTime(
)
Bootloader.cached_proposal = deep_copy(@ret)
elsif @func == "AskUser"
@chosen_id = Ops.get(@param, "chosen_id")
@result = :next
Builtins.y2milestone(
"Bootloader wanted to change with id %1",
@chosen_id
)
if @chosen_id == "enable_boot_mbr"
Builtins.y2milestone("Boot from MBR enabled by a single-click")
Ops.set(BootCommon.globals, "boot_mbr", "true")
Bootloader.proposed_cfg_changed = true
elsif @chosen_id == "disable_boot_mbr"
Builtins.y2milestone("Boot from MBR disabled by a single-click")
Ops.set(BootCommon.globals, "boot_mbr", "false")
Bootloader.proposed_cfg_changed = true
elsif @chosen_id == "enable_boot_boot"
Builtins.y2milestone("Boot from /boot enabled by a single-click")
Ops.set(BootCommon.globals, "boot_boot", "true")
Bootloader.proposed_cfg_changed = true
elsif @chosen_id == "disable_boot_boot"
Builtins.y2milestone("Boot from /boot disabled by a single-click")
Ops.set(BootCommon.globals, "boot_boot", "false")
Bootloader.proposed_cfg_changed = true
elsif @chosen_id == "enable_boot_root"
Builtins.y2milestone("Boot from / enabled by a single-click")
Ops.set(BootCommon.globals, "boot_root", "true")
Bootloader.proposed_cfg_changed = true
elsif @chosen_id == "disable_boot_root"
Builtins.y2milestone("Boot from / disabled by a single-click")
Ops.set(BootCommon.globals, "boot_root", "false")
Bootloader.proposed_cfg_changed = true
else
@has_next = Ops.get_boolean(@param, "has_next", false)
@settings = Bootloader.Export
BootCommon.changed = false
@result = BootloaderAutoSequence()
BootCommon.changed = true
if @result != :next
Bootloader.Import(
Convert.convert(
@settings,
:from => "map",
:to => "map <string, any>"
)
)
else
Bootloader.proposed_cfg_changed = true
end
end
Ops.set(@ret, "workflow_sequence", @result)
elsif @func == "Description"
@ret = {
"rich_text_title" => _("Booting"),
"menu_title" => _("&Booting"),
"id" => "bootloader_stuff"
}
elsif @func == "Write"
@succ = Bootloader.Write
@ret = { "success" => @succ }
end
deep_copy(@ret)
end
|