Make NTFS an advanced option (#753)

* Make NTFS an advanced option
This commit is contained in:
Dylan M. Taylor 2021-11-22 15:08:41 -05:00 committed by GitHub
parent 0c96ae049d
commit e532b76158
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 13 deletions

View File

@ -2,11 +2,11 @@ import logging
from .helpers import sort_block_devices_based_on_performance, select_largest_device, select_disk_larger_than_or_close_to
from ..output import log
def suggest_single_disk_layout(block_device, default_filesystem=None):
def suggest_single_disk_layout(block_device, default_filesystem=None, advanced_options=False):
if not default_filesystem:
from ..user_interaction import ask_for_main_filesystem_format
default_filesystem = ask_for_main_filesystem_format()
default_filesystem = ask_for_main_filesystem_format(advanced_options)
MIN_SIZE_TO_ALLOW_HOME_PART = 40 # Gb
using_subvolumes = False
@ -89,10 +89,10 @@ def suggest_single_disk_layout(block_device, default_filesystem=None):
return layout
def suggest_multi_disk_layout(block_devices, default_filesystem=None):
def suggest_multi_disk_layout(block_devices, default_filesystem=None, advanced_options=False):
if not default_filesystem:
from ..user_interaction import ask_for_main_filesystem_format
default_filesystem = ask_for_main_filesystem_format()
default_filesystem = ask_for_main_filesystem_format(advanced_options)
# Not really a rock solid foundation of information to stand on, but it's a start:
# https://www.reddit.com/r/btrfs/comments/m287gp/partition_strategy_for_two_physical_disks/

View File

@ -481,15 +481,21 @@ def ask_for_disk_layout():
return next((key for key, val in options.items() if val == value), None)
def ask_for_main_filesystem_format():
def ask_for_main_filesystem_format(advanced_options=False):
options = {
'btrfs': 'btrfs',
'ext4': 'ext4',
'xfs': 'xfs',
'f2fs': 'f2fs',
'f2fs': 'f2fs'
}
advanced = {
'ntfs': 'ntfs'
}
if advanced_options:
options.update(advanced)
value = generic_select(options, "Select which filesystem your main partition should use (by number or name): ", allow_empty_input=False)
return next((key for key, val in options.items() if val == value), None)
@ -562,11 +568,11 @@ def partition_overlap(partitions :list, start :str, end :str) -> bool:
# TODO: Implement sanity check
return False
def get_default_partition_layout(block_devices):
def get_default_partition_layout(block_devices, advanced_options=False):
if len(block_devices) == 1:
return suggest_single_disk_layout(block_devices[0])
return suggest_single_disk_layout(block_devices[0], advanced_options=advanced_options)
else:
return suggest_multi_disk_layout(block_devices)
return suggest_multi_disk_layout(block_devices, advanced_options=advanced_options)
# TODO: Implement sane generic layout for 2+ drives
@ -762,7 +768,7 @@ def select_individual_blockdevice_usage(block_devices :list):
return result
def select_disk_layout(block_devices :list):
def select_disk_layout(block_devices :list, advanced_options=False):
modes = [
"Wipe all selected drives and use a best-effort default partition layout",
"Select what to do with each individual drive (followed by partition usage)"
@ -771,7 +777,7 @@ def select_disk_layout(block_devices :list):
mode = generic_select(modes, input_text=f"Select what you wish to do with the selected block devices: ")
if mode == 'Wipe all selected drives and use a best-effort default partition layout':
return get_default_partition_layout(block_devices)
return get_default_partition_layout(block_devices, advanced_options)
else:
return select_individual_blockdevice_usage(block_devices)

View File

@ -109,7 +109,7 @@ def ask_user_questions():
allow_empty=True)
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.storage['disk_layouts'] = archinstall.select_disk_layout(archinstall.arguments['harddrives'], archinstall.arguments.get('advanced', False))
# Get disk encryption password (or skip if blank)
if archinstall.arguments['harddrives'] and archinstall.arguments.get('!encryption-password', None) is None: