Skip to content
Snippets Groups Projects
Commit 254319f6 authored by Florent Thiery's avatar Florent Thiery
Browse files

only remove systemd-resolve resolv.conf is still present

parent 4476a771
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3 #!/usr/bin/env python3
import utils import utils
import os
def setup(interactive=False): def setup(interactive=False):
...@@ -11,8 +12,12 @@ def setup(interactive=False): ...@@ -11,8 +12,12 @@ def setup(interactive=False):
'apt purge --auto-remove -y netplan.io', 'apt purge --auto-remove -y netplan.io',
'mkdir -p /etc/NetworkManager/conf.d', 'mkdir -p /etc/NetworkManager/conf.d',
'touch /etc/NetworkManager/conf.d/10-globally-managed-devices.conf', 'touch /etc/NetworkManager/conf.d/10-globally-managed-devices.conf',
'ls /run/systemd/resolve/resolv.conf && rm /etc/resolv.conf && cp /run/systemd/resolve/resolv.conf /etc/resolv.conf', ]
if os.path.exists('/run/systemd/resolve/resolv.conf'):
cmds.append('rm /etc/resolv.conf && cp /run/systemd/resolve/resolv.conf /etc/resolv.conf')
cmds.extend([
'systemctl disable --now systemd-resolved.service', 'systemctl disable --now systemd-resolved.service',
'printf "[main]\ndns=default" > /etc/NetworkManager/conf.d/disable-systemd-resolved.conf', 'printf "[main]\ndns=default" > /etc/NetworkManager/conf.d/disable-systemd-resolved.conf',
] ])
utils.run_commands(cmds) utils.run_commands(cmds)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment