From 968fad8f948a9f644098f51e8a04fb5ad985c9ec Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 14 Apr 2019 16:06:35 +0200 Subject: Testing application specific configratuin (might auto-trigger in the future --- archinstall.py | 21 +++++++++++++++++++++ deployments/applications/postgresql.json | 5 +++++ 2 files changed, 26 insertions(+) create mode 100644 deployments/applications/postgresql.json diff --git a/archinstall.py b/archinstall.py index 0d909d0f..6b4a5ce5 100644 --- a/archinstall.py +++ b/archinstall.py @@ -312,6 +312,24 @@ def grab_url_data(path): response = urllib.request.urlopen(safe_path, context=ssl_context) return response.read() +def get_application_instructions(target): + instructions = {} + try: + instructions = grab_url_data('{}/applications/{}.json'.format(args['profiles-path'], target)) + except urllib.error.HTTPError: + print('[N] No instructions found for: {}'.format(target)) + return instructions + + print('[N] Found application instructions for: {}'.format(target)) + try: + instructions = json.loads(instructions.decode('UTF-8'), object_pairs_hook=oDict) + except: + print('[E] JSON syntax error in {}'.format('{}/applications/{}.json'.format(args['profiles-path'], target))) + traceback.print_exc() + exit(1) + + return instructions + def get_instructions(target): instructions = {} try: @@ -602,6 +620,9 @@ if __name__ == '__main__': for title in conf: print('[N] Network Deploy: {}'.format(title)) + if type(conf[title]) == str: + print('[N] Loading {} configuration'.format(conf[title])) + conf[title] = get_application_instructions(conf[title]) for command in conf[title]: raw_command = command opts = conf[title][command] if type(conf[title][command]) in (dict, oDict) else {} diff --git a/deployments/applications/postgresql.json b/deployments/applications/postgresql.json new file mode 100644 index 00000000..c420551b --- /dev/null +++ b/deployments/applications/postgresql.json @@ -0,0 +1,5 @@ +{ + "pacman -Syy --noconfirm postgresql" : null, + "systemctl enable postgresql" : null, + "su - postgres -c \"initdb -D /var/lib/postgres/data\"" : null +} \ No newline at end of file -- cgit v1.2.3-70-g09d2