Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/examples/guided.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-03-09 00:12:03 +0100
committerAnton Hvornum <anton@hvornum.se>2021-03-09 00:12:03 +0100
commit7ee48156486101a43e90f834825dfeb0742247bd (patch)
tree3beb97042da4829183f1656216b5d135b1659d16 /examples/guided.py
parentf1cb3209ad9deb609d9fff35c52ec76027ceffb4 (diff)
Adding encryption helpers to the Partition() class, that sets up and utilizes luks2.encrypt() in extension.
Diffstat (limited to 'examples/guided.py')
-rw-r--r--examples/guided.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/examples/guided.py b/examples/guided.py
index 91158f9a..13bf2414 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -272,19 +272,21 @@ signal.signal(signal.SIGINT, original_sigint_handler)
Once that's done, we'll hand over to perform_installation()
"""
with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) as fs:
+ # Wipe the entire drive if the disk flag `keep_partitions`is False.
if archinstall.arguments['harddrive'].keep_partitions is False:
- if archinstall.arguments.get('!encryption-password', None):
- # Set a temporary partition format to indicate that the partitions is encrypted.
- # Later on, we'll mount it and put an actual filesystem inside this encrypted container.
- fs.use_entire_disk('luks2')
- else:
- fs.use_entire_disk(archinstall.arguments.get('filesystem', 'ext4'))
- else:
- for partition in archinstall.arguments['harddrive']:
- if partition.safe_to_format():
- partition.format()
+ fs.use_entire_disk(root_filesystem_type=archinstall.arguments.get('filesystem', 'btrfs'),
+ encrypt_root_partition=archinstall.arguments.get('!encryption-password', False))
+
+ # After the disk is ready, iterate the partitions and check
+ # which ones are safe to format, and format those.
+ for partition in archinstall.arguments['harddrive']:
+ if partition.safe_to_format():
+ if partition.encrypted:
+ partition.encrypt(password=archinstall.arguments.get('!encryption-password', None))
else:
- archinstall.log(f"Did not format {partition} because .safe_to_format() returned False or .allow_formatting was False", level=archinstall.LOG_LEVELS.Debug)
+ partition.format()
+ else:
+ archinstall.log(f"Did not format {partition} because .safe_to_format() returned False or .allow_formatting was False.", level=archinstall.LOG_LEVELS.Debug)
if archinstall.arguments.get('!encryption-password', None):
# First encrypt and unlock, then format the desired partition inside the encrypted part.