preparation-scripts/data/dnsfix.sh

15 lines
712 B
Bash
Raw Normal View History

2024-11-22 18:09:29 +01:00
#!/bin/sh
2024-11-23 15:16:52 +01:00
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright (c) 2024 Interstellar Development
2024-11-22 18:09:29 +01:00
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