diff options
author | Christian Pointner <equinox@spreadspace.org> | 2021-07-01 20:32:35 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2021-07-01 20:32:35 +0200 |
commit | c2d011a50b37ad3e02e965dbb8c8960835165764 (patch) | |
tree | b27d2691903db5b52ba31adbdcc4f30975c4cb38 /roles/installer/ubuntu/autoinstall/files | |
parent | ch-equinox-* install ddrecsue (diff) | |
parent | cosmetic 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.py | 25 |
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 |