aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2004-08-30 19:12:52 +0000
committerBill Nottingham <notting@redhat.com>2004-08-30 19:12:52 +0000
commit2d6c8a3ee15ae8b1c68fbc6e6e36d2d321ee95fe (patch)
treef3e44b3a83f107356ed45206b4d3d93243dbfc6a
parente79afc6a208be15c65e511fb76dd509368f920be (diff)
downloadinitscripts-2d6c8a3ee15ae8b1c68fbc6e6e36d2d321ee95fe.tar
initscripts-2d6c8a3ee15ae8b1c68fbc6e6e36d2d321ee95fe.tar.gz
initscripts-2d6c8a3ee15ae8b1c68fbc6e6e36d2d321ee95fe.tar.bz2
initscripts-2d6c8a3ee15ae8b1c68fbc6e6e36d2d321ee95fe.tar.xz
initscripts-2d6c8a3ee15ae8b1c68fbc6e6e36d2d321ee95fe.zip
move to right branchr7-31-17-EL
-rw-r--r--initscripts.spec6
-rwxr-xr-xsysconfig/network-scripts/ifdown-post2
-rwxr-xr-xsysconfig/network-scripts/ifup-post6
-rw-r--r--sysconfig/network-scripts/network-functions39
4 files changed, 47 insertions, 6 deletions
diff --git a/initscripts.spec b/initscripts.spec
index 657e8a06..283fb578 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.31.16.EL
+Version: 7.31.17.EL
License: GPL
Group: System Environment/Base
Release: 1
@@ -249,6 +249,10 @@ rm -rf $RPM_BUILD_ROOT
%ghost %attr(0664,root,utmp) /var/run/utmp
%changelog
+* Mon Aug 30 2004 Jason Vas Dias <jvdias@redhat.com> 7.31.17.EL-1
+- Add change_resolv_conf function to network_functions ; get
+- ifup-post and ifdown-post to invoke it (#125712).
+
* Fri Jul 23 2004 Bill Nottingham <notting@redhat.com> 7.31.16.EL-1
- fix bonding + no IP (#127285)
diff --git a/sysconfig/network-scripts/ifdown-post b/sysconfig/network-scripts/ifdown-post
index 6c244ca1..b88e5e3b 100755
--- a/sysconfig/network-scripts/ifdown-post
+++ b/sysconfig/network-scripts/ifdown-post
@@ -10,7 +10,7 @@ source_config
if [ "${DEVICETYPE}" = "ppp" -o "${DEVICETYPE}" = "ippp" ]; then
if [ -f /etc/resolv.conf.save ]; then
- cat /etc/resolv.conf.save > /etc/resolv.conf
+ change_resolv_conf /etc/resolv.conf.save
rm -f /etc/resolv.conf.save
fi
if [ -f /etc/ppp/peers/$DEVICE ] ; then
diff --git a/sysconfig/network-scripts/ifup-post b/sysconfig/network-scripts/ifup-post
index 401d1e8c..77b678bc 100755
--- a/sysconfig/network-scripts/ifup-post
+++ b/sysconfig/network-scripts/ifup-post
@@ -19,9 +19,7 @@ if [ "$PEERDNS" != "no" -o -n "$RESOLV_MODS" -a "$RESOLV_MODS" != "no" ]; then
[ -n "$MS_DNS1" ] && DNS1=$MS_DNS1
[ -n "$MS_DNS2" ] && DNS2=$MS_DNS2
if [ -n "$DNS1" ] && ! grep -q "^nameserver $DNS1" /etc/resolv.conf &&
- tr=`mktemp /tmp/resolv.XXXXXX` ; then
- # replace only the first two nameserver lines; cannot count on awk
- # and do not know if sed is capable of this...
+ tr=`mktemp /tmp/XXXXXX` ; then
current_replacement="$DNS1"
next_replacement="$DNS2"
search=
@@ -67,7 +65,7 @@ if [ "$PEERDNS" != "no" -o -n "$RESOLV_MODS" -a "$RESOLV_MODS" != "no" ]; then
# but set umask in case it doesn't exist!
oldumask=`umask`
umask 022
- cat $tr > /etc/resolv.conf
+ change_resolv_conf $tr
rm -f $tr
umask $oldumask
fi
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index 5f1135de..1f68ebc5 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -314,3 +314,42 @@ is_wireless_device ()
LC_ALL=C iwconfig $1 2>&1 | grep -q "no wireless extensions" || return 0
return 1
}
+
+# Invoke this when /etc/resolv.conf has changed:
+change_resolv_conf ()
+{
+ s=`/bin/grep '^[\ \ ]*option' /etc/resolv.conf 2>/dev/null`;
+ 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';
+ fi;
+ let n_args=n_args-1;
+ done;
+ elif [ $# -eq 1 ]; then
+ 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=$?
+ 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; # invalidate cache
+ return $?;
+ fi;
+ return $r;
+}