From ce9828c2934937217daee6ba178dafedf6cabe6d Mon Sep 17 00:00:00 2001 From: Daniel Girtler Date: Wed, 18 Oct 2023 16:57:44 +1100 Subject: Fixes for prev PR (#2175) * Fixes for prev PR * Update --------- Co-authored-by: Daniel Girtler --- archinstall/__init__.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'archinstall/__init__.py') diff --git a/archinstall/__init__.py b/archinstall/__init__.py index 3949d38a..b9a0c2fb 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -89,6 +89,8 @@ def define_arguments(): parser.add_argument("--no-pkg-lookups", action="store_true", default=False, help="Disabled package validation specifically prior to starting installation.") parser.add_argument("--plugin", nargs="?", type=str) + parser.add_argument("--skip-version-check", action="store_true", + help="Skip the version check when running archinstall") def parse_unspecified_argument_list(unknowns: list, multiple: bool = False, err: bool = False) -> dict: @@ -280,8 +282,20 @@ def plugin(f, *args, **kwargs): def _check_new_version(): info("Checking version...") - Pacman.run("-Sy") - upgrade = Pacman.run("-Qu archinstall").decode() + + try: + Pacman.run("-Sy") + except Exception as e: + debug(f'Failed to perform version check: {e}') + info(f'Arch Linux mirrors are not reachable. Please check your internet connection') + exit(1) + + upgrade = None + + try: + upgrade = Pacman.run("-Qu archinstall").decode() + except Exception as e: + debug(f'Failed determine pacman version: {e}') if upgrade: text = f'New version available: {upgrade}' @@ -295,7 +309,8 @@ def main(): OR straight as a module: python -m archinstall In any case we will be attempting to load the provided script to be run from the scripts/ folder """ - _check_new_version() + if not arguments.get('skip_version_check', False): + _check_new_version() script = arguments.get('script', None) -- cgit v1.2.3-54-g00ecf