Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/installer.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-06-13 14:25:07 +0200
committerAnton Hvornum <anton@hvornum.se>2021-06-13 14:25:07 +0200
commitd76760b45fcc085f1d878465e5293de2740a70b4 (patch)
tree85660842f569683c3159fbfcfd19687633d8c6c8 /archinstall/lib/installer.py
parentaf790faf7af3412f13bb77b7c5ea2c85f72a1a47 (diff)
Removed old safety logics for partitions. Partitions will now always be formatted when .format() is called on them. The safety now lay in the code parsing the declerative partition layouts. Also added the encrypt/mount logic for encrypted partitions, which by default will be unencrypted unless a password is specified.
Diffstat (limited to 'archinstall/lib/installer.py')
-rw-r--r--archinstall/lib/installer.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index b1e38dc6..00d3a001 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -126,13 +126,21 @@ class Installer:
return True
def mount_ordered_layout(self, layouts :dict):
+ from .luks import luks2
+
mountpoints = {}
for blockdevice in layouts:
for partition in layouts[blockdevice]['partitions']:
- mountpoints[partition['mountpoint']] = partition['device_instance']
+ mountpoints[partition['mountpoint']] = partition
for mountpoint in sorted(mountpoints.keys()):
- mountpoints[mountpoint].mount(f"{self.target}{mountpoint}")
+ if mountpoints[mountpoint]['encrypted']:
+ loopdev = storage.get('ENC_IDENTIFIER', 'ai')+'loop'
+ password = mountpoints[mountpoint]['password']
+ with luks2(mountpoints[mountpoint]['device_instance'], loopdev, password, auto_unmount=False) as unlocked_device:
+ unlocked_device.mount(f"{self.target}{mountpoint}")
+ else:
+ mountpoints[mountpoint]['device_instance'].mount(f"{self.target}{mountpoint}")
def mount(self, partition, mountpoint, create_mountpoint=True):
if create_mountpoint and not os.path.isdir(f'{self.target}{mountpoint}'):
@@ -437,6 +445,9 @@ class Installer:
elif partition.mountpoint == self.target:
root_partition = partition
+ if boot_partition is None and root_partition is None:
+ raise ValueError(f"Could not detect root (/) or boot (/boot) in {self.target} based on: {self.partitions}")
+
self.log(f'Adding bootloader {bootloader} to {boot_partition if boot_partition else root_partition}', level=logging.INFO)
if bootloader == 'systemd-bootctl':