Added in argument support to archinstall for easier testing and debugging

This commit is contained in:
Anton Hvornum 2021-02-07 17:57:16 +01:00
parent 530edb5ece
commit c983976394
2 changed files with 19 additions and 6 deletions

View File

@ -12,4 +12,19 @@ from .lib.services import *
from .lib.packages import *
from .lib.output import *
from .lib.storage import *
from .lib.hardware import *
from .lib.hardware import *
## Basic version of arg.parse() supporting:
## --key=value
## --boolean
arguments = {}
positionals = []
for arg in sys.argv[1:]:
if '--' == arg[:2]:
if '=' in arg:
key, val = [x.strip() for x in arg[2:].split('=', 1)]
else:
key, val = arg[2:], True
arguments[key] = val
else:
positionals.append(arg)

View File

@ -5,7 +5,8 @@ import archinstall
# We'll print this right before the user gets informed about the formatting timer.
archinstall.storage['_guided'] = {}
archinstall.storage['_guided_hidden'] = {} # This will simply be hidden from printouts and things.
print(archinstall.arguments, archinstall.positionals)
exit(0)
"""
This signal-handler chain (and global variable)
is used to trigger the "Are you sure you want to abort?" question.
@ -99,7 +100,7 @@ if harddrive.has_partitions():
if partition.filesystem_supported():
archinstall.log(f" {partition}")
if (option := input('Do you wish to keep existing partition setup or format the entire disk? (k/f): ')).lower() in ('k', 'keep'):
if (option := input('Do you wish to keep existing disk setup or format entire drive? (k/f): ')).lower() in ('k', 'keep'):
# If we want to keep the existing partitioning table
# Make sure that it's the selected drive mounted under /mnt
# That way, we can rely on genfstab and some manual post-installation steps.
@ -107,9 +108,6 @@ if harddrive.has_partitions():
raise archinstall.DiskError(f"The selected drive {harddrive} is not pre-mounted to {archinstall.storage['MOUNT_POINT']}. This is required when keeping a existing partitioning scheme.")
archinstall.log('Using existing partition table reported above.')
else:
print('Formatting woop woop!')
exit(1)
while (disk_password := getpass.getpass(prompt='Enter disk encryption password (leave blank for no encryption): ')):
disk_password_verification = getpass.getpass(prompt='And one more time for verification: ')