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:
authorDaemon Coder <11915375+codefiles@users.noreply.github.com>2023-05-04 04:42:37 -0400
committerGitHub <noreply@github.com>2023-05-04 10:42:37 +0200
commitfd83f073f3e84feb1388ef739c1096f7d4a741de (patch)
tree7662dea329d998e3912b6bd2d9c2e076b5f4a856 /archinstall/lib/networking.py
parentadceed22ad3d8b6aa1e6d1aee56ae0c9a0a751aa (diff)
Update `SysCommand()` calls in remaining files (#1707)
Diffstat (limited to 'archinstall/lib/networking.py')
-rw-r--r--archinstall/lib/networking.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/archinstall/lib/networking.py b/archinstall/lib/networking.py
index 3516aac4..b858daaf 100644
--- a/archinstall/lib/networking.py
+++ b/archinstall/lib/networking.py
@@ -38,11 +38,11 @@ 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)
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")
+ run_pacman("-Sy")
+ return True
except SysCallError as err:
+ if os.geteuid() != 0:
+ log("check_mirror_reachable() uses 'pacman -Sy' which requires root.", level=logging.ERROR, fg="red")
log(f'exit_code: {err.exit_code}, Error: {err.message}', level=logging.DEBUG)
return False
@@ -50,11 +50,12 @@ def check_mirror_reachable() -> bool:
def update_keyring() -> bool:
log("Updating archlinux-keyring ...", level=logging.INFO)
- if run_pacman("-Sy --noconfirm archlinux-keyring").exit_code == 0:
+ try:
+ run_pacman("-Sy --noconfirm archlinux-keyring")
return True
-
- elif os.geteuid() != 0:
- log("update_keyring() uses 'pacman -Sy archlinux-keyring' which requires root.", level=logging.ERROR, fg="red")
+ except SysCallError:
+ if os.geteuid() != 0:
+ log("update_keyring() uses 'pacman -Sy archlinux-keyring' which requires root.", level=logging.ERROR, fg="red")
return False
@@ -84,8 +85,10 @@ def wireless_scan(interface :str) -> None:
if interfaces[interface] != 'WIRELESS':
raise HardwareIncompatibilityError(f"Interface {interface} is not a wireless interface: {interfaces}")
- if not (output := SysCommand(f"iwctl station {interface} scan")).exit_code == 0:
- raise SystemError(f"Could not scan for wireless networks: {output}")
+ try:
+ SysCommand(f"iwctl station {interface} scan")
+ except SysCallError as error:
+ raise SystemError(f"Could not scan for wireless networks: {error}")
if '_WIFI' not in storage:
storage['_WIFI'] = {}