diff docker/libervia_cont.sh @ 26:a5e4c6c2a37d

docker: replaces tabs by spaces, download first app containers then data container + minor changes
author Goffi <goffi@goffi.org>
date Mon, 20 Oct 2014 16:50:12 +0200
parents 25b7452c2d5a
children 9ca1e7fe0f87
line wrap: on
line diff
--- a/docker/libervia_cont.sh	Mon Oct 20 16:19:39 2014 +0200
+++ b/docker/libervia_cont.sh	Mon Oct 20 16:50:12 2014 +0200
@@ -51,7 +51,7 @@
 HELP_MUC="sat@chat.jabberfr.org"
 
 get_dyn_var() {
-	# get dynamicly variable based on given name
+    # get dynamicly variable based on given name
 
     name=$1
     var_type=$2
@@ -63,7 +63,7 @@
 }
 
 list_ports() {
-	# list used ports in currently running containers
+    # list used ports in currently running containers
 
     for cont in $CONTAINERS; do
         # we get variable name with uppercase container name
@@ -94,7 +94,7 @@
 }
 
 public_ports_arg() {
-	# create Docker arg to have public ports corresponding to container ports
+    # create Docker arg to have public ports corresponding to container ports
 
     if [ $PUBLIC -ne 1 ]; then
         return
@@ -109,33 +109,33 @@
 }
 
 download_missing() {
-	# download images wich are not present locally
-	for cont in $VOLUME_NAME $CONTAINERS; do
-		image="$ACCOUNT/$cont"
-		docker inspect $image:latest > /dev/null 2>&1
-		if [ $? -ne 0 ]; then
-			printf "$image is not present locally, downloading it\n"
-			docker pull $image:latest
-			if [ $? -eq 0 ]; then
-				printf "\nDownload of latest $image finished\n\n"
-			else
-				printf "\nError while downloading $image, please check your connection and logs\n"
-				return 1
-			fi
-		fi
-	done
+    # download images wich are not present locally
+    for cont in $CONTAINERS $VOLUME_NAME; do
+        image="$ACCOUNT/$cont"
+        docker inspect $image:latest > /dev/null 2>&1
+        if [ $? -ne 0 ]; then
+            printf "$image is not present locally, downloading it\n"
+            docker pull $image:latest
+            if [ $? -eq 0 ]; then
+                printf "\nDownload of latest $image finished\n\n"
+            else
+                printf "\nError while downloading $image, please check your connection and logs\n"
+                return 1
+            fi
+        fi
+    done
 }
 
 check_docker() {
-	which $DOCKER_EXE > /dev/null 2>&1
-	if [ $? -ne 0 ]; then
-		printf "Docker is not installed or not accessible, please install it.\nYou can check http://wiki.goffi.org/wiki/Docker/en for instructions\n"
-		return 1
-	fi
+    which $DOCKER_EXE > /dev/null 2>&1
+    if [ $? -ne 0 ]; then
+        printf "Docker is not installed or not accessible, please install it.\nYou can check http://wiki.goffi.org/wiki/Docker/en for instructions\n"
+        return 1
+    fi
 }
 
 parse_run_args() {
-	# manage arguments for run command
+    # manage arguments for run command
 
     while [ $# -gt 0 ]; do
         case "$1" in
@@ -182,8 +182,8 @@
         update) CMD=UPDATE;;
         backup) CMD=BACKUP;;
         ports) CMD=PORTS;;
-		-v|--version) printf "$VERSION\n"; exit 0;;
-		-h|--help) printf "$USAGE\n\nYou can check $HELP_SITE for instructions, or go to $HELP_MUC XMPP MUC room for help\n"; exit 0;;
+        -v|--version) printf "$VERSION\n"; exit 0;;
+        -h|--help) printf "$USAGE\n\nYou can check $HELP_SITE for instructions, or go to $HELP_MUC XMPP MUC room for help\n"; exit 0;;
         *) echo $USAGE
            exit 1
     esac
@@ -234,9 +234,9 @@
                 exit 1
             fi
         done
-        printf '\nLibervia is launched and should be reachable in a couple of seconds.\nYou can check logs with "docker logs libervia" (or any other container name)\n'
-        printf "An \"admin\" account has been created, you can check its password on $VOLUME_ALIAS container, in file /home/sat/ADMIN_PWD. Config can be tuned on this container\n"
-        printf 'Below are the ports used to connect, you can go with your browser to Libervia HTTP port\n\n'
+        printf '\nLibervia is launched and should be reachable in a couple of seconds.\nYou can check logs with "docker logs libervia" (or any other container name).\n'
+        printf "An \"admin\" account has been created, you can check its password on $VOLUME_ALIAS container, in file /home/sat/ADMIN_PWD. Config can be tuned on this container.\n"
+        printf 'Below are the ports used to connect, you can go with your browser to Libervia HTTP port.\n\n'
         list_ports
         ;;
     STOP)