From e2cd617d05d87bbe3fe8f1809faecd8c1ebd230e Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 11 Feb 2021 14:11:21 +0100 Subject: Reworked the way partition formatting works. As well as added some flags to the partition if it's locked/unlocked for partitioning. By defaults partitions will now be in a locked state - prohibiting formatting unless set or overridden in the formatting call. This allows us to selectively format partitions individually later on. There's also a target_mountpoint that is the desired relative mount point inside a installation. This can be pre-pended with the installation base directory during mount. These changes also function as indicators for the installation (and guided installation) for which partitions to use and/or wipe. If an entire drive is selected for wiping, these changes will have no affect in the decision making as all partitions will be new and have formatable set to true. --- examples/guided.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/guided.py b/examples/guided.py index c5e1474e..5e8a64c1 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -105,18 +105,22 @@ else: if archinstall.arguments['harddrive'].has_partitions(): archinstall.log(f" ! {archinstall.arguments['harddrive']} contains existing partitions", fg='red') try: + partition_mountpoints = {} for partition in archinstall.arguments['harddrive']: if partition.filesystem_supported(): archinstall.log(f" {partition}") + partition_mountpoints[partition] = None - if (option := input('Do you wish to keep existing disk setup or format entire drive? (k/f): ')).lower() in ('k', 'keep'): - # If we want to keep the existing partitioning table - # Make sure that it's the selected drive mounted under /mnt - # That way, we can rely on genfstab and some manual post-installation steps. - if archinstall.arguments['harddrive'].has_mount_point(archinstall.storage['MOUNT_POINT']) is False: - raise archinstall.DiskError(f"The selected drive {archinstall.arguments['harddrive']} is not pre-mounted to {archinstall.storage['MOUNT_POINT']}. This is required when keeping a existing partitioning scheme.") + if (option := input('Do you wish to keep one/more existing partitions or format entire drive? (k/f): ')).lower() in ('k', 'keep'): + archinstall.arguments['harddrive'].keep_partitions = True + while True: + partition = archinstall.generic_select(partition_mountpoints.values(), "Select a partition to assign mount-point to") + + archinstall.arguments['harddrive'].allocate_partitions(selections) archinstall.log('Using existing partition table reported above.') + else: + archinstall.arguments['harddrive'].keep_partitions = False except archinstall.UnknownFilesystemFormat as err: archinstall.log(f"Current filesystem is not supported: {err}", fg='red') input(f"Do you wish to erase all data? (y/n):") -- cgit v1.2.3-70-g09d2