From e3adab13e837cbca619a7914b76c72e4d1e6d4d8 Mon Sep 17 00:00:00 2001 From: Werner Llácer Date: Tue, 1 Feb 2022 16:44:39 +0100 Subject: Issue923 (#927) * Correct definition of btrfs standard layout * Solving issue 923. Standarize keyword "wipe" to signal the need of formatting a FS * flake8 complains --- archinstall/lib/disk/filesystem.py | 12 ++++++------ archinstall/lib/disk/user_guides.py | 12 ++++++------ archinstall/lib/user_interaction.py | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'archinstall/lib') diff --git a/archinstall/lib/disk/filesystem.py b/archinstall/lib/disk/filesystem.py index b5dcdf85..64b8008c 100644 --- a/archinstall/lib/disk/filesystem.py +++ b/archinstall/lib/disk/filesystem.py @@ -7,7 +7,7 @@ from typing import Optional, Dict, Any, TYPE_CHECKING # https://stackoverflow.com/a/39757388/929999 if TYPE_CHECKING: from .blockdevice import BlockDevice - + from .partition import Partition from .validators import valid_fs_type from ..exceptions import DiskError @@ -76,7 +76,7 @@ class Filesystem: # We then iterate the partitions in order for partition in layout.get('partitions', []): # We don't want to re-add an existing partition (those containing a UUID already) - if partition.get('format', False) and not partition.get('PARTUUID', None): + if partition.get('wipe', False) and not partition.get('PARTUUID', None): print("Adding partition....") partition['device_instance'] = self.add_partition(partition.get('type', 'primary'), start=partition.get('start', '1MiB'), # TODO: Revisit sane block starts (4MB for memorycards for instance) @@ -113,11 +113,11 @@ class Filesystem: loopdev = f"{storage.get('ENC_IDENTIFIER', 'ai')}{pathlib.Path(partition['mountpoint']).name}loop" else: loopdev = f"{storage.get('ENC_IDENTIFIER', 'ai')}{pathlib.Path(partition['device_instance'].path).name}" - + partition['device_instance'].encrypt(password=partition['!password']) # Immediately unlock the encrypted device to format the inner volume with luks2(partition['device_instance'], loopdev, partition['!password'], auto_unmount=True) as unlocked_device: - if not partition.get('format'): + if not partition.get('wipe'): if storage['arguments'] == 'silent': raise ValueError(f"Missing fs-type to format on newly created encrypted partition {partition['device_instance']}") else: @@ -133,7 +133,7 @@ class Filesystem: break unlocked_device.format(partition['filesystem']['format'], options=format_options) - elif partition.get('format', False): + elif partition.get('wipe', False): if not partition['device_instance']: raise DiskError(f"Internal error caused us to loose the partition. Please report this issue upstream!") @@ -150,7 +150,7 @@ class Filesystem: def partprobe(self) -> bool: result = SysCommand(f'partprobe {self.blockdevice.device}') - + if result.exit_code != 0: log(f"Could not execute partprobe: {result!r}", level=logging.ERROR, fg="red") raise DiskError(f"Could not run partprobe: {result!r}") diff --git a/archinstall/lib/disk/user_guides.py b/archinstall/lib/disk/user_guides.py index 4ba22b4f..25db14ea 100644 --- a/archinstall/lib/disk/user_guides.py +++ b/archinstall/lib/disk/user_guides.py @@ -46,7 +46,7 @@ def suggest_single_disk_layout(block_device :BlockDevice, "size" : "203MiB", "boot" : True, "encrypted" : False, - "format" : True, + "wipe" : True, "mountpoint" : "/boot", "filesystem" : { "format" : "fat32" @@ -65,7 +65,7 @@ def suggest_single_disk_layout(block_device :BlockDevice, "type" : "primary", "start" : "206MiB", "encrypted" : False, - "format" : True, + "wipe" : True, "mountpoint" : "/" if not using_subvolumes else None, "filesystem" : { "format" : default_filesystem @@ -114,7 +114,7 @@ def suggest_single_disk_layout(block_device :BlockDevice, "start" : f"{min(block_device.size, 20)}GiB", "size" : "100%", "encrypted" : False, - "format" : True, + "wipe" : True, "mountpoint" : "/home", "filesystem" : { "format" : default_filesystem @@ -166,7 +166,7 @@ def suggest_multi_disk_layout(block_devices :List[BlockDevice], "size" : "203MiB", "boot" : True, "encrypted" : False, - "format" : True, + "wipe" : True, "mountpoint" : "/boot", "filesystem" : { "format" : "fat32" @@ -183,7 +183,7 @@ def suggest_multi_disk_layout(block_devices :List[BlockDevice], "start" : "206MiB", "size" : "100%", "encrypted" : False, - "format" : True, + "wipe" : True, "mountpoint" : "/", "filesystem" : { "format" : default_filesystem @@ -198,7 +198,7 @@ def suggest_multi_disk_layout(block_devices :List[BlockDevice], "start" : "1MiB", "size" : "100%", "encrypted" : False, - "format" : True, + "wipe" : True, "mountpoint" : "/home", "filesystem" : { "format" : default_filesystem diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 0ce19346..d5cd9257 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -661,7 +661,7 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> Dict[str, A block_device_struct["partitions"][partition]['mountpoint'] = mountpoint if mountpoint == '/boot': log(f"Marked partition as bootable because mountpoint was set to /boot.", fg="yellow") - block_device_struct["partitions"][block_device_struct["partitions"].index(partition)]['boot'] = True + block_device_struct["partitions"][partition]['boot'] = True else: del(block_device_struct["partitions"][partition]['mountpoint']) @@ -682,7 +682,7 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> Dict[str, A block_device_struct["partitions"][partition]['filesystem']['format'] = fstype # Negate the current wipe marking - block_device_struct["partitions"][partition]['format'] = not block_device_struct["partitions"][partition].get('format', False) + block_device_struct["partitions"][partition]['wipe'] = not block_device_struct["partitions"][partition].get('wipe', False) elif task == "Mark/Unmark a partition as encrypted": title = f'{current_layout}\n\nSelect which partition to mark as encrypted' -- cgit v1.2.3-70-g09d2