Skip to content

Commit

Permalink
Implement Docker ENV variable for --cleanup-local-files (#2868)
Browse files Browse the repository at this point in the history
* Implement Docker ENV variable for --cleanup-local-files
  • Loading branch information
abraunegg authored Oct 2, 2024
1 parent 6827af9 commit 3ad139a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions contrib/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ if [ "${ONEDRIVE_DOWNLOADONLY:=0}" == "1" ]; then
ARGS=(--download-only ${ARGS[@]})
fi

# Tell client to clean up local files when in download-only mode based on environment variable
if [ "${ONEDRIVE_CLEANUPLOCAL:=0}" == "1" ]; then
echo "# We are cleaning up local files that are not present online"
echo "# Adding --cleanup-local-files"
ARGS=(--cleanup-local-files ${ARGS[@]})
fi

# Tell client to sync in upload-only mode based on environment variable
if [ "${ONEDRIVE_UPLOADONLY:=0}" == "1" ]; then
echo "# We are synchronizing in upload-only mode"
Expand Down
3 changes: 2 additions & 1 deletion docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ docker volume inspect onedrive_conf

Or you can map your own config folder to the config volume. Make sure to copy all files from the docker volume into your mapped folder first.

The detailed document for the config can be found here: [Configuration](https://github.com/abraunegg/onedrive/blob/master/docs/usage.md#configuration)
The detailed document for the config can be found here: [Application Configuration Options for the OneDrive Client for Linux](https://github.com/abraunegg/onedrive/blob/master/docs/application-config-options.md)

### Syncing multiple accounts
There are many ways to do this, the easiest is probably to do the following:
Expand Down Expand Up @@ -273,6 +273,7 @@ docker run $firstRun --restart unless-stopped --name onedrive -v onedrive_conf:/
| <B>ONEDRIVE_DEBUG_HTTPS</B> | Controls "--debug-https" switch on onedrive sync. Default is 0 | 1 |
| <B>ONEDRIVE_RESYNC</B> | Controls "--resync" switch on onedrive sync. Default is 0 | 1 |
| <B>ONEDRIVE_DOWNLOADONLY</B> | Controls "--download-only" switch on onedrive sync. Default is 0 | 1 |
| <B>ONEDRIVE_CLEANUPLOCAL</B> | Controls "--cleanup-local-files" to cleanup local files and folders if they are removed online. Default is 0 | 1 |
| <B>ONEDRIVE_UPLOADONLY</B> | Controls "--upload-only" switch on onedrive sync. Default is 0 | 1 |
| <B>ONEDRIVE_NOREMOTEDELETE</B> | Controls "--no-remote-delete" switch on onedrive sync. Default is 0 | 1 |
| <B>ONEDRIVE_LOGOUT</B> | Controls "--logout" switch. Default is 0 | 1 |
Expand Down
3 changes: 2 additions & 1 deletion docs/podman.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ podman volume inspect onedrive_conf
```
Or you can map your own config folder to the config volume. Make sure to copy all files from the volume into your mapped folder first.

The detailed document for the config can be found here: [Configuration](https://github.com/abraunegg/onedrive/blob/master/docs/usage.md#configuration)
The detailed document for the config can be found here: [Application Configuration Options for the OneDrive Client for Linux](https://github.com/abraunegg/onedrive/blob/master/docs/application-config-options.md)

### Syncing multiple accounts
There are many ways to do this, the easiest is probably to do the following:
Expand Down Expand Up @@ -290,6 +290,7 @@ podman run -it --name onedrive_work --user "${ONEDRIVE_UID}:${ONEDRIVE_GID}" \
| <B>ONEDRIVE_DEBUG_HTTPS</B> | Controls "--debug-https" switch on onedrive sync. Default is 0 | 1 |
| <B>ONEDRIVE_RESYNC</B> | Controls "--resync" switch on onedrive sync. Default is 0 | 1 |
| <B>ONEDRIVE_DOWNLOADONLY</B> | Controls "--download-only" switch on onedrive sync. Default is 0 | 1 |
| <B>ONEDRIVE_CLEANUPLOCAL</B> | Controls "--cleanup-local-files" to cleanup local files and folders if they are removed online. Default is 0 | 1 |
| <B>ONEDRIVE_UPLOADONLY</B> | Controls "--upload-only" switch on onedrive sync. Default is 0 | 1 |
| <B>ONEDRIVE_NOREMOTEDELETE</B> | Controls "--no-remote-delete" switch on onedrive sync. Default is 0 | 1 |
| <B>ONEDRIVE_LOGOUT</B> | Controls "--logout" switch. Default is 0 | 1 |
Expand Down

0 comments on commit 3ad139a

Please sign in to comment.