File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3838debug (f"Disk states before installing:\n { disk_layouts ()} " )
3939
4040
41- if 'sphinx' not in sys .modules and 'pylint' not in sys .modules :
42- if '--help' in sys .argv or '-h' in sys .argv :
43- arch_config_handler .print_help ()
44- exit (0 )
45- if os .getuid () != 0 :
46- print (_ ("Archinstall requires root privileges to run. See --help for more." ))
47- exit (1 )
48-
49-
5041# @archinstall.plugin decorator hook to programmatically add
5142# plugins in runtime. Useful in profiles_bck and other things.
5243def plugin (f , * args , ** kwargs ) -> None : # type: ignore[no-untyped-def]
@@ -77,12 +68,20 @@ def _check_new_version() -> None:
7768 time .sleep (3 )
7869
7970
80- def main () -> None :
71+ def main () -> int :
8172 """
8273 This can either be run as the compiled and installed application: python setup.py install
8374 OR straight as a module: python -m archinstall
8475 In any case we will be attempting to load the provided script to be run from the scripts/ folder
8576 """
77+ if '--help' in sys .argv or '-h' in sys .argv :
78+ arch_config_handler .print_help ()
79+ return 0
80+
81+ if os .getuid () != 0 :
82+ print (_ ("Archinstall requires root privileges to run. See --help for more." ))
83+ return 1
84+
8685 if not arch_config_handler .args .offline :
8786 _fetch_arch_db ()
8887
@@ -95,12 +94,15 @@ def main() -> None:
9594 # by loading the module we'll automatically run the script
9695 importlib .import_module (mod_name )
9796
97+ return 0
98+
9899
99100def run_as_a_module () -> None :
101+ rc = 0
100102 exc = None
101103
102104 try :
103- main ()
105+ rc = main ()
104106 except Exception as e :
105107 exc = e
106108 finally :
@@ -118,7 +120,9 @@ def run_as_a_module() -> None:
118120 )
119121
120122 warn (text )
121- exit (1 )
123+ rc = 1
124+
125+ exit (rc )
122126
123127
124128__all__ = [
You can’t perform that action at this time.
0 commit comments