Update user permission check for --help (#2568)
* Update user permission check for --help * Fix code style * Fix code style * Fix docstring * Fix newline * Fix newline * Fix argument error * Fix formatting
This commit is contained in:
parent
50d269957a
commit
0f1c8ab4be
|
|
@ -60,10 +60,6 @@ debug(f"Graphics devices detected: {SysInfo._graphics_devices().keys()}")
|
|||
# For support reasons, we'll log the disk layout pre installation to match against post-installation layout
|
||||
debug(f"Disk states before installing: {disk.disk_layouts()}")
|
||||
|
||||
if 'sphinx' not in sys.modules and os.getuid() != 0:
|
||||
print(_("Archinstall requires root privileges to run. See --help for more."))
|
||||
exit(1)
|
||||
|
||||
parser = ArgumentParser()
|
||||
|
||||
|
||||
|
|
@ -96,6 +92,16 @@ def define_arguments():
|
|||
help="Skip the version check when running archinstall")
|
||||
|
||||
|
||||
if 'sphinx' not in sys.modules:
|
||||
if '--help' in sys.argv or '-h' in sys.argv:
|
||||
define_arguments()
|
||||
parser.print_help()
|
||||
exit(0)
|
||||
if os.getuid() != 0:
|
||||
print(_("Archinstall requires root privileges to run. See --help for more."))
|
||||
exit(1)
|
||||
|
||||
|
||||
def parse_unspecified_argument_list(unknowns: list, multiple: bool = False, err: bool = False) -> dict:
|
||||
"""We accept arguments not defined to the parser. (arguments "ad hoc").
|
||||
Internally argparse return to us a list of words so we have to parse its contents, manually.
|
||||
|
|
|
|||
Loading…
Reference in New Issue