From 6a125d5bd2e5e0c27dc1feb3598e2e60a0526dd8 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 18 Sep 2021 11:22:18 +0200 Subject: Adding in options for BTRFS subvolumes --- archinstall/lib/disk.py | 13 +++++++++++++ examples/guided.py | 1 + 2 files changed, 14 insertions(+) diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index 872d9bfc..79a8d3c8 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -110,6 +110,19 @@ def select_disk_larger_than_or_close_to(devices, gigabytes, filter_out=None): return min(copy_devices, key=(lambda device : abs(device.size - gigabytes))) +def disk_layout_filesystem_checks(layout): + # This can probably be compressed into a any() + options = {} + for block_device in layout: + for partition in block_device.get('partitions', []): + if partition.get('filesystem', {}).get('format', False) == 'btrfs': + if not partition['filesystem'].get('subvolume', None): + if not options.get('btrfs-subvolumes', None) is None: + options['btrfs-subvolumes'] = input('Would you like to use BTRFS subvolumes? (Y/n)').strip().lower() in ('', 'y', 'yes') + + if options['btrfs-subvolumes']: + partition['filesystem']['subvolume'] = '@' # Detect /home etc, and set up sane defaults? + def suggest_single_disk_layout(block_device, default_filesystem=None): if not default_filesystem: from .user_interaction import ask_for_main_filesystem_format diff --git a/examples/guided.py b/examples/guided.py index b7c75b30..afe648e7 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -116,6 +116,7 @@ def ask_user_questions(): if archinstall.arguments.get('harddrives', None) is not None and archinstall.storage.get('disk_layouts', None) is None: archinstall.storage['disk_layouts'] = archinstall.select_disk_layout(archinstall.arguments['harddrives']) + archinstall.disk_layout_filesystem_checks(archinstall.storage['disk_layouts']) # Get disk encryption password (or skip if blank) if archinstall.arguments['harddrives'] and archinstall.arguments.get('!encryption-password', None) is None: -- cgit v1.2.3-70-g09d2