preparation-scripts/data/dnsfix.sh
2024-11-22 18:10:32 +01:00

11 lines
621 B
Bash
Executable file

#!/bin/sh
if command -v pkexec >/dev/null 2>&1; then
pkexec sh -c "echo \"nameserver 192.168.16.1\" | tee /etc/resolv.conf >/dev/null && sudo chattr +i /etc/resolv.conf"
elif command -v sudo >/dev/null 2>&1; then
sudo sh -c "echo \"nameserver 192.168.16.1\" | tee /etc/resolv.conf >/dev/null && sudo chattr +i /etc/resolv.conf"
elif command -v doas >/dev/null 2>&1; then
doas sh -c "echo \"nameserver 192.168.16.1\" | tee /etc/resolv.conf >/dev/null && sudo chattr +i /etc/resolv.conf"
else
su -c "echo \"nameserver 192.168.16.1\" | tee /etc/resolv.conf >/dev/null && sudo chattr +i /etc/resolv.conf"
fi