From 69ed8e952e7bd9c7c9bf3d4eee42e15d012dc315 Mon Sep 17 00:00:00 2001 From: Jason Vas Dias Date: Mon, 23 Aug 2004 18:48:14 +0000 Subject: fix resolv.conf merge if pre-existing resolv.conf nonexistent or empty --- initscripts.spec | 6 +++++- sysconfig/network-scripts/network-functions | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/initscripts.spec b/initscripts.spec index 30379e88..a7f10a52 100644 --- a/initscripts.spec +++ b/initscripts.spec @@ -1,6 +1,6 @@ Summary: The inittab file and the /etc/init.d scripts. Name: initscripts -Version: 7.66 +Version: 7.67 License: GPL Group: System Environment/Base Release: 1 @@ -250,6 +250,10 @@ rm -rf $RPM_BUILD_ROOT %ghost %attr(0664,root,utmp) /var/run/utmp %changelog +* Mon Aug 20 2004 Jason Vas Dias 7.67-1 +- fix change_resolv_conf: if pre-existing /etc/resolv.conf +- non-existent or empty, replace with new file contents. + * Fri Aug 20 2004 Jason Vas Dias 7.66-1 - Allow users to use generic /etc/dhclient.conf if per-device - /etc/dhclient-${DEVICE}.conf is non-existent or empty diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index 8b78b17d..a3dd9670 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -360,7 +360,7 @@ configure_ccwgroup_device () # Invoke this when /etc/resolv.conf has changed: change_resolv_conf () { - s=`/bin/grep '^[\ \ ]*option' /etc/resolv.conf`; + s=`/bin/grep '^[\ \ ]*option' /etc/resolv.conf 2>/dev/null`; if [ "x$s" != "x" ]; then s="$s"$'\n'; fi; @@ -380,7 +380,11 @@ change_resolv_conf () let n_args=n_args-1; done; elif [ $# -eq 1 ]; then - s="$s"`/bin/grep -vF "$s" $1`; + if [ "x$s" != "x" ]; then + s="$s"`/bin/grep -vF "$s" $1`; + else + s=`cat $1`; + fi; fi; (echo "$s" > /etc/resolv.conf;) >/dev/null 2>&1; r=$? -- cgit v1.2.1