( device: BDevice, filesystem_type: FilesystemType | None = None, separate_home: bool | None = None, )
| 593 | |
| 594 | |
| 595 | async def suggest_single_disk_layout( |
| 596 | device: BDevice, |
| 597 | filesystem_type: FilesystemType | None = None, |
| 598 | separate_home: bool | None = None, |
| 599 | ) -> DeviceModification: |
| 600 | if not filesystem_type: |
| 601 | filesystem_type = await select_main_filesystem_format() |
| 602 | |
| 603 | sector_size = device.device_info.sector_size |
| 604 | total_size = device.device_info.total_size |
| 605 | available_space = total_size |
| 606 | min_size_to_allow_home_part = Size(64, Unit.GiB, sector_size) |
| 607 | |
| 608 | if filesystem_type == FilesystemType.BTRFS: |
| 609 | prompt = tr('Would you like to use BTRFS subvolumes with a default structure?') + '\n' |
| 610 | |
| 611 | result = await Confirmation( |
| 612 | header=prompt, |
| 613 | allow_skip=False, |
| 614 | preset=True, |
| 615 | ).show() |
| 616 | |
| 617 | using_subvolumes = result.item() == MenuItem.yes() |
| 618 | mount_options = await select_mount_options() |
| 619 | else: |
| 620 | using_subvolumes = False |
| 621 | mount_options = [] |
| 622 | |
| 623 | device_modification = DeviceModification(device, wipe=True) |
| 624 | |
| 625 | using_gpt = device_handler.partition_table.is_gpt() |
| 626 | |
| 627 | if using_gpt: |
| 628 | available_space = available_space.gpt_end() |
| 629 | |
| 630 | available_space = available_space.align() |
| 631 | |
| 632 | # Used for reference: https://wiki.archlinux.org/title/partitioning |
| 633 | |
| 634 | boot_partition = _boot_partition(sector_size, using_gpt) |
| 635 | device_modification.add_partition(boot_partition) |
| 636 | |
| 637 | if separate_home is False or using_subvolumes or total_size < min_size_to_allow_home_part: |
| 638 | using_home_partition = False |
| 639 | elif separate_home: |
| 640 | using_home_partition = True |
| 641 | else: |
| 642 | prompt = tr('Would you like to create a separate partition for /home?') + '\n' |
| 643 | |
| 644 | result = await Confirmation( |
| 645 | header=prompt, |
| 646 | allow_skip=False, |
| 647 | preset=True, |
| 648 | ).show() |
| 649 | |
| 650 | using_home_partition = result.item() == MenuItem.yes() |
| 651 | |
| 652 | # root partition |
no test coverage detected