Simplified size definition in dict. (#752)

* Simplified size definition in dict. Also changed from MiB to MB and GiB to GB on places where they were used, as BlockDevice().size now returns GB by default, so no math operations needed
* Appended the /boot offset to /root when specifying /home start.
This commit is contained in:
Anton Hvornum 2021-11-22 11:27:49 +00:00 committed by GitHub
parent c264fd466a
commit 29d0b3d155
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 10 deletions

View File

@ -23,8 +23,8 @@ def suggest_single_disk_layout(block_device, default_filesystem=None):
layout[block_device.path]['partitions'].append({
# Boot
"type" : "primary",
"start" : "5MiB",
"size" : "513MiB",
"start" : "5MB",
"size" : "513MB",
"boot" : True,
"encrypted" : False,
"format" : True,
@ -36,16 +36,23 @@ def suggest_single_disk_layout(block_device, default_filesystem=None):
layout[block_device.path]['partitions'].append({
# Root
"type" : "primary",
"start" : "518MiB",
"start" : "518MB",
"encrypted" : False,
"format" : True,
"size" : "100%" if (using_subvolumes or block_device.size < MIN_SIZE_TO_ALLOW_HOME_PART) else f"{min(block_device.size, 20)*1024}MiB",
"mountpoint" : "/",
"filesystem" : {
"format" : default_filesystem
}
})
# Set a size for / (/root)
if using_subvolumes or block_device.size < MIN_SIZE_TO_ALLOW_HOME_PART:
# We'll use subvolumes
# Or the disk size is too small to allow for a separate /home
layout[block_device.path]['partitions'][-1]['size'] = '100%'
else:
layout[block_device.path]['partitions'][-1]['size'] = f"{min(block_device.size, 20)}GB"
if default_filesystem == 'btrfs' and using_subvolumes:
if input('Do you want to use a recommended structure? (Y/n): ').strip().lower() in ('', 'y', 'yes'):
# https://btrfs.wiki.kernel.org/index.php/FAQ
@ -71,7 +78,7 @@ def suggest_single_disk_layout(block_device, default_filesystem=None):
"type" : "primary",
"encrypted" : False,
"format" : True,
"start" : f"{min(block_device.size*0.2, 20)*1024}MiB",
"start" : f"{min(block_device.size+0.5, 20.5)}GB",
"size" : "100%",
"mountpoint" : "/home",
"filesystem" : {
@ -115,8 +122,8 @@ def suggest_multi_disk_layout(block_devices, default_filesystem=None):
layout[root_device.path]['partitions'].append({
# Boot
"type" : "primary",
"start" : "5MiB",
"size" : "513MiB",
"start" : "5MB",
"size" : "513MB",
"boot" : True,
"encrypted" : False,
"format" : True,
@ -128,7 +135,7 @@ def suggest_multi_disk_layout(block_devices, default_filesystem=None):
layout[root_device.path]['partitions'].append({
# Root
"type" : "primary",
"start" : "518MiB",
"start" : "518MB",
"encrypted" : False,
"format" : True,
"size" : "100%",
@ -143,7 +150,7 @@ def suggest_multi_disk_layout(block_devices, default_filesystem=None):
"type" : "primary",
"encrypted" : False,
"format" : True,
"start" : "4MiB",
"start" : "5MB",
"size" : "100%",
"mountpoint" : "/home",
"filesystem" : {

View File

@ -135,7 +135,7 @@ def ask_user_questions():
# Ask for a root password (optional, but triggers requirement for super-user if skipped)
if not archinstall.arguments.get('!root-password', None):
archinstall.arguments['!root-password'] = archinstall.get_password(prompt='Enter root password (leave blank to disable disabled & create superuser): ')
archinstall.arguments['!root-password'] = archinstall.get_password(prompt='Enter root password (leave blank to disable root & create superuser): ')
# Ask for additional users (super-user if root pw was not set)
if not archinstall.arguments.get('!root-password', None) and not archinstall.arguments.get('!superusers', None):