Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archinstall/lib/disk.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py
index 56c75767..01a736a3 100644
--- a/archinstall/lib/disk.py
+++ b/archinstall/lib/disk.py
@@ -1,4 +1,5 @@
import glob, re, os, json, time, hashlib
+import pathlib
from collections import OrderedDict
from .exceptions import DiskError
from .general import *
@@ -175,12 +176,17 @@ class Partition():
def has_content(self):
temporary_mountpoint = '/tmp/'+hashlib.md5(bytes(f"{time.time()}", 'UTF-8')+os.urandom(12)).hexdigest()
+ temporary_path = pathlib.Path(temporary_mountpoint)
+
+ temporary_path.mkdir(parents=True, exist_ok=True)
if (handle := sys_command(f'/usr/bin/mount {self.path} {temporary_mountpoint}')).exit_code != 0:
raise DiskError(f'Could not mount and check for content on {self.path} because: {b"".join(handle)}')
files = len(glob.glob(f"{temporary_mountpoint}/*"))
sys_command(f'/usr/bin/umount {temporary_mountpoint}')
+ temporary_path.rmdir()
+
return True if files > 0 else False
def safe_to_format(self):