Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorWerner Llácer <wllacer@gmail.com>2022-02-01 16:44:39 +0100
committerGitHub <noreply@github.com>2022-02-01 16:44:39 +0100
commite3adab13e837cbca619a7914b76c72e4d1e6d4d8 (patch)
tree219fc45610b85d700074b9baf65ff72ee53ca9a5 /archinstall
parent64bde666acae251ee4d8dd3c8166d14029f7f8fa (diff)
Issue923 (#927)
* Correct definition of btrfs standard layout * Solving issue 923. Standarize keyword "wipe" to signal the need of formatting a FS * flake8 complains
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/__init__.py6
-rw-r--r--archinstall/lib/disk/filesystem.py12
-rw-r--r--archinstall/lib/disk/user_guides.py12
-rw-r--r--archinstall/lib/user_interaction.py4
4 files changed, 20 insertions, 14 deletions
diff --git a/archinstall/__init__.py b/archinstall/__init__.py
index c0e9b8bd..f4793555 100644
--- a/archinstall/__init__.py
+++ b/archinstall/__init__.py
@@ -169,6 +169,12 @@ def post_process_arguments(arguments):
if not json_stream_to_structure('--disk_layouts',arguments['disk_layouts'],layout_storage):
exit(1)
else:
+ # backward compatibility. Change partition.format for partition.wipe
+ for disk in layout_storage:
+ for i,partition in enumerate(layout_storage[disk].get('partitions',[])):
+ if 'format' in partition:
+ partition['wipe'] = partition['format']
+ del partition['format']
arguments['disk_layouts'] = layout_storage
diff --git a/archinstall/lib/disk/filesystem.py b/archinstall/lib/disk/filesystem.py
index b5dcdf85..64b8008c 100644
--- a/archinstall/lib/disk/filesystem.py
+++ b/archinstall/lib/disk/filesystem.py
@@ -7,7 +7,7 @@ from typing import Optional, Dict, Any, TYPE_CHECKING
# https://stackoverflow.com/a/39757388/929999
if TYPE_CHECKING:
from .blockdevice import BlockDevice
-
+
from .partition import Partition
from .validators import valid_fs_type
from ..exceptions import DiskError
@@ -76,7 +76,7 @@ class Filesystem:
# We then iterate the partitions in order
for partition in layout.get('partitions', []):
# We don't want to re-add an existing partition (those containing a UUID already)
- if partition.get('format', False) and not partition.get('PARTUUID', None):
+ if partition.get('wipe', False) and not partition.get('PARTUUID', None):
print("Adding partition....")
partition['device_instance'] = self.add_partition(partition.get('type', 'primary'),
start=partition.get('start', '1MiB'), # TODO: Revisit sane block starts (4MB for memorycards for instance)
@@ -113,11 +113,11 @@ class Filesystem:
loopdev = f"{storage.get('ENC_IDENTIFIER', 'ai')}{pathlib.Path(partition['mountpoint']).name}loop"
else:
loopdev = f"{storage.get('ENC_IDENTIFIER', 'ai')}{pathlib.Path(partition['device_instance'].path).name}"
-
+
partition['device_instance'].encrypt(password=partition['!password'])
# Immediately unlock the encrypted device to format the inner volume
with luks2(partition['device_instance'], loopdev, partition['!password'], auto_unmount=True) as unlocked_device:
- if not partition.get('format'):
+ if not partition.get('wipe'):
if storage['arguments'] == 'silent':
raise ValueError(f"Missing fs-type to format on newly created encrypted partition {partition['device_instance']}")
else:
@@ -133,7 +133,7 @@ class Filesystem:
break
unlocked_device.format(partition['filesystem']['format'], options=format_options)
- elif partition.get('format', False):
+ elif partition.get('wipe', False):
if not partition['device_instance']:
raise DiskError(f"Internal error caused us to loose the partition. Please report this issue upstream!")
@@ -150,7 +150,7 @@ class Filesystem:
def partprobe(self) -> bool:
result = SysCommand(f'partprobe {self.blockdevice.device}')
-
+
if result.exit_code != 0:
log(f"Could not execute partprobe: {result!r}", level=logging.ERROR, fg="red")
raise DiskError(f"Could not run partprobe: {result!r}")
diff --git a/archinstall/lib/disk/user_guides.py b/archinstall/lib/disk/user_guides.py
index 4ba22b4f..25db14ea 100644
--- a/archinstall/lib/disk/user_guides.py
+++ b/archinstall/lib/disk/user_guides.py
@@ -46,7 +46,7 @@ def suggest_single_disk_layout(block_device :BlockDevice,
"size" : "203MiB",
"boot" : True,
"encrypted" : False,
- "format" : True,
+ "wipe" : True,
"mountpoint" : "/boot",
"filesystem" : {
"format" : "fat32"
@@ -65,7 +65,7 @@ def suggest_single_disk_layout(block_device :BlockDevice,
"type" : "primary",
"start" : "206MiB",
"encrypted" : False,
- "format" : True,
+ "wipe" : True,
"mountpoint" : "/" if not using_subvolumes else None,
"filesystem" : {
"format" : default_filesystem
@@ -114,7 +114,7 @@ def suggest_single_disk_layout(block_device :BlockDevice,
"start" : f"{min(block_device.size, 20)}GiB",
"size" : "100%",
"encrypted" : False,
- "format" : True,
+ "wipe" : True,
"mountpoint" : "/home",
"filesystem" : {
"format" : default_filesystem
@@ -166,7 +166,7 @@ def suggest_multi_disk_layout(block_devices :List[BlockDevice],
"size" : "203MiB",
"boot" : True,
"encrypted" : False,
- "format" : True,
+ "wipe" : True,
"mountpoint" : "/boot",
"filesystem" : {
"format" : "fat32"
@@ -183,7 +183,7 @@ def suggest_multi_disk_layout(block_devices :List[BlockDevice],
"start" : "206MiB",
"size" : "100%",
"encrypted" : False,
- "format" : True,
+ "wipe" : True,
"mountpoint" : "/",
"filesystem" : {
"format" : default_filesystem
@@ -198,7 +198,7 @@ def suggest_multi_disk_layout(block_devices :List[BlockDevice],
"start" : "1MiB",
"size" : "100%",
"encrypted" : False,
- "format" : True,
+ "wipe" : True,
"mountpoint" : "/home",
"filesystem" : {
"format" : default_filesystem
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py
index 0ce19346..d5cd9257 100644
--- a/archinstall/lib/user_interaction.py
+++ b/archinstall/lib/user_interaction.py
@@ -661,7 +661,7 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> Dict[str, A
block_device_struct["partitions"][partition]['mountpoint'] = mountpoint
if mountpoint == '/boot':
log(f"Marked partition as bootable because mountpoint was set to /boot.", fg="yellow")
- block_device_struct["partitions"][block_device_struct["partitions"].index(partition)]['boot'] = True
+ block_device_struct["partitions"][partition]['boot'] = True
else:
del(block_device_struct["partitions"][partition]['mountpoint'])
@@ -682,7 +682,7 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> Dict[str, A
block_device_struct["partitions"][partition]['filesystem']['format'] = fstype
# Negate the current wipe marking
- block_device_struct["partitions"][partition]['format'] = not block_device_struct["partitions"][partition].get('format', False)
+ block_device_struct["partitions"][partition]['wipe'] = not block_device_struct["partitions"][partition].get('wipe', False)
elif task == "Mark/Unmark a partition as encrypted":
title = f'{current_layout}\n\nSelect which partition to mark as encrypted'