parent
0c96ae049d
commit
e532b76158
|
|
@ -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 .helpers import sort_block_devices_based_on_performance, select_largest_device, select_disk_larger_than_or_close_to
|
||||||
from ..output import log
|
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:
|
if not default_filesystem:
|
||||||
from ..user_interaction import ask_for_main_filesystem_format
|
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
|
MIN_SIZE_TO_ALLOW_HOME_PART = 40 # Gb
|
||||||
using_subvolumes = False
|
using_subvolumes = False
|
||||||
|
|
||||||
|
|
@ -89,10 +89,10 @@ def suggest_single_disk_layout(block_device, default_filesystem=None):
|
||||||
return layout
|
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:
|
if not default_filesystem:
|
||||||
from ..user_interaction import ask_for_main_filesystem_format
|
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:
|
# 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/
|
# https://www.reddit.com/r/btrfs/comments/m287gp/partition_strategy_for_two_physical_disks/
|
||||||
|
|
|
||||||
|
|
@ -481,15 +481,21 @@ def ask_for_disk_layout():
|
||||||
return next((key for key, val in options.items() if val == value), None)
|
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 = {
|
options = {
|
||||||
'btrfs': 'btrfs',
|
'btrfs': 'btrfs',
|
||||||
'ext4': 'ext4',
|
'ext4': 'ext4',
|
||||||
'xfs': 'xfs',
|
'xfs': 'xfs',
|
||||||
'f2fs': 'f2fs',
|
'f2fs': 'f2fs'
|
||||||
|
}
|
||||||
|
|
||||||
|
advanced = {
|
||||||
'ntfs': 'ntfs'
|
'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)
|
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)
|
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
|
# TODO: Implement sanity check
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def get_default_partition_layout(block_devices):
|
def get_default_partition_layout(block_devices, advanced_options=False):
|
||||||
if len(block_devices) == 1:
|
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:
|
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
|
# TODO: Implement sane generic layout for 2+ drives
|
||||||
|
|
||||||
|
|
@ -762,7 +768,7 @@ def select_individual_blockdevice_usage(block_devices :list):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def select_disk_layout(block_devices :list):
|
def select_disk_layout(block_devices :list, advanced_options=False):
|
||||||
modes = [
|
modes = [
|
||||||
"Wipe all selected drives and use a best-effort default partition layout",
|
"Wipe all selected drives and use a best-effort default partition layout",
|
||||||
"Select what to do with each individual drive (followed by partition usage)"
|
"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: ")
|
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':
|
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:
|
else:
|
||||||
return select_individual_blockdevice_usage(block_devices)
|
return select_individual_blockdevice_usage(block_devices)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ def ask_user_questions():
|
||||||
allow_empty=True)
|
allow_empty=True)
|
||||||
|
|
||||||
if archinstall.arguments.get('harddrives', None) is not None and archinstall.storage.get('disk_layouts', None) is None:
|
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)
|
# Get disk encryption password (or skip if blank)
|
||||||
if archinstall.arguments['harddrives'] and archinstall.arguments.get('!encryption-password', None) is None:
|
if archinstall.arguments['harddrives'] and archinstall.arguments.get('!encryption-password', None) is None:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue