Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds@gmail.com>2021-03-09 10:50:05 +0100
committerAnton Hvornum <anton.feeds@gmail.com>2021-03-09 10:50:05 +0100
commitf230140ba99f7c7ddbe8e0f7a6c7f80572cbf2ce (patch)
tree42f4c99cea628fdabe748b70f4e76db526ab7454
parentc97d5f12021a8ca8b1e90a750a6f4c95229c6509 (diff)
Removed hardcoded partition numbers when acessing partitions. As the order is not fixed and more options to disk layouts have been added.
-rw-r--r--archinstall/lib/disk.py4
-rw-r--r--examples/guided.py22
2 files changed, 13 insertions, 13 deletions
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py
index a8cba53b..73d913d0 100644
--- a/archinstall/lib/disk.py
+++ b/archinstall/lib/disk.py
@@ -354,9 +354,9 @@ class Filesystem():
b''.join(sys_command(f'sync'))
return True
- def find_root_partition(self):
+ def find_partition(self, mountpoint):
for partition in self.blockdevice:
- if partition.target_mountpoint == '/' or partition.mountpoint == '/':
+ if partition.target_mountpoint == mountpoint or partition.mountpoint == mountpoint:
return partition
def raw_parted(self, string:str):
diff --git a/examples/guided.py b/examples/guided.py
index ebdd3678..722e1e36 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -278,7 +278,7 @@ with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT)
encrypt_root_partition=archinstall.arguments.get('!encryption-password', False))
# Otherwise, check if encryption is desired and mark the root partition as encrypted.
elif archinstall.arguments.get('!encryption-password', None):
- root_partition = fs.find_root_partition()
+ root_partition = fs.find_partition('/')
root_partition.encrypted = True
# 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.
# 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.
- with archinstall.luks2(archinstall.arguments['harddrive'].partition[1], 'luksloop', archinstall.arguments.get('!encryption-password', None)) as unlocked_device:
- unlocked_device.format(archinstall.arguments.get('filesystem', 'btrfs'))
+ with archinstall.luks2(fs.find_partition('/'), 'luksloop', archinstall.arguments.get('!encryption-password', None)) as unlocked_device:
+ unlocked_device.format(fs.find_partition('/').filesystem)
- perform_installation(unlocked_device,
- archinstall.arguments['harddrive'].partition[0],
- archinstall.arguments['keyboard-language'],
- archinstall.arguments['mirror-region'])
+ perform_installation(device=unlocked_device,
+ boot_partition=fs.find_partition('/boot'),
+ language=archinstall.arguments['keyboard-language'],
+ mirrors=archinstall.arguments['mirror-region'])
else:
archinstall.arguments['harddrive'].partition[1].format('ext4')
- perform_installation(archinstall.arguments['harddrive'].partition[1],
- archinstall.arguments['harddrive'].partition[0],
- archinstall.arguments['keyboard-language'],
- archinstall.arguments['mirror-region']) \ No newline at end of file
+ perform_installation(device=fs.find_partition('/'),
+ boot_partition=fs.find_partition('/boot'),
+ language=archinstall.arguments['keyboard-language'],
+ mirrors=archinstall.arguments['mirror-region']) \ No newline at end of file