summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/fs.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/utils/fs.py b/src/utils/fs.py
index fc326ab..8f45ad5 100644
--- a/src/utils/fs.py
+++ b/src/utils/fs.py
@@ -165,10 +165,11 @@ def mkfs(fs, disk, partition, label=None):
except ValueError as e:
raise OgError(f'mkfs aborted: {e}') from e
- fsdict[fs](partdev, label)
+ return fsdict[fs](partdev, label)
def mkfs_ext4(partdev, label=None):
+ err = -1
if label:
cmd = shlex.split(f'mkfs.ext4 -L {label} -F {partdev}')
else:
@@ -177,12 +178,15 @@ def mkfs_ext4(partdev, label=None):
ret = subprocess.run(cmd,
stdout=logfile,
stderr=STDOUT)
-
+ err = ret.returncode
if ret.returncode != 0:
logging.error(f'mkfs.ext4 reports return code {ret.returncode} for {partdev}')
+ return err
+
def mkfs_ntfs(partdev, label=None):
+ err = -1
if label:
cmd = shlex.split(f'mkfs.ntfs -f -L {label} {partdev}')
else:
@@ -191,12 +195,15 @@ def mkfs_ntfs(partdev, label=None):
ret = subprocess.run(cmd,
stdout=logfile,
stderr=STDOUT)
-
+ err = ret.returncode
if ret.returncode != 0:
logging.error(f'mkfs.ntfs reports return code {ret.returncode} for {partdev}')
+ return err
+
def mkfs_fat32(partdev, label=None):
+ err = -1
if label:
cmd = shlex.split(f'mkfs.vfat -n {label} -F32 {partdev}')
else:
@@ -205,12 +212,15 @@ def mkfs_fat32(partdev, label=None):
ret = subprocess.run(cmd,
stdout=logfile,
stderr=STDOUT)
-
+ err = ret.returncode
if ret.returncode != 0:
logging.error(f'mkfs.vfat reports return code {ret.returncode} for {partdev}')
+ return err
+
def mkfs_swap(partdev, label=None):
+ err = -1
if label:
cmd = shlex.split(f'mkswap -f -L {label} {partdev}')
else:
@@ -219,10 +229,12 @@ def mkfs_swap(partdev, label=None):
ret = subprocess.run(cmd,
stdout=logfile,
stderr=STDOUT)
-
+ err = ret.returncode
if ret.returncode != 0:
logging.error(f'mkswap reports return code {ret.returncode} for {partdev}')
+ return err
+
def get_filesystem_type(partdev):
"""