changeset 111:a3f9cfa2721e

docker (libervia_cont): workaround for copying config when Docker version is below 1.8.0
author Goffi <goffi@goffi.org>
date Mon, 29 Feb 2016 21:54:43 +0100
parents 51dc15fbd813
children a573bddf8039
files docker/libervia_cont.sh
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/docker/libervia_cont.sh	Mon Feb 29 21:54:41 2016 +0100
+++ b/docker/libervia_cont.sh	Mon Feb 29 21:54:43 2016 +0100
@@ -434,11 +434,17 @@
             mkdir -p "$TMP_DIR"
         fi
 
-        docker cp "$VOLUME_ALIAS:$CONT_CONF_FILE" "$TMP_DIR/$HOST_CONF_FILE"
+        docker cp "$VOLUME_ALIAS:$CONT_CONF_FILE" "$TMP_DIR/"
         "$EDITOR" "$TMP_DIR/$HOST_CONF_FILE"
         if [ $? -eq 0 -a -s "$TMP_DIR/$HOST_CONF_FILE" ]; then
             printf "updating configuration\n"
-            docker cp "$TMP_DIR/$HOST_CONF_FILE" "$VOLUME_ALIAS:$CONT_CONF_FILE"
+            check_docker_version 1 8 0
+            if [ $? -eq 0 ]; then
+                docker cp "$TMP_DIR/$HOST_CONF_FILE" "$VOLUME_ALIAS:$CONT_CONF_FILE"
+            else
+                eprintf "Old Docker version detected, using workaround, please update!\n"
+                docker run --rm $DK_VOLUME -v "$TMP_DIR:/tmp_config" debian:jessie /bin/cp -f "/tmp_config/$HOST_CONF_FILE" "$CONT_CONF_FILE"
+            fi
         fi
         rm -rf "$TMP_DIR"
         ;;