From 12b5e2e4e9537fbae0ec21ced9d21482b29610d3 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 26 Apr 2022 13:17:40 +0200 Subject: Adding compression as an option (#1084) * Adding compression as an option * Ignore 'misaligned' ending parenthathese * Moved the 'mark compressed' logic into the sub block within manual disk operations. * Fixed flake8 complaints * Muting a complextion warning on manage_new_and_existing_partitions(). It is too complex, but not something that we'll bother with for v2.4.0. As this whole function could be replaced with a new and improved menu system split into tasks rather than one huge if/else. --- archinstall/lib/disk/user_guides.py | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'archinstall/lib/disk/user_guides.py') diff --git a/archinstall/lib/disk/user_guides.py b/archinstall/lib/disk/user_guides.py index 90d323c7..63ec1d9b 100644 --- a/archinstall/lib/disk/user_guides.py +++ b/archinstall/lib/disk/user_guides.py @@ -23,12 +23,17 @@ def suggest_single_disk_layout(block_device :BlockDevice, MIN_SIZE_TO_ALLOW_HOME_PART = 40 # GiB using_subvolumes = False using_home_partition = False + compression = False if default_filesystem == 'btrfs': prompt = 'Would you like to use BTRFS subvolumes with a default structure?' choice = Menu(prompt, ['yes', 'no'], skip=False, default_option='yes').run() using_subvolumes = choice == 'yes' + prompt = 'Would you like to use BTRFS compression?' + choice = Menu(prompt, ['yes', 'no'], skip=False, default_option='yes').run() + compression = choice == 'yes' + layout = { block_device.path : { "wipe" : True, @@ -73,7 +78,8 @@ def suggest_single_disk_layout(block_device :BlockDevice, "wipe" : True, "mountpoint" : "/" if not using_subvolumes else None, "filesystem" : { - "format" : default_filesystem + "format" : default_filesystem, + "mount_options" : ["compress=zstd"] if compression else [] } }) @@ -124,7 +130,8 @@ def suggest_single_disk_layout(block_device :BlockDevice, "wipe" : True, "mountpoint" : "/home", "filesystem" : { - "format" : default_filesystem + "format" : default_filesystem, + "mount_options" : ["compress=zstd"] if compression else [] } }) @@ -151,6 +158,17 @@ def suggest_multi_disk_layout(block_devices :List[BlockDevice], home_device = select_largest_device(block_devices, gigabytes=MIN_SIZE_TO_ALLOW_HOME_PART) root_device = select_disk_larger_than_or_close_to(block_devices, gigabytes=ARCH_LINUX_INSTALLED_SIZE, filter_out=[home_device]) + compression = False + + if default_filesystem == 'btrfs': + # prompt = 'Would you like to use BTRFS subvolumes with a default structure?' + # choice = Menu(prompt, ['yes', 'no'], skip=False, default_option='yes').run() + # using_subvolumes = choice == 'yes' + + prompt = 'Would you like to use BTRFS compression?' + choice = Menu(prompt, ['yes', 'no'], skip=False, default_option='yes').run() + compression = choice == 'yes' + log(f"Suggesting multi-disk-layout using {len(block_devices)} disks, where {root_device} will be /root and {home_device} will be /home", level=logging.DEBUG) layout = { @@ -193,7 +211,8 @@ def suggest_multi_disk_layout(block_devices :List[BlockDevice], "wipe" : True, "mountpoint" : "/", "filesystem" : { - "format" : default_filesystem + "format" : default_filesystem, + "mount_options" : ["compress=zstd"] if compression else [] } }) if has_uefi(): @@ -208,7 +227,8 @@ def suggest_multi_disk_layout(block_devices :List[BlockDevice], "wipe" : True, "mountpoint" : "/home", "filesystem" : { - "format" : default_filesystem + "format" : default_filesystem, + "mount_options" : ["compress=zstd"] if compression else [] } }) -- cgit v1.2.3-54-g00ecf