Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib
diff options
context:
space:
mode:
Diffstat (limited to 'archinstall/lib')
-rw-r--r--archinstall/lib/disk.py3
-rw-r--r--archinstall/lib/installer.py9
-rw-r--r--archinstall/lib/luks.py2
3 files changed, 9 insertions, 5 deletions
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py
index 30a7c44e..30dbcdc2 100644
--- a/archinstall/lib/disk.py
+++ b/archinstall/lib/disk.py
@@ -78,13 +78,14 @@ class BlockDevice():
return self.info[key]
class Partition():
- def __init__(self, path, part_id=None, size=-1, filesystem=None, mountpoint=None):
+ def __init__(self, path, part_id=None, size=-1, filesystem=None, mountpoint=None, encrypted=False):
if not part_id: part_id = os.path.basename(path)
self.path = path
self.part_id = part_id
self.mountpoint = mountpoint
self.filesystem = filesystem # TODO: Autodetect if we're reusing a partition
self.size = size # TODO: Refresh?
+ self.encrypted = encrypted
def __repr__(self, *args, **kwargs):
return f'Partition({self.path}, fs={self.filesystem}, mounted={self.mountpoint})'
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index 37deda3e..229481be 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -60,14 +60,17 @@ class Installer():
entry.write('initrd /initramfs-linux.img\n')
## blkid doesn't trigger on loopback devices really well,
## so we'll use the old manual method until we get that sorted out.
- # UUID = simple_command(f"blkid -s PARTUUID -o value /dev/{os.path.basename(args['drive'])}{args['partitions']['2']}").decode('UTF-8').strip()
- # entry.write('options root=PARTUUID={UUID} rw intel_pstate=no_hwp\n'.format(UUID=UUID))
+
+
for root, folders, uids in os.walk('/dev/disk/by-partuuid'):
for uid in uids:
real_path = os.path.realpath(os.path.join(root, uid))
if not os.path.basename(real_path) == os.path.basename(self.partition.path): continue
- entry.write(f'options cryptdevice=UUID={uid}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp\n')
+ if self.partition.encrypted:
+ entry.write(f'options cryptdevice=PARTUUID={uid}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp\n')
+ else:
+ entry.write(f'options root=PARTUUID={uid} rw intel_pstate=no_hwp\n')
return True
break
raise RequirementError(f'Could not identify the UUID of {partition}, there for {self.mountpoint}/boot/loader/entries/arch.conf will be broken until fixed.')
diff --git a/archinstall/lib/luks.py b/archinstall/lib/luks.py
index 71e634e1..e56f3bd2 100644
--- a/archinstall/lib/luks.py
+++ b/archinstall/lib/luks.py
@@ -46,7 +46,7 @@ class luks2():
if '/' in mountpoint: os.path.basename(mountpoint) # TODO: Raise exception instead?
sys_command(f'/usr/bin/cryptsetup open {partition.path} {mountpoint} --key-file {os.path.abspath(key_file)} --type luks2')
if os.path.islink(f'/dev/mapper/{mountpoint}'):
- return Partition(f'/dev/mapper/{mountpoint}')
+ return Partition(f'/dev/mapper/{mountpoint}', encrypted=True)
def close(self, mountpoint):
sys_command(f'cryptsetup close /dev/mapper/{mountpoint}')