blob: 5237ca304bf93658585fbeacd5d3a5ca10daeb73 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#!/bin/sh
2#
3# $Id: config-dns.sh, v10.08.05, 2010-08-05 15:00:00
4#
5# usage: config-dns.sh [<dns1>] [<dns2>]
6#
7path_sh=`nv get path_sh`
8. $path_sh/global.sh
9echo "Info: config-dns.sh $1 $2 start" >> $test_log
10fname=$path_conf"/etc/resolv.conf"
11fbak=$path_conf"/etc/resolv_conf.bak"
12
13# in case no previous file
14touch $fname
15
16# backup file without nameserver part
17sed -e '/nameserver/d' $fname > $fbak
18
19# set primary and seconday DNS
20if [ "x$1" != "x" ]; then
21 echo "nameserver $1" > $fname
22else # empty dns
23 rm -f $fname
24fi
25if [ "x$2" != "x" ]; then
26 echo "nameserver $2" >> $fname
27fi
28
29cat $fbak >> $fname
30rm -f $fbak
31