Updated so that volumes can be properly linked and still synced.

This commit is contained in:
Robin Grönberg 2018-04-18 20:45:25 +02:00
parent 6fe86a5292
commit 4fe9373d23
2 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -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