Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/disk
diff options
context:
space:
mode:
Diffstat (limited to 'archinstall/lib/disk')
-rw-r--r--archinstall/lib/disk/device_handler.py17
-rw-r--r--archinstall/lib/disk/device_model.py11
-rw-r--r--archinstall/lib/disk/fido.py7
3 files changed, 15 insertions, 20 deletions
diff --git a/archinstall/lib/disk/device_handler.py b/archinstall/lib/disk/device_handler.py
index 6927671d..baed2f6f 100644
--- a/archinstall/lib/disk/device_handler.py
+++ b/archinstall/lib/disk/device_handler.py
@@ -154,20 +154,19 @@ class DeviceHandler(object):
mountpoint = Path(common_prefix)
try:
- result = SysCommand(f'btrfs subvolume list {mountpoint}')
+ result = SysCommand(f'btrfs subvolume list {mountpoint}').decode()
except SysCallError as err:
debug(f'Failed to read btrfs subvolume information: {err}')
return subvol_infos
try:
- if decoded := result.decode('utf-8'):
- # ID 256 gen 16 top level 5 path @
- for line in decoded.splitlines():
- # expected output format:
- # ID 257 gen 8 top level 5 path @home
- name = Path(line.split(' ')[-1])
- sub_vol_mountpoint = lsblk_info.btrfs_subvol_info.get(name, None)
- subvol_infos.append(_BtrfsSubvolumeInfo(name, sub_vol_mountpoint))
+ # ID 256 gen 16 top level 5 path @
+ for line in result.splitlines():
+ # expected output format:
+ # ID 257 gen 8 top level 5 path @home
+ name = Path(line.split(' ')[-1])
+ sub_vol_mountpoint = lsblk_info.btrfs_subvol_info.get(name, None)
+ subvol_infos.append(_BtrfsSubvolumeInfo(name, sub_vol_mountpoint))
except json.decoder.JSONDecodeError as err:
error(f"Could not decode lsblk JSON: {result}")
raise err
diff --git a/archinstall/lib/disk/device_model.py b/archinstall/lib/disk/device_model.py
index 26169485..4ac53b0c 100644
--- a/archinstall/lib/disk/device_model.py
+++ b/archinstall/lib/disk/device_model.py
@@ -1111,12 +1111,12 @@ def _fetch_lsblk_info(dev_path: Optional[Union[Path, str]] = None, retry: int =
for retry_attempt in range(retry):
try:
- result = SysCommand(f'lsblk --json -b -o+{lsblk_fields} {dev_path}')
+ result = SysCommand(f'lsblk --json -b -o+{lsblk_fields} {dev_path}').decode()
break
except SysCallError as err:
# Get the output minus the message/info from lsblk if it returns a non-zero exit code.
if err.worker:
- err_str = err.worker.decode('UTF-8')
+ err_str = err.worker.decode()
debug(f'Error calling lsblk: {err_str}')
else:
raise err
@@ -1127,10 +1127,9 @@ def _fetch_lsblk_info(dev_path: Optional[Union[Path, str]] = None, retry: int =
time.sleep(1)
try:
- if decoded := result.decode('utf-8'):
- block_devices = json.loads(decoded)
- blockdevices = block_devices['blockdevices']
- return [LsblkInfo.from_json(device) for device in blockdevices]
+ block_devices = json.loads(result)
+ blockdevices = block_devices['blockdevices']
+ return [LsblkInfo.from_json(device) for device in blockdevices]
except json.decoder.JSONDecodeError as err:
error(f"Could not decode lsblk JSON: {result}")
raise err
diff --git a/archinstall/lib/disk/fido.py b/archinstall/lib/disk/fido.py
index 9eeba56a..49904c17 100644
--- a/archinstall/lib/disk/fido.py
+++ b/archinstall/lib/disk/fido.py
@@ -2,7 +2,7 @@ from __future__ import annotations
import getpass
from pathlib import Path
-from typing import List, Optional
+from typing import List
from .device_model import PartitionModification, Fido2Device
from ..general import SysCommand, SysCommandWorker, clear_vt100_escape_codes
@@ -38,14 +38,11 @@ class Fido2:
# down moving the cursor in the menu
if not cls._loaded or reload:
try:
- ret: Optional[str] = SysCommand("systemd-cryptenroll --fido2-device=list").decode('UTF-8')
+ ret = SysCommand("systemd-cryptenroll --fido2-device=list").decode()
except SysCallError:
error('fido2 support is most likely not installed')
raise ValueError('HSM devices can not be detected, is libfido2 installed?')
- if not ret:
- return []
-
fido_devices: str = clear_vt100_escape_codes(ret) # type: ignore
manufacturer_pos = 0