| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
# Override resolv.conf file from DIB with a custom one. |
| 4 |
# Having at least one nameserver is now required by dnfpython (>=) |
| 5 |
echo "nameserver 127.0.0.1" > /etc/resolv.conf |
| 6 |
echo "nameserver 127.0.0.1" > /etc/resolv.conf.ORIG |
| 7 |
if [ -d /etc/dhcp/dhclient-enter-hooks.d ] |
| 8 |
then |
| 9 |
# Debian/Ubuntu |
| 10 |
echo "#!/bin/sh |
| 11 |
make_resolv_conf() { : ; }" > /etc/dhcp/dhclient-enter-hooks.d/noresolvconf |
| 12 |
chmod +x /etc/dhcp/dhclient-enter-hooks.d/noresolvconf |
| 13 |
rm -f /etc/dhcp/dhclient-enter-hooks.d/resolvconf |
| 14 |
else |
| 15 |
# RHEL/CentOS/Fedora |
| 16 |
echo "#!/bin/sh |
| 17 |
make_resolv_conf() { : ; }" > /etc/dhcp/dhclient-enter-hooks |
| 18 |
chmod +x /etc/dhcp/dhclient-enter-hooks |
| 19 |
fi |
| 20 |
|
| 21 |
if [ -e /etc/nsswitch.conf ]; then |
| 22 |
sed -i -e "/hosts:/ s/dns//g" /etc/nsswitch.conf |
| 23 |
fi |