Updated so that volumes can be properly linked and still synced.
This commit is contained in:
parent
6fe86a5292
commit
4fe9373d23
@ -3,7 +3,7 @@ FROM debian:wheezy-slim
|
|||||||
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8756C4F765C9AC3CB6B85D62379CE192D401AB61 && \
|
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 && \
|
echo deb http://deb.seadrive.org wheezy main | tee /etc/apt/sources.list.d/seafile.list && \
|
||||||
apt-get update -y && \
|
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/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /seafile-client
|
WORKDIR /seafile-client
|
||||||
|
|||||||
6
start.sh
6
start.sh
@ -25,6 +25,7 @@ setup_lib_sync(){
|
|||||||
fi
|
fi
|
||||||
TOKEN_JSON=$(curl -d "username=$USERNAME" -d "password=$PASSWORD" ${SERVER_URL}:${SERVER_PORT}/api2/auth-token/ 2> /dev/null)
|
TOKEN_JSON=$(curl -d "username=$USERNAME" -d "password=$PASSWORD" ${SERVER_URL}:${SERVER_PORT}/api2/auth-token/ 2> /dev/null)
|
||||||
TOKEN=$(get token "$TOKEN_JSON")
|
TOKEN=$(get token "$TOKEN_JSON")
|
||||||
|
LIBS_IN_SYNC=$(su - seafile -c 'seaf-cli list')
|
||||||
LIBS=(${LIBRARY_ID//:/ })
|
LIBS=(${LIBRARY_ID//:/ })
|
||||||
for i in "${!LIBS[@]}"
|
for i in "${!LIBS[@]}"
|
||||||
do
|
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_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_NAME=$(get name "$LIB_JSON")
|
||||||
LIB_DIR=${DATA_DIR}/${LIB_NAME}
|
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"
|
echo "Syncing $LIB_NAME"
|
||||||
mkdir -p $LIB_DIR
|
mkdir -p $LIB_DIR
|
||||||
chown seafile:seafile -R $LIB_DIR
|
chown seafile:seafile -R $LIB_DIR
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user