From a26f40351318566394f14b7d18289ec9af23a62b Mon Sep 17 00:00:00 2001 From: jat Date: Thu, 10 Mar 2016 14:13:35 +0100 Subject: [PATCH] Used 02-dns calls to gather search/dns records add the records only to the first (`eth0`) interface, since it is not possible to have multiple `dns-nameservers` and `dns-search` entries in the `/etc/network/interfaces` file. --- base_deb.one/etc/one-context.d/00-network | 37 ++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/base_deb.one/etc/one-context.d/00-network b/base_deb.one/etc/one-context.d/00-network index f134272..8e288aa 100755 --- a/base_deb.one/etc/one-context.d/00-network +++ b/base_deb.one/etc/one-context.d/00-network @@ -107,6 +107,32 @@ get_iface_var() { echo $var } +export DNS_VARIABLES="DNS $(env | sed 's/=.*$//' | grep -E '^ETH[0-9]+_DNS$' | sort)" + +export SEARCH_VARIABLES="SEARCH_DOMAIN $(env | sed 's/=.*$//' | grep -E '^ETH[0-9]+_SEARCH_DOMAIN$' | sort)" + +nameservers=$( + dns=() + for var in ${DNS_VARIABLES}; do + value=$(eval "echo \"\${$var}\"") + if [ -n "$value" ]; then + dns+=("$value") + fi + done + echo $(printf " %s" "${dns[@]}") +) + +searchdomains=$( + search=() + for var in ${SEARCH_VARIABLES}; do + value=$(eval "echo \"\${$var}\"") + if [ -n "$value" ]; then + search+=("$value") + fi + done + echo $(printf " %s" "${search[@]}") +) + gen_iface_conf() { cat <