Changes in installer to retry mysql access in case of wrong user and password 17/1117/1 v1.1 v1.1.0 v1.1.1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Mon, 13 Feb 2017 18:39:27 +0000 (19:39 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Mon, 13 Feb 2017 18:39:51 +0000 (19:39 +0100)
Change-Id: I5fafce37fede446c549772b85817552b8e09b2ff
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
scripts/install-openmano.sh

index 9e76b0d..76cc459 100755 (executable)
@@ -237,21 +237,19 @@ fi
 fi  #[[ -z "$NO_PACKAGES" ]]
 
 #check and ask for database user password. Must be done after database installation
-if [[ -n $QUIET_MODE ]]
-then 
-    echo -e "\nCheking database connection and ask for credentials"
-    while ! mysqladmin -s -u$DBUSER $DBPASSWD_PARAM status >/dev/null
-    do
-        [ -n "$logintry" ] &&  echo -e "\nInvalid database credentials!!!. Try again (Ctrl+c to abort)"
-        [ -z "$logintry" ] &&  echo -e "\nProvide database credentials"
-        read -e -p "database user? ($DBUSER) " DBUSER_
-        [ -n "$DBUSER_" ] && DBUSER=$DBUSER_
-        read -e -s -p "database password? (Enter for not using password) " DBPASSWD_
-        [ -n "$DBPASSWD_" ] && DBPASSWD="$DBPASSWD_" && DBPASSWD_PARAM="-p$DBPASSWD_"
-        [ -z "$DBPASSWD_" ] && DBPASSWD=""           && DBPASSWD_PARAM=""
-        logintry="yes"
-    done
-fi
+echo -e "\nChecking database connection and ask for credentials"
+while ! mysqladmin -s -u$DBUSER $DBPASSWD_PARAM status >/dev/null
+do
+    [[ -n $QUIET_MODE ]] && echo -e "\nInvalid database credentials!!! Cannot continue in unattended mode" && exit 1
+    [ -n "$logintry" ] &&  echo -e "\nInvalid database credentials!!! Try again (Ctrl+c to abort)"
+    [ -z "$logintry" ] &&  echo -e "\nProvide database credentials"
+    read -e -p "database user? ($DBUSER) " DBUSER_
+    [ -n "$DBUSER_" ] && DBUSER=$DBUSER_
+    read -e -s -p "database password? (Enter for not using password) " DBPASSWD_
+    [ -n "$DBPASSWD_" ] && DBPASSWD="$DBPASSWD_" && DBPASSWD_PARAM="-p$DBPASSWD_"
+    [ -z "$DBPASSWD_" ] && DBPASSWD=""           && DBPASSWD_PARAM=""
+    logintry="yes"
+done
 
 if [[ -z "$NO_PACKAGES" ]]
 then