[Ovirt-devel] [PATCH node] Change DNS setup to match NTP. rhbz#508677

Darryl L. Pierce dpierce at redhat.com
Mon Jun 29 14:40:35 UTC 2009


Rather than expecting the DNS entries to be on one line, they are now
entered as two separate entries.

Also fixes a bug that caused the first DNS entry to be lost when a
second entry was provided.

Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
 scripts/ovirt-config-networking |   31 +++++++++++--------------------
 1 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking
index d29bd12..901e48d 100755
--- a/scripts/ovirt-config-networking
+++ b/scripts/ovirt-config-networking
@@ -206,26 +206,18 @@ function configure_dns
     local IF_CONFIG=
 
     if [ -z "$AUTO" ]; then
-        while true; do
+        for dns in first second; do
             printf "\n"
-            echo "Enter up to two DNS servers separated by commas:"
-            if [ -n "$OVIRT_DNS" ]; then
-                echo "Press Enter for defaults: ($OVIRT_DNS)"
+            read -ep "Please enter the ${dns} DNS server: "
+            if [[ -z "${DNS}" ]] && [[ -z "${REPLY}" ]]; then
+                printf "\nAborted...\n"
+                return
             fi
-            read -ep ": "
-            DNS=$REPLY
-
-            if [ -z "$DNS" ]; then
-                DNS=$OVIRT_DNS
+            if [[ -z "${DNS}" ]]; then
+                DNS="${REPLY}"
+            elif [[ -n "${REPLY}" ]]; then
+                DNS="${DNS}, ${REPLY}"
             fi
-
-            printf "\n"
-            read -ep "Is this correct (Y/N/A)? "
-            case $REPLY in
-                Y|y) break ;;
-                N|n) ;;
-                A|a) return ;;
-            esac
         done
     fi
 
@@ -233,9 +225,8 @@ function configure_dns
         DNS1=$(echo "$DNS" | awk -F, '{print $1}')
         DNS2=$(echo "$DNS" | awk -F, '{print $2}')
 
-        test -n "$DNS1" && IF_CONFIG="set $IF_ROOT/DNS1 $DNS1"
-        test -n "$DNS2" && IF_CONFIG="set $IF_ROOT/DNS2 $DNS2"
-        printf "$IF_CONFIG\n" >> $IF_FILENAME
+        test -n "$DNS1" && printf "set $IF_ROOT/DNS1 $DNS1\n" >> $IF_FILENAME
+        test -n "$DNS2" && printf "set $IF_ROOT/DNS2 $DNS2\n" >> $IF_FILENAME
     fi
 }
 
-- 
1.6.0.6




More information about the ovirt-devel mailing list