Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/disk.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds@gmail.com>2021-03-08 17:17:55 +0100
committerAnton Hvornum <anton.feeds@gmail.com>2021-03-08 17:17:55 +0100
commit0306209f3a494b00bab6b89b07e8c009b4b3c581 (patch)
tree13ac114bb0feb1b8aeb479a68aba2875d1f799f7 /archinstall/lib/disk.py
parent8bf3296749ebfddc5dfdcbb116547395438d371f (diff)
Fixed 'mount point does not exist' on temporary mount point.
Diffstat (limited to 'archinstall/lib/disk.py')
-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):