From 07d70a0a916b3c7ede34671603c1e964a1c7bf30 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 11 Nov 2020 19:11:22 +0000 Subject: Added a simple INI handler, and a helper function under Installer().configure_nic() to help with nic configuration. Supports a crude DHCP configuration and a minimal static IP handler. --- archinstall/lib/systemd.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 archinstall/lib/systemd.py (limited to 'archinstall/lib/systemd.py') diff --git a/archinstall/lib/systemd.py b/archinstall/lib/systemd.py new file mode 100644 index 00000000..edd75098 --- /dev/null +++ b/archinstall/lib/systemd.py @@ -0,0 +1,40 @@ +class Ini(): + def __init__(self, *args, **kwargs): + """ + Limited INI handler for now. + Supports multiple keywords through dictionary list items. + """ + self.kwargs = kwargs + + def __str__(self): + result = '' + first_row_done = False + for top_level in self.kwargs: + if first_row_done: + result += f"\n[{top_level}]\n" + else: + result += f"[{top_level}]\n" + first_row_done = True + + for key, val in self.kwargs[top_level].items(): + if type(val) == list: + for item in val: + result += f"{key}={item}\n" + else: + result += f"{key}={val}\n" + + return result + +class Systemd(Ini): + def __init__(self, *args, **kwargs): + """ + Placeholder class to do systemd specific setups. + """ + super(Systemd, self).__init__(*args, **kwargs) + +class Networkd(Systemd): + def __init__(self, *args, **kwargs): + """ + Placeholder class to do systemd-network specific setups. + """ + super(Networkd, self).__init__(*args, **kwargs) \ No newline at end of file -- cgit v1.2.3-70-g09d2