From 4fe9373d23bf8bb0ceaab100f8447705fe9f1302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20Gr=C3=B6nberg?= Date: Wed, 18 Apr 2018 20:45:25 +0200 Subject: [PATCH] Updated so that volumes can be properly linked and still synced. --- Dockerfile | 2 +- start.sh | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 77bc011..d22fb7e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM debian:wheezy-slim RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8756C4F765C9AC3CB6B85D62379CE192D401AB61 && \ echo deb http://deb.seadrive.org wheezy main | tee /etc/apt/sources.list.d/seafile.list && \ apt-get update -y && \ - apt-get install -y seafile-cli procps curl && \ + apt-get install -y seafile-cli procps curl grep && \ rm -rf /var/lib/apt/lists/* WORKDIR /seafile-client diff --git a/start.sh b/start.sh index be2cba6..d832c75 100644 --- a/start.sh +++ b/start.sh @@ -25,6 +25,7 @@ setup_lib_sync(){ fi TOKEN_JSON=$(curl -d "username=$USERNAME" -d "password=$PASSWORD" ${SERVER_URL}:${SERVER_PORT}/api2/auth-token/ 2> /dev/null) TOKEN=$(get token "$TOKEN_JSON") + LIBS_IN_SYNC=$(su - seafile -c 'seaf-cli list') LIBS=(${LIBRARY_ID//:/ }) for i in "${!LIBS[@]}" do @@ -32,7 +33,10 @@ setup_lib_sync(){ LIB_JSON=$(curl -G -H "Authorization: Token $TOKEN" -H 'Accept: application/json; indent=4' ${SERVER_URL}:${SERVER_PORT}/api2/repos/${LIB}/ 2> /dev/null) LIB_NAME=$(get name "$LIB_JSON") LIB_DIR=${DATA_DIR}/${LIB_NAME} - if [ ! -d $LIB_DIR ]; then + set +e + LIB_IN_SYNC=$(echo "$LIBS_IN_SYNC" | grep "$LIB") + set -e + if [ ${#LIB_IN_SYNC} -eq 0 ]; then echo "Syncing $LIB_NAME" mkdir -p $LIB_DIR chown seafile:seafile -R $LIB_DIR