From 2c1fe0782336cc86c67e34c2652f9c58263f4412 Mon Sep 17 00:00:00 2001 From: Jason Vas Dias Date: Fri, 20 Aug 2004 19:07:12 +0000 Subject: Fix for 125712: preserve options in resolv.conf --- sysconfig/network-scripts/network-functions | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'sysconfig/network-scripts') diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index a744d69a..46c0536f 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -360,26 +360,34 @@ configure_ccwgroup_device () # Invoke this when /etc/resolv.conf has changed: change_resolv_conf () { - s=''; + s=`/bin/grep '^[\ \ ]*option' /etc/resolv.conf`; + if [ "x$s" != "x" ]; then + s="$s"$'\n'; + fi; if [ $# -gt 1 ]; then let n_args=$#; while [ $n_args -gt 0 ]; do + if [[ "$s" = *$1* ]]; then + shift; + continue; + fi; s="$s$1"; shift; if [ $# -gt 0 ]; then - s="$s\n"; + s="$s"$'\n'; fi; let n_args=n_args-1; done; elif [ $# -eq 1 ]; then - s=`/bin/cat $1`; + s="$s"`/bin/grep -vF "$s" $1`; fi; - (echo -e "$s" > /etc/resolv.conf;) >/dev/null 2>&1; + (echo "$s" > /etc/resolv.conf;) >/dev/null 2>&1; r=$? if [ $r -eq 0 ]; then /sbin/initlog -f local7 -p notice -n NET -s "$0 : updated /etc/resolv.conf"; - [ -e /var/lock/subsys/nscd ] && /usr/sbin/nscd -i hosts +# /sbin/service nscd condrestart >/dev/null 2>&1; # remove when nscd is fixed! + [ -e /var/lock/subsys/nscd ] && /usr/sbin/nscd -i hosts; # invalidate cache return $?; fi; return $r; -- cgit v1.2.1