aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/network-functions
diff options
context:
space:
mode:
authorJason Vas Dias <jvdias@redhat.com>2004-07-30 21:12:39 +0000
committerJason Vas Dias <jvdias@redhat.com>2004-07-30 21:12:39 +0000
commitb66243e735e324840d728e2d33190809265d5662 (patch)
tree04bae41b1dd717474b37cfd3496d59a497e1ae8c /sysconfig/network-scripts/network-functions
parent48ee88bf3e13f6265d71af22a5542da22aaaa1c5 (diff)
downloadinitscripts-b66243e735e324840d728e2d33190809265d5662.tar
initscripts-b66243e735e324840d728e2d33190809265d5662.tar.gz
initscripts-b66243e735e324840d728e2d33190809265d5662.tar.bz2
initscripts-b66243e735e324840d728e2d33190809265d5662.tar.xz
initscripts-b66243e735e324840d728e2d33190809265d5662.zip
fix for bug 125712: added change_resolv_conf function to network-functions; made ipup-post and ipdown-post invoke it
Diffstat (limited to 'sysconfig/network-scripts/network-functions')
-rw-r--r--sysconfig/network-scripts/network-functions35
1 files changed, 34 insertions, 1 deletions
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index 7c34370c..1e883221 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -219,7 +219,11 @@ set_hostname ()
hostname $1
if ! grep search /etc/resolv.conf >/dev/null 2>&1; then
domain=`echo $1 | sed 's/^[^\.]*\.//'`
- echo "search $domain" >> /etc/resolv.conf
+ rsctmp=`mktemp /tmp/XXXXXX`;
+ /bin/cp -fp /etc/resolv.conf /tmp/$rsctmp
+ echo "search $domain" >> /tmp/$rsctmp
+ change_resolv_conf /tmp/$rsctmp
+ /bin/rm -f /tmp/$rsctmp
fi
}
@@ -352,3 +356,32 @@ configure_ccwgroup_device ()
echo "$PORTNAME" > $SYSDIR/portname
[ -e $SYSDIR/online ] && echo 1 > $SYSDIR/online
}
+
+# Invoke this when /etc/resolv.conf has changed:
+# (see bugzilla #125712)
+change_resolv_conf ()
+{
+ s='';
+ if [ $# -gt 1 ]; then
+ let n_args=$#;
+ while [ $n_args -gt 0 ];
+ do
+ s="$s$1";
+ shift;
+ if [ $# -gt 0 ]; then
+ s="$s\n";
+ fi;
+ let n_args=n_args-1;
+ done;
+ elif [ $# -eq 1 ]; then
+ s=`/bin/cat $1`;
+ fi;
+ (echo -e "$s" > /etc/resolv.conf;) >/dev/null 2>&1;
+ r=$?
+ if [ $r -eq 0 ]; then
+ /usr/bin/logger -p local7.notice -t NET "$0 : updated /etc/resolv.conf";
+ /sbin/service nscd condrestart >/dev/null 2>&1;
+ return $?;
+ fi;
+ return $r;
+}