diff --git a/archinstall/__init__.py b/archinstall/__init__.py index 5429b5cdcd..0f488d5dd4 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -60,10 +60,6 @@ # 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.