[Ovirt-devel] [PATCH node] RESEND validify ipv4/ipv6 static/dhcp choice else loop
Joey Boggs
jboggs at redhat.com
Mon Nov 9 18:27:08 UTC 2009
Rebased on upstream - and corrected "N" choice behavior
---
scripts/ovirt-config-networking | 112 ++++++++++++++++++++++-----------------
1 files changed, 64 insertions(+), 48 deletions(-)
diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking
index 7d4e363..8e47830 100755
--- a/scripts/ovirt-config-networking
+++ b/scripts/ovirt-config-networking
@@ -160,56 +160,72 @@ function configure_interface
return;;
esac
- read -ep "Enable IPv4 support ([S]tatic IP, [D]HCP, [N]o or [A]bort)? "
- case $REPLY in
- D|d)
- BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO dhcp"
- ;;
- S|s)
- printf "\n"
- read -ep "IP Address: "; IPADDR=$REPLY
- read -ep " Netmask: "; NETMASK=$REPLY
- read -ep " Gateway: "; GATEWAY=$REPLY
-
- BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO none"
- BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPADDR $IPADDR"
- BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/NETMASK $NETMASK"
- if [ -n "${GATEWAY}" ]; then
- BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/GATEWAY $GATEWAY"
- fi
- ;;
- A|a)
- CONFIGURED_NIC=""
- VLAN_ID=""
- return
- ;;
- esac
+ while true; do
+ read -ep "Enable IPv4 support ([S]tatic IP, [D]HCP, [N]o or [A]bort)? "
+ case $REPLY in
+ D|d)
+ BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO dhcp"
+ break
+ ;;
+ S|s)
+ printf "\n"
+ read -ep "IP Address: "; IPADDR=$REPLY
+ read -ep " Netmask: "; NETMASK=$REPLY
+ read -ep " Gateway: "; GATEWAY=$REPLY
+
+ BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO none"
+ BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPADDR $IPADDR"
+ BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/NETMASK $NETMASK"
+ if [ -n "${GATEWAY}" ]; then
+ BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/GATEWAY $GATEWAY"
+ fi
+ break
+ ;;
+ A|a)
+ CONFIGURED_NIC=""
+ VLAN_ID=""
+ return
+ ;;
+ N|n)
+ break
+ ;;
+ esac
+ done
printf "\n"
- read -ep "Enable IPv6 support ([S]tatic, [D]HCPv6, A[u]to, [N]o or [A]bort)? "
- case $REPLY in
- S|s)
- read -ep "IPv6 Address: "; IPADDR=$REPLY
- BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6INIT yes"
- BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IP6ADDR $IPADDR"
- ;;
- D|d)
- BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6INIT yes"
- BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6AUTCONF no"
- BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6FORWARDING no"
- BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/DHCPV6C yes"
- ;;
- U|u)
- BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6INIT yes"
- BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6FORWARDING no"
- BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6AUTOCONF yes"
- ;;
- A|a)
- CONFIGURED_NIC=""
- VLAN_ID=""
- return
- ;;
- esac
+
+ while true; do
+ read -ep "Enable IPv6 support ([S]tatic, [D]HCPv6, A[u]to, [N]o or [A]bort)? "
+ case $REPLY in
+ S|s)
+ read -ep "IPv6 Address: "; IPADDR=$REPLY
+ BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6INIT yes"
+ BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IP6ADDR $IPADDR"
+ break
+ ;;
+ D|d)
+ BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6INIT yes"
+ BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6AUTCONF no"
+ BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6FORWARDING no"
+ BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/DHCPV6C yes"
+ break
+ ;;
+ U|u)
+ BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6INIT yes"
+ BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6FORWARDING no"
+ BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6AUTOCONF yes"
+ break
+ ;;
+ A|a)
+ CONFIGURED_NIC=""
+ VLAN_ID=""
+ return
+ ;;
+ N|n)
+ break
+ ;;
+ esac
+ done
printf "\n"
ask_yes_or_no "Is this correct ([Y]es/[N]o/[A]bort)?" true true
--
1.6.2.5
More information about the ovirt-devel
mailing list