lib/network: adds symlink to configure systemd-resovled properly (#4052)

* lib/network: adds symlink to configure systemd-resovled properly

* lib/network: adds overwrite mechanism to enforce resolved symlink

---------

Co-authored-by: Vincent Dahmen <wahrwolf@wolfpit.net>
This commit is contained in:
Vincent Dahmen 2025-12-30 06:01:01 +01:00 committed by GitHub
parent 2954e4397b
commit 9f4f29bd29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 0 deletions

View File

@ -755,6 +755,13 @@ class Installer:
for psk in psk_files:
shutil.copy2(psk, f'{self.target}/var/lib/iwd/{os.path.basename(psk)}')
# Enable systemd-resolved by (forcefully) setting a symlink
# For further details see https://wiki.archlinux.org/title/Systemd-resolved#DNS
resolv_config_path = Path(f'{self.target}/etc/resolv.conf')
if resolv_config_path.exists():
os.unlink(resolv_config_path)
os.symlink('/run/systemd/resolve/stub-resolv.conf', resolv_config_path)
# Copy (if any) systemd-networkd config files
if netconfigurations := glob.glob('/etc/systemd/network/*'):
if not os.path.isdir(f'{self.target}/etc/systemd/network/'):