aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/network-functions
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 /sysconfig/network-scripts/network-functions
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
Diffstat (limited to 'sysconfig/network-scripts/network-functions')
-rw-r--r--sysconfig/network-scripts/network-functions39
1 files changed, 39 insertions, 0 deletions
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;
+}