index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Anton Hvornum <anton.feeds@gmail.com> | 2021-03-09 11:07:46 +0100 |
---|---|---|
committer | Anton Hvornum <anton.feeds@gmail.com> | 2021-03-09 11:07:46 +0100 |
commit | 56d673d2a509bdd881fff51892f564a66384c0c2 (patch) | |
tree | 17f0f7e637eca6f3130cdee5b52760665b78bcd9 /archinstall/lib | |
parent | f230140ba99f7c7ddbe8e0f7a6c7f80572cbf2ce (diff) |
-rw-r--r-- | archinstall/lib/disk.py | 22 |
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index 73d913d0..958284cf 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -146,7 +146,7 @@ class Partition(): self.mount(mountpoint) mount_information = get_mount_info(self.path) - fstype = get_filesystem_type(self.path) # blkid -o value -s TYPE self.path + fstype = get_filesystem_type(self.real_device) # blkid -o value -s TYPE self.path if self.mountpoint != mount_information.get('target', None) and mountpoint: raise DiskError(f"{self} was given a mountpoint but the actual mountpoint differs: {mount_information.get('target', None)}") @@ -175,6 +175,16 @@ class Partition(): else: return f'Partition(path={self.path}, fs={self.filesystem}{mount_repr})' + @property + def real_device(self): + if not self.encrypted: + return self.path + else: + for blockdevice in json.loads(b''.join(sys_command('lsblk -J')).decode('UTF-8'))['blockdevices']: + if (parent := self.find_parent_of(blockdevice, os.path.basename(self.path))): + return f"/dev/{parent}" + raise DiskError(f'Could not find appropriate parent for encrypted partition {self}') + 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) @@ -277,16 +287,6 @@ class Partition(): if (parent := self.find_parent_of(child, name, parent=data['name'])): return parent - @property - def real_device(self): - if not self.encrypted: - return self.path - else: - for blockdevice in json.loads(b''.join(sys_command('lsblk -J')).decode('UTF-8'))['blockdevices']: - if (parent := self.find_parent_of(blockdevice, os.path.basename(self.path))): - return f"/dev/{parent}" - raise DiskError(f'Could not find appropriate parent for encrypted partition {self}') - def mount(self, target, fs=None, options=''): if not self.mountpoint: log(f'Mounting {self} to {target}', level=LOG_LEVELS.Info) |