summaryrefslogtreecommitdiff
path: root/automated/utils/nfs-dns.sh
blob: de8a7da1d04beefa2237258d085e19d27cbaea7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh

set -e

DEVICE=$1

if [ -z "${DEVICE}" ]; then
	echo "Must specify the device which has been configured by the kernel."
	exit 1
fi

if [ -e '/etc/resolv.conf' ]; then
	echo "Not altering an existing /etc/resolv.conf"
	echo "If DNS does not operate for local addresses, see"
	echo "/run/net-*.conf"
	exit 2
fi

if [ ! -e "/run/net-${DEVICE}.conf" ]; then
	echo "/run/net-${DEVICE}.conf is missing - wrong interface specified?"
	exit 3
fi

# shellcheck source=eth0
. /run/net-"${DEVICE}".conf

echo domain "${DNSDOMAIN}" > /etc/resolv.conf
echo nameserver "${IPV4DNS0}" >> /etc/resolv.conf