Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archinstall/lib/disk.py6
-rw-r--r--archinstall/lib/storage.py3
-rw-r--r--examples/guided.py6
3 files changed, 13 insertions, 2 deletions
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py
index 1d78d127..aafb07a8 100644
--- a/archinstall/lib/disk.py
+++ b/archinstall/lib/disk.py
@@ -103,6 +103,12 @@ class BlockDevice():
def has_partitions(self):
return len(self.partitions)
+ def has_mount_point(self, mountpoint):
+ for partition in self.partitions:
+ if self.partitions[partition].mountpoint == mountpoint:
+ return True
+ return False
+
class Partition():
def __init__(self, path, part_id=None, size=-1, filesystem=None, mountpoint=None, encrypted=False):
diff --git a/archinstall/lib/storage.py b/archinstall/lib/storage.py
index e881700f..9bda017d 100644
--- a/archinstall/lib/storage.py
+++ b/archinstall/lib/storage.py
@@ -17,5 +17,6 @@ storage = {
'UPSTREAM_URL' : 'https://raw.githubusercontent.com/Torxed/archinstall/master/profiles',
'PROFILE_DB' : None, # Used in cases when listing profiles is desired, not mandatory for direct profile grabing.
'LOG_PATH' : '/var/log/archinstall',
- 'LOG_FILE' : 'install.log'
+ 'LOG_FILE' : 'install.log',
+ 'MOUNT_POINT' : '/mnt'
}
diff --git a/examples/guided.py b/examples/guided.py
index a5298328..b6c6dd45 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -96,7 +96,11 @@ archinstall.storage['_guided']['harddrive'] = harddrive
if harddrive.has_partitions():
archinstall.log(f" ! {harddrive} contains existing partitions", fg='red')
if (option := input('Do you wish to keep existing partition setup or format the entire disk? (k/f): ')).lower() in ('k', 'keep'):
- print("We're keeping it!")
+ # If we want to keep the existing partitioning table
+ # Make sure that it's the selected drive mounted under /mnt
+ # That way, we can rely on genfstab and some manual post-installation steps.
+ if harddrive.has_mount_point(archinstall.storage['MOUNT_POINT']) is False:
+ raise archinstall.DiskException(f"The selected drive {harddrive} is not pre-mounted to {archinstall.storage['MOUNT_POINT']}. This is required when keeping a existing partitioning scheme.")
else:
print('Formatting woop woop!')
exit(1)