Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/networking.py
diff options
context:
space:
mode:
authorDaniel Girtler <blackrabbit256@gmail.com>2022-08-01 18:29:58 +1000
committerGitHub <noreply@github.com>2022-08-01 10:29:58 +0200
commit31e6eca3af607bbfa79cda30c9e0ff16bb2b66c3 (patch)
treec4c15d78297e89d23c8064afeb6e983d964055ac /archinstall/lib/networking.py
parent1bd2210e5f100ed96411c65a25c7f89dd854b35b (diff)
Handle no internet connection gracefully (#1361)
* Handle no internet connection gracefully * Update * flake8 * Update * Update Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
Diffstat (limited to 'archinstall/lib/networking.py')
-rw-r--r--archinstall/lib/networking.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/archinstall/lib/networking.py b/archinstall/lib/networking.py
index 3e883a7b..96e8f3a1 100644
--- a/archinstall/lib/networking.py
+++ b/archinstall/lib/networking.py
@@ -4,7 +4,7 @@ import socket
import struct
from typing import Union, Dict, Any, List
-from .exceptions import HardwareIncompatibilityError
+from .exceptions import HardwareIncompatibilityError, SysCallError
from .general import SysCommand
from .output import log
from .pacman import run_pacman
@@ -33,14 +33,17 @@ def list_interfaces(skip_loopback :bool = True) -> Dict[str, str]:
def check_mirror_reachable() -> bool:
log("Testing connectivity to the Arch Linux mirrors ...", level=logging.INFO)
- if run_pacman("-Sy").exit_code == 0:
- return True
-
- elif os.geteuid() != 0:
- log("check_mirror_reachable() uses 'pacman -Sy' which requires root.", level=logging.ERROR, fg="red")
+ try:
+ if run_pacman("-Sy").exit_code == 0:
+ return True
+ elif os.geteuid() != 0:
+ log("check_mirror_reachable() uses 'pacman -Sy' which requires root.", level=logging.ERROR, fg="red")
+ except SysCallError as err:
+ log(err, level=logging.DEBUG)
return False
+
def update_keyring() -> bool:
log("Updating archlinux-keyring ...", level=logging.INFO)
if run_pacman("-Sy --noconfirm archlinux-keyring").exit_code == 0: