From b9b056ceb2fc8082eab1947c2ad680a02cf60664 Mon Sep 17 00:00:00 2001
From: Robert Martin-Legene <robert@nic.ar>
Date: Thu, 23 May 2019 19:41:43 -0300
Subject: [PATCH] Mas tiempo para contestar, y defaults si nos tenes tty

---
 bin/installbfa.sh         | 30 +++++++++++++++---------------
 network/{prod-env => env} |  0
 2 files changed, 15 insertions(+), 15 deletions(-)
 rename network/{prod-env => env} (100%)

diff --git a/bin/installbfa.sh b/bin/installbfa.sh
index cebc3c7..35fe02c 100755
--- a/bin/installbfa.sh
+++ b/bin/installbfa.sh
@@ -192,7 +192,10 @@ function welcome
 
 function setupquestions
 {
-    read -p "Donde quiere instalar (sera BFAHOME) [$( echo ~bfa/bfa )]? : " -t 60 BFAHOME
+    if [ -t 0 ]
+    then
+        read -p "Donde quiere instalar (sera BFAHOME) [$( echo ~bfa/bfa )]? : " -t 300 BFAHOME
+    fi
     if [ "$BFAHOME" = "" ]
     then
         BFAHOME=$( echo ~bfa/bfa )
@@ -201,27 +204,24 @@ function setupquestions
     if [ ! -e "${BFAHOME}/bin/env" ]
     then
         REPLY=
-        while [ "$REPLY" != "1" -a "$REPLY" != "2" ]
-        do
-            echo "Quiere conectarse a la red BFA de produccion o prueba?"
-            echo "1. Produccion"
-            echo "2. Prueba (test2)"
-            read -p "Red: " -t 60 -n 1
-        done
-        # Default to production
-        if [ "$REPLY" = "" ]
+        if [ -t 0 ]
         then
-            REPLY=1
+            while [ "$REPLY" != "1" -a "$REPLY" != "2" ]
+            do
+                echo "Quiere conectarse a la red BFA de produccion o prueba?"
+                echo "1. Produccion"
+                echo "2. Prueba (test2)"
+                read -p "Red: " -t 60 -n 1
+                echo
+            done
         fi
         case "$REPLY" in
-            1)
-                envfile=network/env
-                ;;
             2)
                 envfile=test2network/env
                 ;;
             *)
-                false
+                # Default to production
+                envfile=network/env
                 ;;
         esac
     fi
diff --git a/network/prod-env b/network/env
similarity index 100%
rename from network/prod-env
rename to network/env
-- 
GitLab