Removed hardcoded partition numbers when acessing partitions. As the order is not fixed and more options to disk layouts have been added.
This commit is contained in:
parent
c97d5f1202
commit
f230140ba9
|
|
@ -354,9 +354,9 @@ class Filesystem():
|
||||||
b''.join(sys_command(f'sync'))
|
b''.join(sys_command(f'sync'))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def find_root_partition(self):
|
def find_partition(self, mountpoint):
|
||||||
for partition in self.blockdevice:
|
for partition in self.blockdevice:
|
||||||
if partition.target_mountpoint == '/' or partition.mountpoint == '/':
|
if partition.target_mountpoint == mountpoint or partition.mountpoint == mountpoint:
|
||||||
return partition
|
return partition
|
||||||
|
|
||||||
def raw_parted(self, string:str):
|
def raw_parted(self, string:str):
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,7 @@ with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT)
|
||||||
encrypt_root_partition=archinstall.arguments.get('!encryption-password', False))
|
encrypt_root_partition=archinstall.arguments.get('!encryption-password', False))
|
||||||
# Otherwise, check if encryption is desired and mark the root partition as encrypted.
|
# Otherwise, check if encryption is desired and mark the root partition as encrypted.
|
||||||
elif archinstall.arguments.get('!encryption-password', None):
|
elif archinstall.arguments.get('!encryption-password', None):
|
||||||
root_partition = fs.find_root_partition()
|
root_partition = fs.find_partition('/')
|
||||||
root_partition.encrypted = True
|
root_partition.encrypted = True
|
||||||
|
|
||||||
# After the disk is ready, iterate the partitions and check
|
# After the disk is ready, iterate the partitions and check
|
||||||
|
|
@ -296,16 +296,16 @@ with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT)
|
||||||
# First encrypt and unlock, then format the desired partition inside the encrypted part.
|
# First encrypt and unlock, then format the desired partition inside the encrypted part.
|
||||||
# archinstall.luks2() encrypts the partition when entering the with context manager, and
|
# archinstall.luks2() encrypts the partition when entering the with context manager, and
|
||||||
# unlocks the drive so that it can be used as a normal block-device within archinstall.
|
# unlocks the drive so that it can be used as a normal block-device within archinstall.
|
||||||
with archinstall.luks2(archinstall.arguments['harddrive'].partition[1], 'luksloop', archinstall.arguments.get('!encryption-password', None)) as unlocked_device:
|
with archinstall.luks2(fs.find_partition('/'), 'luksloop', archinstall.arguments.get('!encryption-password', None)) as unlocked_device:
|
||||||
unlocked_device.format(archinstall.arguments.get('filesystem', 'btrfs'))
|
unlocked_device.format(fs.find_partition('/').filesystem)
|
||||||
|
|
||||||
perform_installation(unlocked_device,
|
perform_installation(device=unlocked_device,
|
||||||
archinstall.arguments['harddrive'].partition[0],
|
boot_partition=fs.find_partition('/boot'),
|
||||||
archinstall.arguments['keyboard-language'],
|
language=archinstall.arguments['keyboard-language'],
|
||||||
archinstall.arguments['mirror-region'])
|
mirrors=archinstall.arguments['mirror-region'])
|
||||||
else:
|
else:
|
||||||
archinstall.arguments['harddrive'].partition[1].format('ext4')
|
archinstall.arguments['harddrive'].partition[1].format('ext4')
|
||||||
perform_installation(archinstall.arguments['harddrive'].partition[1],
|
perform_installation(device=fs.find_partition('/'),
|
||||||
archinstall.arguments['harddrive'].partition[0],
|
boot_partition=fs.find_partition('/boot'),
|
||||||
archinstall.arguments['keyboard-language'],
|
language=archinstall.arguments['keyboard-language'],
|
||||||
archinstall.arguments['mirror-region'])
|
mirrors=archinstall.arguments['mirror-region'])
|
||||||
Loading…
Reference in New Issue