Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-07-03 15:10:23 +0200
committerAnton Hvornum <anton@hvornum.se>2021-07-03 15:10:23 +0200
commit57bad26553166d6c1bfa81576089a29d56c970a7 (patch)
tree141e49917a45a17e6985a9bd14c108ca35c467bd /archinstall
parent51f2eca60e9d77a2675ed8828c2fdadfd065b7a2 (diff)
Added options to mark/unmark partitions for formatting (useful when re-using partitions, and fine tune which data to save and which to wipe). Setting a desired filesystem for a partition (both new ones and the ones being re-used).
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/lib/disk.py2
-rw-r--r--archinstall/lib/user_interaction.py23
2 files changed, 23 insertions, 2 deletions
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py
index e804e0eb..d6f6ebde 100644
--- a/archinstall/lib/disk.py
+++ b/archinstall/lib/disk.py
@@ -788,7 +788,7 @@ class Filesystem:
else:
raise ValueError(f"{self}.load_layout() doesn't know how to continue without a new partition definition or a UUID ({partition.get('PARTUUID')}) on the device ({self.blockdevice.get_partition(uuid=partition_uuid)}).")
- if partition.get('filesystem', {}).get('format', None):
+ if partition.get('filesystem', {}).get('format', False):
if partition.get('encrypted', False):
if not partition.get('password'):
if storage['arguments'] == 'silent':
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py
index 91456626..9f4ddc6d 100644
--- a/archinstall/lib/user_interaction.py
+++ b/archinstall/lib/user_interaction.py
@@ -614,8 +614,10 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict:
"Delete a partition" if len(block_device_struct) else "",
"Clear/Delete all partitions" if len(block_device_struct) else "",
"Assign mount-point for a partition" if len(block_device_struct) else "",
+ "Mark/Unmark a partition to be formatted (wipes data)" if len(block_device_struct) else "",
"Mark/Unmark a partition as encrypted" if len(block_device_struct) else "",
- "Mark/Unmark a partition as bootable (automatic for /boot)" if len(block_device_struct) else ""
+ "Mark/Unmark a partition as bootable (automatic for /boot)" if len(block_device_struct) else "",
+ "Set desired filesystem for a partition" if len(block_device_struct) else "",
]
# Print current partition layout:
@@ -697,6 +699,11 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict:
else:
del(block_device_struct["partitions"][block_device_struct["partitions"].index(partition)]['mountpoint'])
+ elif task == "Mark/Unmark a partition to be formatted (wipes data)":
+ if (partition := generic_select(block_device_struct["partitions"], 'Select which partition to mask for formatting: ', options_output=False)):
+ # Negate the current encryption marking
+ block_device_struct["partitions"][block_device_struct["partitions"].index(partition)]['format'] = not block_device_struct["partitions"][block_device_struct["partitions"].index(partition)].get('format', False)
+
elif task == "Mark/Unmark a partition as encrypted":
if (partition := generic_select(block_device_struct["partitions"], 'Select which partition to mark as encrypted: ', options_output=False)):
# Negate the current encryption marking
@@ -706,6 +713,20 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict:
if (partition := generic_select(block_device_struct["partitions"], 'Select which partition to mark as bootable: ', options_output=False)):
block_device_struct["partitions"][block_device_struct["partitions"].index(partition)]['boot'] = not block_device_struct["partitions"][block_device_struct["partitions"].index(partition)].get('boot', False)
+ elif task == "Set desired filesystem for a partition":
+ if (partition := generic_select(block_device_struct["partitions"], 'Select which partition to set a filesystem on: ', options_output=False)):
+ if not block_device_struct["partitions"][block_device_struct["partitions"].index(partition)].get('filesystem', None):
+ block_device_struct["partitions"][block_device_struct["partitions"].index(partition)]['filesystem'] = {}
+
+ while True:
+ fstype = input("Enter a desired filesystem type for the partition: ").strip()
+ if not valid_fs_type(fstype):
+ log(f"Desired filesystem {fstype} is not a valid filesystem.", level=logging.ERROR, fg="red")
+ continue
+ break
+
+ block_device_struct["partitions"][block_device_struct["partitions"].index(partition)]['filesystem']['format'] = fstype
+
return block_device_struct
def select_individual_blockdevice_usage(block_devices :list):