aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'sysconfig/network-scripts')
-rwxr-xr-xsysconfig/network-scripts/ifup-post19
1 files changed, 18 insertions, 1 deletions
diff --git a/sysconfig/network-scripts/ifup-post b/sysconfig/network-scripts/ifup-post
index 6bce2aa1..54fc0786 100755
--- a/sysconfig/network-scripts/ifup-post
+++ b/sysconfig/network-scripts/ifup-post
@@ -28,12 +28,16 @@ if [ "$2" = "boot" -a -n "$NEEDHOSTNAME" -a "${DEVICE}" != lo -a "${DEVICETYPE}"
eval `/bin/ipcalc --silent --hostname ${IPADDR}` && set_hostname $HOSTNAME
fi
-if [ "$PEERDNS" != no -a -n "$DNS1" ] && ! grep -q "^nameserver $DNS1" /etc/resolv.conf &&
+if [ "$PEERDNS" !="no" -o "$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...
current_replacement="$DNS1"
next_replacement="$DNS2"
+ search=
(cat /etc/resolv.conf ; echo EOF ; echo EOF) | while read answer ; do
case $answer in
nameserver*|EOF)
@@ -51,14 +55,27 @@ if [ "$PEERDNS" != no -a -n "$DNS1" ] && ! grep -q "^nameserver $DNS1" /etc/reso
fi
fi
;;
+ domain*|search*)
+ if [ -n "$DOMAIN" ]; then
+ echo "$answer" | while read key value ; do
+ search="$search $value"
+ done
+ else
+ echo "$answer" >> $tr
+ fi
*)
echo "$answer" >> $tr
;;
esac
+ if [ -n "$DOMAIN" ]; then
+ echo "search $DOMAIN $search" >> $tr
+ fi
done
+
# maintain permissions
cat $tr > /etc/resolv.conf
rm -f $tr
+ fi
fi
# Notify programs that have requested notification