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:
authorcodefiles <11915375+codefiles@users.noreply.github.com>2023-03-26 15:40:08 -0400
committerGitHub <noreply@github.com>2023-03-26 21:40:08 +0200
commitf6113107d6c7df763301de0816dcd1ae1d4ace4d (patch)
treeb997bb160ac9440124a0f65f9a980eb6607ff026 /archinstall/lib/disk
parent79eb6bba627c4c70f24a265ac0b2ef9cbfbbd211 (diff)
Change exit status indications to exit codes (#1685)
Diffstat (limited to 'archinstall/lib/disk')
-rw-r--r--archinstall/lib/disk/helpers.py2
-rw-r--r--archinstall/lib/disk/partition.py12
2 files changed, 3 insertions, 11 deletions
diff --git a/archinstall/lib/disk/helpers.py b/archinstall/lib/disk/helpers.py
index aea794f5..80d0cb53 100644
--- a/archinstall/lib/disk/helpers.py
+++ b/archinstall/lib/disk/helpers.py
@@ -233,7 +233,7 @@ def get_blockdevice_info(device_path, exclude_iso_dev :bool = True) -> Dict[str,
information = blkid(f'blkid -p -o export {device_path}')
return enrich_blockdevice_information(information)
except SysCallError as ex:
- if ex.exit_code in (512, 2):
+ if ex.exit_code == 2:
# Assume that it's a loop device, and try to get info on it
try:
resolved_device_name = device_path.readlink().name
diff --git a/archinstall/lib/disk/partition.py b/archinstall/lib/disk/partition.py
index 12b1a9a6..87eaa6a7 100644
--- a/archinstall/lib/disk/partition.py
+++ b/archinstall/lib/disk/partition.py
@@ -186,8 +186,7 @@ class Partition:
try:
output = SysCommand(f"lsblk --json -b -o+LOG-SEC,SIZE,PTTYPE,PARTUUID,UUID,FSTYPE {self.device_path}").decode('UTF-8')
except SysCallError as error:
- # It appears as if lsblk can return exit codes like 8192 to indicate something.
- # But it does return output in stderr so we'll try to catch it minus the message/info.
+ # Get the output minus the message/info from lsblk if it returns a non-zero exit code.
output = error.worker.decode('UTF-8')
if '{' in output:
output = output[output.find('{'):]
@@ -632,14 +631,7 @@ class Partition:
return False
def unmount(self) -> bool:
- worker = SysCommand(f"/usr/bin/umount {self._path}")
- exit_code = worker.exit_code
-
- # Without to much research, it seams that low error codes are errors.
- # And above 8k is indicators such as "/dev/x not mounted.".
- # So anything in between 0 and 8k are errors (?).
- if exit_code and 0 < exit_code < 8000:
- raise SysCallError(f"Could not unmount {self._path} properly: {worker}", exit_code=exit_code)
+ SysCommand(f"/usr/bin/umount {self._path}")
# Update the partition info since the mount info has changed after this call.
self._partition_info = self._fetch_information()