Use main() as script entrypoint (#4179)
This commit is contained in:
parent
76284b601b
commit
18105fff22
|
|
@ -83,7 +83,9 @@ def run() -> int:
|
||||||
arch_config_handler.print_help()
|
arch_config_handler.print_help()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if arch_config_handler.get_script() == 'list':
|
script = arch_config_handler.get_script()
|
||||||
|
|
||||||
|
if script == 'list':
|
||||||
print(_list_scripts())
|
print(_list_scripts())
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
@ -119,11 +121,10 @@ def run() -> int:
|
||||||
else:
|
else:
|
||||||
debug('Running from ISO (Live Mode)...')
|
debug('Running from ISO (Live Mode)...')
|
||||||
|
|
||||||
script = arch_config_handler.get_script()
|
|
||||||
|
|
||||||
mod_name = f'archinstall.scripts.{script}'
|
mod_name = f'archinstall.scripts.{script}'
|
||||||
# by loading the module we'll automatically run the script
|
# by loading the module we'll automatically run the script
|
||||||
importlib.import_module(mod_name)
|
module = importlib.import_module(mod_name)
|
||||||
|
module.main()
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ def perform_installation(
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def guided() -> None:
|
def main() -> None:
|
||||||
mirror_list_handler = MirrorListHandler(
|
mirror_list_handler = MirrorListHandler(
|
||||||
offline=arch_config_handler.args.offline,
|
offline=arch_config_handler.args.offline,
|
||||||
verbose=arch_config_handler.args.verbose,
|
verbose=arch_config_handler.args.verbose,
|
||||||
|
|
@ -213,7 +213,7 @@ def guided() -> None:
|
||||||
aborted = True
|
aborted = True
|
||||||
|
|
||||||
if aborted:
|
if aborted:
|
||||||
return guided()
|
return main()
|
||||||
|
|
||||||
if arch_config_handler.config.disk_config:
|
if arch_config_handler.config.disk_config:
|
||||||
fs_handler = FilesystemHandler(arch_config_handler.config.disk_config)
|
fs_handler = FilesystemHandler(arch_config_handler.config.disk_config)
|
||||||
|
|
@ -227,4 +227,5 @@ def guided() -> None:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
guided()
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ def perform_installation(mountpoint: Path) -> None:
|
||||||
info(' * devel (password: devel)')
|
info(' * devel (password: devel)')
|
||||||
|
|
||||||
|
|
||||||
def _minimal() -> None:
|
def main() -> None:
|
||||||
disk_config = DiskLayoutConfigurationMenu(disk_layout_config=None).run()
|
disk_config = DiskLayoutConfigurationMenu(disk_layout_config=None).run()
|
||||||
arch_config_handler.config.disk_config = disk_config
|
arch_config_handler.config.disk_config = disk_config
|
||||||
|
|
||||||
|
|
@ -76,7 +76,7 @@ def _minimal() -> None:
|
||||||
aborted = True
|
aborted = True
|
||||||
|
|
||||||
if aborted:
|
if aborted:
|
||||||
return _minimal()
|
return main()
|
||||||
|
|
||||||
if arch_config_handler.config.disk_config:
|
if arch_config_handler.config.disk_config:
|
||||||
fs_handler = FilesystemHandler(arch_config_handler.config.disk_config)
|
fs_handler = FilesystemHandler(arch_config_handler.config.disk_config)
|
||||||
|
|
@ -85,4 +85,5 @@ def _minimal() -> None:
|
||||||
perform_installation(arch_config_handler.args.mountpoint)
|
perform_installation(arch_config_handler.args.mountpoint)
|
||||||
|
|
||||||
|
|
||||||
_minimal()
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ def perform_installation(mountpoint: Path) -> None:
|
||||||
debug(f'Disk states after installing:\n{disk_layouts()}')
|
debug(f'Disk states after installing:\n{disk_layouts()}')
|
||||||
|
|
||||||
|
|
||||||
def _only_hd() -> None:
|
def main() -> None:
|
||||||
if not arch_config_handler.args.silent:
|
if not arch_config_handler.args.silent:
|
||||||
ask_user_questions()
|
ask_user_questions()
|
||||||
|
|
||||||
|
|
@ -72,7 +72,7 @@ def _only_hd() -> None:
|
||||||
aborted = True
|
aborted = True
|
||||||
|
|
||||||
if aborted:
|
if aborted:
|
||||||
return _only_hd()
|
return main()
|
||||||
|
|
||||||
if arch_config_handler.config.disk_config:
|
if arch_config_handler.config.disk_config:
|
||||||
fs_handler = FilesystemHandler(arch_config_handler.config.disk_config)
|
fs_handler = FilesystemHandler(arch_config_handler.config.disk_config)
|
||||||
|
|
@ -81,4 +81,5 @@ def _only_hd() -> None:
|
||||||
perform_installation(arch_config_handler.args.mountpoint)
|
perform_installation(arch_config_handler.args.mountpoint)
|
||||||
|
|
||||||
|
|
||||||
_only_hd()
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue