preparation-scripts/data/dnsfix.sh
2024-11-23 15:16:52 +01:00

14 lines
712 B
Bash
Executable file

#!/bin/sh
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright (c) 2024 Interstellar Development
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