diff options
author | Jason Vas Dias <jvdias@redhat.com> | 2004-07-30 20:21:41 +0000 |
---|---|---|
committer | Jason Vas Dias <jvdias@redhat.com> | 2004-07-30 20:21:41 +0000 |
commit | 9c17ad3d1c05a2b1503493e4fd2ec59b6681911a (patch) | |
tree | 11e7339ca82562634cad361a0c515af7f09a4cea /sysconfig/network-scripts | |
parent | 136df71101699b74b33cb02f42cb26a299a03df1 (diff) | |
download | initscripts-9c17ad3d1c05a2b1503493e4fd2ec59b6681911a.tar initscripts-9c17ad3d1c05a2b1503493e4fd2ec59b6681911a.tar.gz initscripts-9c17ad3d1c05a2b1503493e4fd2ec59b6681911a.tar.bz2 initscripts-9c17ad3d1c05a2b1503493e4fd2ec59b6681911a.tar.xz initscripts-9c17ad3d1c05a2b1503493e4fd2ec59b6681911a.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')
-rwxr-xr-x | sysconfig/network-scripts/ifdown-post | 2 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup-post | 2 | ||||
-rw-r--r-- | sysconfig/network-scripts/network-functions | 36 |
3 files changed, 37 insertions, 3 deletions
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..fc91b55c 100755 --- a/sysconfig/network-scripts/ifup-post +++ b/sysconfig/network-scripts/ifup-post @@ -67,7 +67,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 7c34370c..9b495b9a 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -219,7 +219,10 @@ 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 + /bin/cp -fp /etc/resolv.conf /tmp/set_hostname_resolv.conf + echo "search $domain" >> /tmp/set_hostname_resolv.conf + change_resolv_conf /tmp/set_hostname_resolv.conf + /bin/rm -f /tmp/set_hostname_resolv.conf fi } @@ -352,3 +355,34 @@ 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; + /bin/chmod +w /etc/resolv.conf + (echo -e "$s" > /etc/resolv.conf;) >/dev/null 2>&1; + /bin/chmod a-w /etc/resolv.conf + r=$? + if [ $r -eq 0 ]; then + /usr/bin/logger -p local0.notice -t NET "$0 : updated /etc/resolv.conf"; + /sbin/service nscd condrestart >/dev/null 2>&1; + return $?; + fi; + return $r; +} |