Merge branch 'master' into 5720-ajax-loading-error
[arvados.git] / docker / arvdock
index 788c1b39d955a2d21dfb82b588638a2cf2808346..a41056cd680c534585e5346c15a2264157ef1b55 100755 (executable)
@@ -6,6 +6,8 @@ if [[ "$DOCKER" == "" ]]; then
     DOCKER=`which docker`
 fi
 
+CURL=`which curl`
+
 COMPUTE_COUNTER=0
 
 function usage {
@@ -300,8 +302,7 @@ EOF
         fi
     fi
 
-    `cat /etc/resolv.conf |grep -P "nameserver 172\.17\.42\.1" -q`
-    if [[ "$?" == "1" ]]; then
+    if [ "$(awk '($1 == "nameserver"){print $2; exit}' </etc/resolv.conf)" != "172.17.42.1" ]; then
         echo
         echo "******************************************************************"
         echo "To access Arvados you must add the Arvados nameserver to the top"
@@ -312,7 +313,7 @@ EOF
         echo "******************************************************************"
         echo
     else
-        while ! curl -L -f http://workbench.dev.arvados >/dev/null 2>/dev/null ; do
+        while ! $CURL -L -f http://workbench.dev.arvados >/dev/null 2>/dev/null ; do
             echo "Waiting for Arvados to be ready."
             sleep 1
         done
@@ -464,6 +465,18 @@ function do_reset {
     done
 }
 
+if [ "$DOCKER" == '' ]
+then
+  echo "Docker not found. Please install it first."
+  exit 2
+fi
+
+if [ "$CURL" == '' ]
+then
+  echo "Curl not found. Please install it first."
+  exit 3
+fi
+
 if [ $# -lt 1 ]
 then
   usage