diff --git a/Dockerfile b/Dockerfile index a6da03c..d8804b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -74,6 +74,8 @@ LABEL org.label-schema.vcs-ref "${VCS_REF}" # Configurable sleep delay ENV POLLING_INTERVAL=5 +# Possibility to skip permission check +ENV SKIP_SET_PERMISSIONS=false # Install init script and dropbox command line wrapper COPY docker-entrypoint.sh / diff --git a/README.md b/README.md index adcd028..02279c5 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ are explained in the sections below. ### Checking Dropbox Version -Dropbox will return incorrect information (`Dropbox daemon version: Not installed`) when you run `dropbox version` in +Dropbox will return incorrect information (`Dropbox daemon version: Not installed`) when you run `dropbox version` in the container. In case you ever need to know which version you have installed, instead run the following: $ docker exec -it dropbox cat /opt/dropbox/bin/VERSION @@ -170,6 +170,11 @@ Needs to be set to a positive integer value. The Dropbox daemon is polled for it which can be configured to reduce load on the system. This is the number in seconds to wait between polling the Dropbox daemon. Defaults to `5`. +- `SKIP_SET_PERMISSIONS` +If this is set to `true`, the container skips setting the permissions on all files in the `/opt/dropbox` folder +in order to prevent long startup times. _Note:_ please make sure to have correct permissions on all files before +you do this! Implemented for [#25](https://github.com/otherguy/docker-dropbox/issues/25). + ### Exposed Volumes - `/opt/dropbox/Dropbox` @@ -186,9 +191,9 @@ every time you restart the container. From [Troubleshoot Dropbox syncing issues](https://help.dropbox.com/installs-integrations/sync-uploads/files-not-syncing): > The Linux version of the Dropbox desktop app is limited from monitoring more than 10,000 folders by default. Anything more than that is not watched and, therefore, ignored when syncing. There's an easy fix for this. Open a terminal and enter the following: -> +> > `echo fs.inotify.max_user_watches=100000 | sudo tee -a /etc/sysctl.conf; sudo sysctl -p` -> +> > This command will tell your system to watch up to 100,000 folders. Once the command is entered and you enter your password, Dropbox will immediately resume syncing. diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 2b71f24..8bad853 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -40,7 +40,12 @@ fi usermod -u ${DROPBOX_UID} -g ${DROPBOX_GID} --non-unique dropbox > /dev/null 2>&1 # Change ownership to dropbox account on all working folders. -chown -R ${DROPBOX_UID}:${DROPBOX_GID} /opt/dropbox +if [[ $(echo "${SKIP_SET_PERMISSIONS:-false}" | tr '[:upper:]' '[:lower:]' | tr -d " ") == "true" ]]; then + echo "Skipping permissions check, ensure the dropbox user owns all files!" + chown ${DROPBOX_UID}:${DROPBOX_GID} /opt/dropbox +else + chown -R ${DROPBOX_UID}:${DROPBOX_GID} /opt/dropbox +fi # Change permissions on Dropbox folder chmod 755 /opt/dropbox/Dropbox