Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-11-24 21:33:53 +0100
committerAnton Hvornum <anton@hvornum.se>2021-11-24 21:33:53 +0100
commit070d088462aeabdc4e62893829a024b5a36b5e00 (patch)
tree4da3049bfeb69673cd7e414ae762feb1d15eec11 /examples
parent2058e61dc7d0662400a99157671d905e8c7c55f7 (diff)
Added error handling to guided surrounding disk_layouts
Diffstat (limited to 'examples')
-rw-r--r--examples/guided.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/examples/guided.py b/examples/guided.py
index 4e90ec54..bd701bc9 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -209,10 +209,11 @@ def perform_filesystem_operations():
archinstall.log(user_configuration, level=logging.INFO)
with open("/var/log/archinstall/user_configuration.json", "w") as config_file:
config_file.write(user_configuration)
- user_disk_layout = json.dumps(archinstall.storage['disk_layouts'], indent=4, sort_keys=True, cls=archinstall.JSON)
- archinstall.log(user_disk_layout, level=logging.INFO)
- with open("/var/log/archinstall/user_disk_layout.json", "w") as disk_layout_file:
- disk_layout_file.write(user_disk_layout)
+ if archinstall.storage.get('disk_layouts'):
+ user_disk_layout = json.dumps(archinstall.storage['disk_layouts'], indent=4, sort_keys=True, cls=archinstall.JSON)
+ archinstall.log(user_disk_layout, level=logging.INFO)
+ with open("/var/log/archinstall/user_disk_layout.json", "w") as disk_layout_file:
+ disk_layout_file.write(user_disk_layout)
print()
if archinstall.arguments.get('dry-run'):
@@ -238,9 +239,10 @@ def perform_filesystem_operations():
if archinstall.has_uefi() is False:
mode = archinstall.MBR
- for drive in archinstall.arguments['harddrives']:
- with archinstall.Filesystem(drive, mode) as fs:
- fs.load_layout(archinstall.storage['disk_layouts'][drive.path])
+ for drive in archinstall.arguments.get('harddrives', []):
+ if archinstall.storage.get('disk_layouts', {}).get(drive.path):
+ with archinstall.Filesystem(drive, mode) as fs:
+ fs.load_layout(archinstall.storage['disk_layouts'][drive.path])
def perform_installation(mountpoint):
user_credentials = {}
@@ -262,7 +264,8 @@ def perform_installation(mountpoint):
with archinstall.Installer(mountpoint, kernels=archinstall.arguments.get('kernels', 'linux')) as installation:
# Mount all the drives to the desired mountpoint
# This *can* be done outside of the installation, but the installer can deal with it.
- installation.mount_ordered_layout(archinstall.storage['disk_layouts'])
+ if archinstall.storage.get('disk_layouts'):
+ installation.mount_ordered_layout(archinstall.storage['disk_layouts'])
# Placing /boot check during installation because this will catch both re-use and wipe scenarios.
for partition in installation.partitions: