search_dns_context.patch

Valentin Bud, 10/19/2013 12:25 PM

Download (1.47 KB)

View differences:

share/scripts/context-packages/base/etc/one-context.d/01-dns
18 18

  
19 19
export DNS_VARIABLES="DNS $(env | sed 's/=.*$//' | grep -E '^ETH[0-9]+_DNS$' | sort)"
20 20

  
21
export SEARCH_VARIABLES="SEARCH $(env | sed 's/=.*$//' | grep -E '^ETH[0-9]+_SEARCH$' | sort)"
22

  
21 23
nameservers=$(
22 24
    for var in ${DNS_VARIABLES}; do
23 25
        value=$(eval "echo \"\${$var}\"")
......
27 29
    done
28 30
)
29 31

  
32
searchdomains=$(
33
    for var in ${SEARCH_VARIABLES}; do
34
        value=$(eval "echo \"\${$var}\"")
35
        if [ -n "$value" ]; then
36
            echo "$value"
37
        fi
38
    done
39
)
40

  
30 41
[ -z "$nameservers" ] && exit 0
31 42

  
32 43
echo -n '' > /etc/resolv.conf
......
34 45
for nameserver in $nameservers; do
35 46
    echo nameserver $nameserver >> /etc/resolv.conf
36 47
done
48

  
49
[ -z "$searchdomains" ] && exit 0
50

  
51
echo search $searchdomains >> /etc/resolv.conf
37
-