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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
|
# File '../../src/include/partitioning/custom_part_check_generated.rb', line 59
def check_created_partition_table(targetMap, installation)
targetMap = deep_copy(targetMap)
Builtins.y2milestone(
"now checking generated target map installation:%1",
installation
)
= false
diskless = true
partition_mounted_but_not_formated = false
swap_found = false
boot_found = false
root_found = false
gpt_boot_ia64 = false
boot_end = 0
root_end = 0
root_raid = false
root_dmraid = false
boot_raid = false
root_lvm = false
root_fs = :unknown
boot_fs = :unknown
boot_fsid = 0
boot_size_k = 0
boot_size_check = !(Arch.board_chrp || Arch.board_prep ||
Arch.board_iseries ||
Arch.board_mac)
fat_system_mount = false
fat_system_boot = false
raid_type = ""
rootdlabel = ""
root_subvols_shadowed = false
Builtins.foreach(targetMap) do |disk, diskinfo|
part_info = Ops.get_list(diskinfo, "partitions", [])
cyl_size = Ops.get_integer(diskinfo, "cyl_size", 1000000)
if Builtins.contains(
[:CT_DISK, :CT_DMRAID, :CT_DMMULTIPATH, :CT_MDPART],
Ops.get_symbol(diskinfo, "type", :CT_UNKNOWN)
)
diskless = false
end
Builtins.foreach(part_info) do |part|
fsid = Ops.get_integer(part, "fsid", 0)
mountpoint = Ops.get_string(part, "mount", "")
if mountpoint == "/"
root_found = true
root_dmraid = Ops.get_symbol(diskinfo, "type", :CT_UNKNOWN) == :CT_DMRAID
root_end = Region.End(Ops.get_list(part, "region", []))
if !Builtins.contains(
[:primary, :logical],
Ops.get_symbol(part, "type", :unknown)
)
root_end = 0
end
root_fs = Ops.get_symbol(part, "used_fs", :unknown)
if Ops.get_symbol(part, "type", :unknown) == :sw_raid
root_raid = true
end
raid_type = Ops.get_string(part, "raid_type", "") if !boot_raid
root_lvm = true if Ops.get_symbol(part, "type", :unknown) == :lvm
if diskinfo.fetch( "type", :CT_UNKNOWN ) == :CT_DISK
rootdlabel = diskinfo.fetch( "label", "" )
end
subvols = part.fetch("subvol", [])
subvols.each do |subvol|
if FileSystems.default_subvol.empty?
tmp = "/" + subvol.fetch("name")
else
tmp = subvol.fetch("name")[FileSystems.default_subvol.size..-1]
end
targetMap.each do |dev, disk|
parts = disk.fetch("partitions", [])
parts.each do |part|
if part.has_key?("mount")
mp = part["mount"]
if (tmp == mp) || (tmp.start_with?(mp) && tmp[mp.size] == "/")
root_subvols_shadowed = true
end
end
end
end
end
elsif mountpoint == Partitions.BootMount
if (Partitions.EfiBoot || Arch.ia64) &&
Ops.get_string(diskinfo, "label", "gpt") != "gpt"
gpt_boot_ia64 = true
end
boot_found = true
if Ops.get_symbol(diskinfo, "type", :CT_UNKNOWN) == :CT_DISK
boot_end = Region.End(Ops.get_list(part, "region", []))
else
boot_end = 0
end
boot_fs = Ops.get_symbol(part, "used_fs", :unknown)
boot_size_k = Ops.get_integer(part, "size_k", 0)
if Ops.get_symbol(part, "type", :unknown) == :sw_raid
boot_raid = true
end
raid_type = Ops.get_string(part, "raid_type", "")
elsif mountpoint == ""
dlabel = diskinfo["label"]
if Partitions.PrepBoot &&
(fsid == Partitions.FsidBoot(dlabel) || fsid == 6)
boot_found = true
boot_end = Region.End(Ops.get_list(part, "region", []))
boot_fs = Ops.get_symbol(part, "used_fs", :unknown)
boot_size_k = Ops.get_integer(part, "size_k", 0)
boot_fsid = Partitions.FsidBoot(dlabel)
elsif Arch.board_mac &&
Ops.get_symbol(part, "used_fs", :unknown) == :hfs
boot_found = true
boot_end = Region.End(Ops.get_list(part, "region", []))
boot_fs = Ops.get_symbol(part, "used_fs", :unknown)
boot_size_k = Ops.get_integer(part, "size_k", 0)
elsif !Partitions.EfiBoot() && fsid == Partitions.fsid_bios_grub
boot_found = true
boot_end = Region.End(Ops.get_list(part, "region", []))
boot_fs = :none
boot_size_k = Ops.get_integer(part, "size_k", 0)
boot_fsid = Partitions.fsid_bios_grub
end
end
swap_found = true if mountpoint == "swap"
if Ops.get_symbol(part, "used_fs", :unknown) == :vfat &&
Ops.get_boolean(part, "format", false)
if !fat_system_mount &&
Builtins.contains(
["/usr", "/", "/home", "/var", "/opt"],
mountpoint
)
fat_system_mount = true
end
end
if !(Partitions.EfiBoot || Arch.ia64) &&
Ops.get_symbol(part, "used_fs", :unknown) == :vfat &&
Ops.get_boolean(part, "format", false)
fat_system_boot = true if !fat_system_boot && mountpoint == "/boot"
end
if !Ops.get_boolean(part, "format", false) &&
Ops.get_symbol(part, "used_fs", :unknown) != :nfs &&
FileSystems.IsSystemMp(Ops.get_string(part, "mount", ""), false) &&
Ops.get_string(part, "mount", "") != "/boot/efi"
partition_mounted_but_not_formated = true
end
end
end
if rootdlabel.empty?
targetMap.values do |diskinfo|
if diskinfo.fetch( "type", :CT_UNKNOWN ) == :CT_DISK &&
rootdlabel.empty?
rootdlabel = diskinfo.fetch( "label", "" )
end
end
end
log.info("diskless:#{diskless}")
log.info("root_found:#{root_found} root_fs:#{root_fs} rootdlabel:#{rootdlabel}")
log.info("boot_found:#{boot_found} boot_fs:#{boot_fs} boot_fsid:#{boot_fsid}")
log.info("root_dmraid:#{root_dmraid} root_raid:#{root_raid} boot_raid:#{boot_raid} raid_type:#{raid_type}")
ok = true
if !root_found && installation ||
message = _(
"You have not assigned a root partition for\n" +
"installation. This does not work. Assign the root mount point \"/\" to a\n" +
"partition.\n" +
"\n" +
"Really use this setup?\n"
)
ok = false if !Popup.YesNo(message)
end
if fat_system_mount ||
message = _(
"You tried to mount a FAT partition to one of the following mount\n" +
"points: /, /usr, /home, /opt or /var. This will very likely cause problems.\n" +
"Use a Linux file system, such as ext3 or ext4, for these mount points.\n" +
"\n" +
"Really use this setup?\n"
)
ok = false if !Popup.YesNo(message)
end
if fat_system_boot ||
message = _(
"You tried to mount a FAT partition to the\n" +
"mount point /boot. This will very likely cause problems. Use a Linux file\n" +
"system, such as ext3 or ext4, for this mount point.\n" +
"\n" +
"Really use this setup?\n"
)
ok = false if !Popup.YesNo(message)
end
if boot_found && boot_fsid != Partitions.fsid_bios_grub &&
Builtins.contains([:btrfs], boot_fs) ||
message = _(
"You have mounted a partition with Btrfs to the\n" +
"mount point /boot. This will very likely cause problems. Use a Linux file\n" +
"system, such as ext3 or ext4, for this mount point.\n" +
"\n" +
"Really use this setup?\n"
)
ok = false if !Popup.YesNo(message)
end
if boot_found && boot_fsid!=Partitions.fsid_bios_grub && installation ||
if Ops.greater_or_equal(boot_end, Partitions.BootCyl) ||
message = Builtins.sformat(
_(
"Warning:\n" +
"Your boot partition ends above cylinder %1.\n" +
"Your BIOS does not seem able to boot\n" +
"partitions above cylinder %1.\n" +
"With the current setup, your %2\n" +
"installation might not be directly bootable.\n" +
"\n" +
"Really use this setup?\n"
),
Partitions.BootCyl,
Product.name
)
ok = false if !Popup.YesNo(message)
end
if Ops.less_than(boot_size_k, 12 * 1024) && boot_size_check ||
message = Builtins.sformat(
_(
"Warning:\n" +
"Your boot partition is smaller than %1.\n" +
"We recommend to increase the size of /boot.\n" +
"\n" +
"Really keep this size of boot partition?\n"
),
Storage.KByteToHumanStringOmitZeroes(12 * 1024)
)
ok = false if !Popup.YesNo(message)
end
end
if (!boot_found && installation &&
!Partitions.EfiBoot && rootdlabel=="gpt") ||
message = _(
"Warning: There is no partition of type bios_grub present.\n" +
"To boot from a GPT disk using grub2 such a partition is needed.\n" +
"\n" +
"Really use this setup?\n"
)
ok = false if !Popup.YesNo(message)
boot_found = true
end
if !boot_found && installation ||
if Partitions.PrepBoot && !Arch.board_iseries && !diskless ||
message = Builtins.sformat(
_(
"Warning: There is no partition mounted as /boot.\n" +
"To boot from your hard disk, a small /boot partition\n" +
"(approx. %1) is required. Consider creating one.\n" +
"Partitions assigned to /boot will automatically be changed to\n" +
"type 0x41 PReP/CHRP.\n" +
"\n" +
"Really use the setup without /boot partition?\n"
),
Storage.KByteToHumanStringOmitZeroes(4 * 1024)
)
ok = false if !Popup.YesNo(message)
end
if (Ops.greater_or_equal(root_end, Partitions.BootCyl) || ) &&
AutoinstData.BootCylWarning
message = Builtins.sformat(
_(
"Warning: According to your setup, you intend to\n" +
"boot your machine from the root partition (/), which, unfortunately,\n" +
"has an end cylinder above %1. Your BIOS does not seem capable\n" +
"of booting partitions beyond the %1 cylinder boundary,\n" +
"which means your %2 installation will not be\n" +
"directly bootable.\n" +
"\n" +
"Really use this setup?\n"
),
Partitions.BootCyl,
Product.name
)
ok = false if !Popup.YesNo(message)
end
end
if root_subvols_shadowed ||
message = _(
"Warning: Some subvolumes of the root filesystem are shadowed by\n" +
"mount points of other filesystem. This could lead to problems.\n" +
"\n" +
"Really use this setup?\n"
)
ok = false if !Popup.YesNo(message)
end
if installation && !Arch.board_iseries &&
((root_raid && !boot_found || boot_raid) && raid_type != "raid1" || ) &&
AutoinstData.BootRaidWarning
message = Builtins.sformat(
_(
"Warning: With your current setup, your %1\n" +
"installation might not be directly bootable, because\n" +
"your files below \"/boot\" are on a software RAID device.\n" +
"The boot loader setup sometimes fails in this configuration.\n" +
"\n" +
"Really use this setup?\n"
),
Product.name
)
ok = false if !Popup.YesNo(message)
end
if (Partitions.EfiBoot || Arch.ia64) && installation &&
(!boot_found || boot_fs != :vfat) ||
message = Builtins.sformat(
_(
"Warning: With your current setup, your %2 installation\n" +
"will encounter problems when booting, because you have no\n" +
"FAT partition mounted on %1.\n" +
"\n" +
"This will cause severe problems with the normal boot setup.\n" +
"\n" +
"If you do not know exactly what you are doing, use a normal\n" +
"FAT partition for your files below %1.\n" +
"\n" +
"Really use this setup?\n"
),
Partitions.BootMount,
Product.name
)
ok = false if !Popup.YesNo(message)
end
if root_dmraid && !boot_found ||
message = Builtins.sformat(
_(
"Warning: With your current setup, your %2 installation will\n" +
"encounter problems when booting, because you have no \n" +
"separate %1 partition on your RAID disk.\n" +
"\n" +
"This will cause severe problems with the normal boot setup.\n" +
"\n" +
"If you do not know exactly what you are doing, use a normal\n" +
"partition for your files below %1.\n" +
"\n" +
"Really use this setup?\n"
),
Partitions.BootMount,
Product.name
)
ok = false if !Popup.YesNo(message)
end
if (Partitions.EfiBoot || Arch.ia64) && installation && boot_found && gpt_boot_ia64 ||
message = Ops.add(
Ops.add(ia64_gpt_text, "\n"),
_("Really use this setup?")
)
ok = false if !Popup.YesNo(message)
end
if !swap_found && Stage.initial && root_fs != :nfs ||
message = _(
"\n" +
"You have not assigned a swap partition. In most cases, we highly recommend \n" +
"to create and assign a swap partition.\n" +
"Swap partitions on your system are listed in the main window with the\n" +
"type \"Linux Swap\". An assigned swap partition has the mount point \"swap\".\n" +
"You can assign more than one swap partition, if desired.\n" +
"\n" +
"Really use the setup without swap partition?\n"
)
ok = false if !Popup.YesNo(message)
end
if partition_mounted_but_not_formated && installation ||
message = _(
"\n" +
"You chose to install onto an existing partition that will not be\n" +
"formatted. YaST cannot guarantee your installation will succeed,\n" +
"particularly in any of the following cases:\n"
) +
_(
"- if this is an existing ReiserFS partition\n" +
"- if this partition already contains a Linux distribution that will be\n" +
"overwritten\n" +
"- if this partition does not yet contain a file system\n"
) +
_(
"If in doubt, better go back and mark this partition for\n" +
"formatting, especially if it is assigned to one of the standard mount points\n" +
"like /, /boot, /opt or /var.\n"
) +
_(
"If you decide to format the partition, all data on it will be lost.\n" +
"\n" +
"Really keep the partition unformatted?\n"
)
ok = false if !Popup.YesNo(message)
end
ok
end
|