From 49e6cbdc545402e066bdc2daf6054abf6c1bf977 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 19 May 2021 14:45:13 +0000 Subject: Reworking SysCommand & Moving to localectl for locale related activities * Moving to `localectl` rather than local file manipulation *(both for listing locales and setting them)*. * Swapped `loadkeys` for localectl. * Renamed `main` to `maim` in awesome profile. * Created `archinstall.Boot()` which spawns a `systemd-nspawn` container against the installation target. * Exposing systemd.py's internals to archinstall global scope. * Re-worked `SysCommand` completely, it's now a wrapper for `SysCommandWorker` which supports interacting with the process in a different way. `SysCommand` should behave just like the old one, for backwards compatibility reasons. This fixes #68 and #69. * `SysCommand()` now has a `.decode()` function that defaults to `UTF-8`. * Adding back peak_output=True to pacstrap. Co-authored-by: Anton Hvornum Co-authored-by: Dylan Taylor --- archinstall/lib/networking.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'archinstall/lib/networking.py') diff --git a/archinstall/lib/networking.py b/archinstall/lib/networking.py index dbd510dd..fdeefb84 100644 --- a/archinstall/lib/networking.py +++ b/archinstall/lib/networking.py @@ -1,5 +1,6 @@ import fcntl import os +import logging import socket import struct from collections import OrderedDict @@ -7,7 +8,7 @@ from collections import OrderedDict from .exceptions import * from .general import SysCommand from .storage import storage - +from .output import log def get_hw_addr(ifname): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) @@ -27,12 +28,12 @@ def list_interfaces(skip_loopback=True): def check_mirror_reachable(): - try: - check = SysCommand("pacman -Sy") - return check.exit_code == 0 - except: - return False + if (exit_code := SysCommand("pacman -Sy").exit_code) == 0: + return True + elif exit_code == 256: + log("check_mirror_reachable() uses 'pacman -Sy' which requires root.", level=logging.ERROR, fg="red") + return False def enrich_iface_types(interfaces: dict): result = {} -- cgit v1.2.3-54-g00ecf