Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion archinstall/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import sys

from archinstall.main import main

if __name__ == '__main__':
main()
sys.exit(main())
19 changes: 13 additions & 6 deletions archinstall/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,20 @@ def _log_sys_info() -> None:
debug(f'Disk states before installing:\n{disk_layouts()}')


def _check_online() -> None:
def _check_online() -> bool:
try:
ping('1.1.1.1')
except OSError as ex:
if 'Network is unreachable' in str(ex):
if not arch_config_handler.args.skip_wifi_check:
success = not wifi_handler.setup()
if not success:
sys.exit(0)
return False

return True

def _fetch_arch_db() -> None:

def _fetch_arch_db() -> bool:
info('Fetching Arch Linux package database...')
try:
Pacman.run('-Sy')
Expand All @@ -55,7 +57,9 @@ def _fetch_arch_db() -> None:
error('Run archinstall --debug and check /var/log/archinstall/install.log for details.')

debug(f'Failed to sync Arch Linux package database: {e}')
sys.exit(1)
return False

return True


def run() -> int:
Expand All @@ -75,8 +79,11 @@ def run() -> int:
_log_sys_info()

if not arch_config_handler.args.offline:
_check_online()
_fetch_arch_db()
if not _check_online():
return 0

if not _fetch_arch_db():
return 1

if not arch_config_handler.args.skip_version_check:
upgrade = check_version_upgrade()
Expand Down
3 changes: 1 addition & 2 deletions archinstall/scripts/guided.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import sys
import time
from pathlib import Path

Expand Down Expand Up @@ -192,7 +191,7 @@ def guided() -> None:
config.save()

if arch_config_handler.args.dry_run:
sys.exit(0)
return

if not arch_config_handler.args.silent:
aborted = False
Expand Down
3 changes: 1 addition & 2 deletions archinstall/scripts/minimal.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
from pathlib import Path

from archinstall.default_profiles.minimal import MinimalProfile
Expand Down Expand Up @@ -68,7 +67,7 @@ def _minimal() -> None:
config.save()

if arch_config_handler.args.dry_run:
sys.exit(0)
return

if not arch_config_handler.args.silent:
aborted = False
Expand Down
3 changes: 1 addition & 2 deletions archinstall/scripts/only_hd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
from pathlib import Path

from archinstall.lib.args import arch_config_handler
Expand Down Expand Up @@ -64,7 +63,7 @@ def _only_hd() -> None:
config.save()

if arch_config_handler.args.dry_run:
sys.exit(0)
return

if not arch_config_handler.args.silent:
aborted = False
Expand Down