index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Anton Hvornum <anton.feeds@gmail.com> | 2021-03-08 17:17:55 +0100 |
---|---|---|
committer | Anton Hvornum <anton.feeds@gmail.com> | 2021-03-08 17:17:55 +0100 |
commit | 0306209f3a494b00bab6b89b07e8c009b4b3c581 (patch) | |
tree | 13ac114bb0feb1b8aeb479a68aba2875d1f799f7 /archinstall/lib | |
parent | 8bf3296749ebfddc5dfdcbb116547395438d371f (diff) |
-rw-r--r-- | archinstall/lib/disk.py | 6 |
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): |