Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch sudo #1

Closed
wants to merge 8 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions archinstall/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down Expand Up @@ -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.
Expand Down