summaryrefslogtreecommitdiff
path: root/roles/installer/ubuntu/autoinstall/files
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2021-07-01 20:32:35 +0200
committerChristian Pointner <equinox@spreadspace.org>2021-07-01 20:32:35 +0200
commitc2d011a50b37ad3e02e965dbb8c8960835165764 (patch)
treeb27d2691903db5b52ba31adbdcc4f30975c4cb38 /roles/installer/ubuntu/autoinstall/files
parentch-equinox-* install ddrecsue (diff)
parentcosmetic changes (diff)
Merge branch 'topic/new-ubuntu-installer'
Diffstat (limited to 'roles/installer/ubuntu/autoinstall/files')
-rw-r--r--roles/installer/ubuntu/autoinstall/files/early-command.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/roles/installer/ubuntu/autoinstall/files/early-command.py b/roles/installer/ubuntu/autoinstall/files/early-command.py
new file mode 100644
index 00000000..93d72b2d
--- /dev/null
+++ b/roles/installer/ubuntu/autoinstall/files/early-command.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python3
+
+import os
+from shutil import copyfile
+import yaml
+
+os.umask(0o077)
+copyfile('/autoinstall.yaml', '/autoinstall.yaml_before-early-command')
+
+config = {}
+with open('/autoinstall.yaml', 'r') as file:
+ config = yaml.safe_load(file)
+
+try:
+ for c in config['storage']['config']:
+ if 'type' not in c or c['type'] != 'disk' or 'path' not in c:
+ continue
+
+ c['path'] = os.path.realpath(c['path'])
+
+ with open('/autoinstall.yaml', 'w') as file:
+ yaml.dump(config, file, default_flow_style=False)
+
+except KeyError:
+ pass