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:
authorAnton Hvornum <anton@hvornum.se>2021-05-19 14:45:13 +0000
committerGitHub <noreply@github.com>2021-05-19 16:45:13 +0200
commit49e6cbdc545402e066bdc2daf6054abf6c1bf977 (patch)
treea1d4afcc6473d93bc958eab8241dbad616033dba /archinstall/lib/networking.py
parent52960bd686c92af4813ce302a21eb63a5aa67343 (diff)
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(<installation>)` 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 <anton.feeds@gmail.com> Co-authored-by: Dylan Taylor <dylan@dylanmtaylor.com>
Diffstat (limited to 'archinstall/lib/networking.py')
-rw-r--r--archinstall/lib/networking.py13
1 files changed, 7 insertions, 6 deletions
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 = {}