From cab2bbfeff13ce10e7040a5c9f19b0b5fa3f4112 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 30 Dec 2011 10:46:56 +0000 Subject: setup-interfaces: add -b to ask for bridges --- setup-interfaces.in | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'setup-interfaces.in') diff --git a/setup-interfaces.in b/setup-interfaces.in index aee2e83..5c91f2d 100755 --- a/setup-interfaces.in +++ b/setup-interfaces.in @@ -45,16 +45,16 @@ config_iface() { local gateway local bridge local conf=$prefix$iface.conf - local answer + local answer= - if is_xen_dom0; then - while [ "$answer" != "yes" ] && [ "$answer" != "no" ] ; do - echon "Do you want to bridge the interface $iface? [no] " - default_read answer no - done - else - answer="no" - fi + while [ -n "$ask_bridge" ]; do + echon "Do you want to bridge the interface $iface? [no] " + default_read answer no + case "$answer" in + yes|y) answer=yes; break;; + no|n) break;; + esac + done if [ "$answer" = "yes" ]; then bridge="br"`echo $iface | sed 's/[^0-9]//g'` @@ -125,11 +125,12 @@ config_iface() { usage() { cat <<__EOF__ -usage: setup-interfaces [-h] [-i read custom /etc/network/interfaces from stdin] +usage: setup-interfaces [-bhi] Setup network interfaces options: + -b Ask for bridging of interfaces -h Show this help -i Read new contents of /etc/network/interfaces from stdin __EOF__ @@ -221,8 +222,12 @@ prompt_for_interfaces() { cp interfaces $ROOT/etc/network/ } -while getopts "hi" opt; do +ask_bridge= +is_xen_dom0 && ask_bridge=1 + +while getopts "bhi" opt; do case $opt in + b) ask_bridge=1;; h) usage;; i) STDINPUT=1;; esac -- cgit v1.2.3