aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig
diff options
context:
space:
mode:
authorJason Vas Dias <jvdias@redhat.com>2004-08-20 19:07:12 +0000
committerJason Vas Dias <jvdias@redhat.com>2004-08-20 19:07:12 +0000
commit2c1fe0782336cc86c67e34c2652f9c58263f4412 (patch)
tree37a9cfac0a36479284b4f969e2348d070a67c0ff /sysconfig
parent47ed89e1a82fd600f0f2266bcb3513a12156b4fc (diff)
downloadinitscripts-2c1fe0782336cc86c67e34c2652f9c58263f4412.tar
initscripts-2c1fe0782336cc86c67e34c2652f9c58263f4412.tar.gz
initscripts-2c1fe0782336cc86c67e34c2652f9c58263f4412.tar.bz2
initscripts-2c1fe0782336cc86c67e34c2652f9c58263f4412.tar.xz
initscripts-2c1fe0782336cc86c67e34c2652f9c58263f4412.zip
Fix for 125712: preserve options in resolv.conf
Diffstat (limited to 'sysconfig')
-rw-r--r--sysconfig/network-scripts/network-functions18
1 files changed, 13 insertions, 5 deletions
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;