From a9aafabb794c42063e11d712899cea7de9b2eb5b Mon Sep 17 00:00:00 2001 From: abraunegg Date: Sat, 4 Jun 2022 07:14:26 +1000 Subject: [PATCH 01/15] Update ubuntu-package-install.md * Remove known issue as this is solved in the OpenSuSE Build Service packages post v2.4.17-1~np3 --- docs/ubuntu-package-install.md | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/docs/ubuntu-package-install.md b/docs/ubuntu-package-install.md index 1bf5ad64..a106201f 100644 --- a/docs/ubuntu-package-install.md +++ b/docs/ubuntu-package-install.md @@ -266,29 +266,7 @@ Read and understand the known issues with these packages below, taking any actio ## Known Issues with Installing from the above packages -### 1. The 'onedrive' client will automatically startup post 'authentication' without any further actions. -The 'onedrive' client will automatically startup post 'authentication' without any further actions. In some circumstances this may be highly undesirable and can also lead to data loss. - -This is because, when the package is installed, the following symbolic link is created: -```text -Created symlink /etc/systemd/user/default.target.wants/onedrive.service → /usr/lib/systemd/user/onedrive.service. -``` - -To resolve this, so that the client is *not* automatically started, without 'enabling' the client yourself, you need to remove this symbolic link: -``` -sudo rm /etc/systemd/user/default.target.wants/onedrive.service -``` - -This issue is being tracked by: [#1274](https://github.com/abraunegg/onedrive/issues/1274) - -**Important:** It is highly advisable that you remove this symbolic link before you configure or authenticate your client. If you do not remove this symbolic link before you configure or authenticate your client this will be a major contributor to why the following error message will be generated: -``` -ERROR: onedrive application is already running - check system process list for active application instances -``` - -**Important:** Do not rely on this symbolic link for your systemd configuration to automatically start your onedrive client - refer to [Running 'onedrive' as a system service](https://github.com/abraunegg/onedrive/blob/master/docs/USAGE.md#running-onedrive-as-a-system-service) on how to configure this correctly. - -### 2. The client will segfault | core-dump when exiting +### 1. The client will segfault | core-dump when exiting When the client is being run in `--monitor` mode manually, or when using the systemd service, the client will segfault on exit. This issue is caused by the way the Ubuntu 'onedrive' packages are built using the Ubuntu LDC package & compiler options which is the root cause for this issue. Refer to: https://bugs.launchpad.net/ubuntu/+source/ldc/+bug/1895969 @@ -299,4 +277,3 @@ This issue is caused by the way the Ubuntu 'onedrive' packages are built using t **Resolution Options:** * Uninstall the package and build client from source - From cdea46495239fc116d0cfec7960f0e71a260f54a Mon Sep 17 00:00:00 2001 From: abraunegg Date: Sat, 4 Jun 2022 07:24:28 +1000 Subject: [PATCH 02/15] Update Docker Builds (#1988) * Update Docker Builds --- .github/workflows/docker.yaml | 4 ++-- docs/Docker.md | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 08f2c5ca..09bc0e81 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -23,7 +23,7 @@ jobs: include: - flavor: fedora dockerfile: ./contrib/docker/Dockerfile - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64,linux/arm/v7 - flavor: debian dockerfile: ./contrib/docker/Dockerfile-debian platforms: linux/amd64,linux/arm64,linux/arm/v7 @@ -49,7 +49,7 @@ jobs: {{version}} {{major}}.{{minor}} flavor: ${{ matrix.flavor }} - main-flavor: ${{ matrix.flavor == 'debian' }} + main-flavor: ${{ matrix.flavor == 'fedora' }} - uses: docker/setup-qemu-action@v2 if: matrix.platforms != 'linux/amd64' diff --git a/docs/Docker.md b/docs/Docker.md index 4b070a09..8058f8cf 100644 --- a/docs/Docker.md +++ b/docs/Docker.md @@ -8,9 +8,9 @@ This client can be run as a Docker container, with 3 available options for you t | Debian | edge-debian | Docker container based on Debian Bullseye using 'master' |✔|✔|✔| | Debian | debian | Docker container based on Debian Bullseye using latest release |✔|✔|✔| | Debian | edge | Docker container based on Debian Bullseye using 'master' |✔|✔|✔| -| Debian | latest | Docker container based on Debian Bullseye using latest release |✔|✔|✔| -| Fedora | edge-fedora | Docker container based on Fedora 36 using 'master' |✔|❌|❌| -| Fedora | fedora | Docker container based on Fedora 36 using latest release |✔|❌|❌| +| Fedora | latest | Docker container based on Debian Bullseye using latest release |✔|✔|✔| +| Fedora | edge-fedora | Docker container based on Fedora 36 using 'master' |✔|✔|✔| +| Fedora | fedora | Docker container based on Fedora 36 using latest release |✔|✔|✔| These containers offer a simple monitoring-mode service for the OneDrive Client for Linux. From 6c2e88131445dc614897a7bae9dde921e04494bf Mon Sep 17 00:00:00 2001 From: abraunegg Date: Sat, 4 Jun 2022 07:27:08 +1000 Subject: [PATCH 03/15] Update Docker.md Update Documentation --- docs/Docker.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Docker.md b/docs/Docker.md index 8058f8cf..d2096602 100644 --- a/docs/Docker.md +++ b/docs/Docker.md @@ -7,8 +7,8 @@ This client can be run as a Docker container, with 3 available options for you t | Alpine Linux | alpine | Docker container based on Apline 3.16 using latest release |✔|❌|✔| | Debian | edge-debian | Docker container based on Debian Bullseye using 'master' |✔|✔|✔| | Debian | debian | Docker container based on Debian Bullseye using latest release |✔|✔|✔| -| Debian | edge | Docker container based on Debian Bullseye using 'master' |✔|✔|✔| -| Fedora | latest | Docker container based on Debian Bullseye using latest release |✔|✔|✔| +| Fedora | edge | Docker container based on Fedora 36 using 'master' |✔|✔|✔| +| Fedora | latest | Docker container based on Fedora 36 using latest release |✔|✔|✔| | Fedora | edge-fedora | Docker container based on Fedora 36 using 'master' |✔|✔|✔| | Fedora | fedora | Docker container based on Fedora 36 using latest release |✔|✔|✔| From 5958c54938e951494032d1991d965628337b85db Mon Sep 17 00:00:00 2001 From: abraunegg Date: Sun, 5 Jun 2022 07:46:00 +1000 Subject: [PATCH 04/15] Update lock.yml * Update lock threads action --- .github/workflows/lock.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index fd5c8625..2856b9e9 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -8,9 +8,10 @@ jobs: lock: runs-on: ubuntu-latest steps: - - uses: dessant/lock-threads@v2.0.3 + - name: Lock Threads + uses: dessant/lock-threads@v3.0.0 with: - github-token: ${{ github.token }} + github-token: ${{ secrets.LOCK_THREADS }} issue-lock-inactive-days: '7' issue-exclude-created-before: '' issue-exclude-labels: '' From 4e1deec9338ae9c14745be0c6f36200df989e230 Mon Sep 17 00:00:00 2001 From: abraunegg Date: Sun, 5 Jun 2022 14:52:24 +1000 Subject: [PATCH 05/15] Update Business Shared Folders to use a /delta query (#1989) * Change Business Shared Folders to use a /delta query now that the OneDrive API appears to support such query --- src/sync.d | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sync.d b/src/sync.d index ee563771..216f050a 100644 --- a/src/sync.d +++ b/src/sync.d @@ -1488,11 +1488,11 @@ final class SyncEngine // National Cloud Deployments (US and DE) do not support /delta as a query // https://docs.microsoft.com/en-us/graph/deployments#supported-features // Are we running against a National Cloud Deployments that does not support /delta - if ((nationalCloudDeployment) || ((driveId!= defaultDriveId) && (syncBusinessFolders))) { + if (nationalCloudDeployment) { // Have to query /children rather than /delta nationalCloudChildrenScan = true; log.vdebug("Using /children call to query drive for items to populate 'changes' and 'changesAvailable'"); - // In OneDrive Business Shared Folder scenario, if ALL items are downgraded, then this leads to local file deletion + // In a OneDrive Business Shared Folder scenario + nationalCloudDeployment, if ALL items are downgraded, then this leads to local file deletion // Downgrade ONLY files associated with this driveId and idToQuery log.vdebug("Downgrading all children for this driveId (" ~ driveId ~ ") and idToQuery (" ~ idToQuery ~ ") to an out-of-sync state"); // Before we get any data, flag any object in the database as out-of-sync for this driveID & ID @@ -1505,7 +1505,7 @@ final class SyncEngine } } - // Build own 'changes' response + // Build own 'changes' response to simulate a /delta response try { // we have to 'build' our own JSON response that looks like /delta changes = generateDeltaResponse(driveId, idToQuery); From 352a02052a4d8883c7113137566fc2f15d64eb1c Mon Sep 17 00:00:00 2001 From: abraunegg Date: Sun, 5 Jun 2022 15:14:31 +1000 Subject: [PATCH 06/15] Update lock.yml * Downgrade lock due to warnings seen, lock not operational --- .github/workflows/lock.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index 2856b9e9..8e703b17 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Lock Threads - uses: dessant/lock-threads@v3.0.0 + uses: dessant/lock-threads@v2.0.3 with: github-token: ${{ secrets.LOCK_THREADS }} issue-lock-inactive-days: '7' From bc2728322a61b7034ef885400ac6f6b7cfdef3dd Mon Sep 17 00:00:00 2001 From: abraunegg Date: Mon, 6 Jun 2022 06:51:19 +1000 Subject: [PATCH 07/15] Update ubuntu-package-install.md (#1990) * Clarify known issues which appears resolved for Ubuntu 22.x --- docs/ubuntu-package-install.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/ubuntu-package-install.md b/docs/ubuntu-package-install.md index a106201f..c8f60b6d 100644 --- a/docs/ubuntu-package-install.md +++ b/docs/ubuntu-package-install.md @@ -154,7 +154,7 @@ Run: `sudo apt-get update` Run: `sudo apt install onedrive` #### Step 5: Read 'Known Issues' with these packages -Read and understand the known issues with these packages below, taking any action that is needed. +Read and understand the [known issues](#known-issues-with-installing-from-the-above-packages) with these packages below, taking any action that is needed. ### Distribution: Ubuntu 20.04 The packages support the following platform architectures: @@ -181,7 +181,7 @@ Run: `sudo apt-get update` Run: `sudo apt install onedrive` #### Step 5: Read 'Known Issues' with these packages -Read and understand the known issues with these packages below, taking any action that is needed. +Read and understand the [known issues](#known-issues-with-installing-from-the-above-packages) with these packages below, taking any action that is needed. ### Distribution: Ubuntu 21.04 The packages support the following platform architectures: @@ -208,7 +208,7 @@ Run: `sudo apt-get update` Run: `sudo apt install onedrive` #### Step 5: Read 'Known Issues' with these packages -Read and understand the known issues with these packages below, taking any action that is needed. +Read and understand the [known issues](#known-issues-with-installing-from-the-above-packages) with these packages below, taking any action that is needed. ### Distribution: Ubuntu 21.10 The packages support the following platform architectures: @@ -235,7 +235,7 @@ Run: `sudo apt-get update` Run: `sudo apt install onedrive` #### Step 5: Read 'Known Issues' with these packages -Read and understand the known issues with these packages below, taking any action that is needed. +Read and understand the [known issues](#known-issues-with-installing-from-the-above-packages) with these packages below, taking any action that is needed. ### Distribution: Ubuntu 22.04 The packages support the following platform architectures: @@ -262,14 +262,14 @@ Run: `sudo apt-get update` Run: `sudo apt install onedrive` #### Step 5: Read 'Known Issues' with these packages -Read and understand the known issues with these packages below, taking any action that is needed. +Read and understand the [known issues](#known-issues-with-installing-from-the-above-packages) with these packages below, taking any action that is needed. ## Known Issues with Installing from the above packages -### 1. The client will segfault | core-dump when exiting -When the client is being run in `--monitor` mode manually, or when using the systemd service, the client will segfault on exit. +### 1. The client mau segfault | core-dump when exiting +When the client is run in `--monitor` mode manually, or when using the systemd service, the client may segfault on exit. -This issue is caused by the way the Ubuntu 'onedrive' packages are built using the Ubuntu LDC package & compiler options which is the root cause for this issue. Refer to: https://bugs.launchpad.net/ubuntu/+source/ldc/+bug/1895969 +This issue is caused by the way the 'onedrive' packages are built using the distribution LDC package & the default distribution compiler options which is the root cause for this issue. Refer to: https://bugs.launchpad.net/ubuntu/+source/ldc/+bug/1895969 **Additional references:** * https://github.com/abraunegg/onedrive/issues/1053 From 7ebe0d7949268fefffd52bc87c382e9778f7b635 Mon Sep 17 00:00:00 2001 From: abraunegg Date: Mon, 6 Jun 2022 07:41:03 +1000 Subject: [PATCH 08/15] Update ubuntu-package-install.md * Fix typo --- docs/ubuntu-package-install.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ubuntu-package-install.md b/docs/ubuntu-package-install.md index c8f60b6d..fbeb741b 100644 --- a/docs/ubuntu-package-install.md +++ b/docs/ubuntu-package-install.md @@ -266,7 +266,7 @@ Read and understand the [known issues](#known-issues-with-installing-from-the-ab ## Known Issues with Installing from the above packages -### 1. The client mau segfault | core-dump when exiting +### 1. The client may segfault | core-dump when exiting When the client is run in `--monitor` mode manually, or when using the systemd service, the client may segfault on exit. This issue is caused by the way the 'onedrive' packages are built using the distribution LDC package & the default distribution compiler options which is the root cause for this issue. Refer to: https://bugs.launchpad.net/ubuntu/+source/ldc/+bug/1895969 From 2cdd7f4c6309fbdfc16b89652a8f5c841635a538 Mon Sep 17 00:00:00 2001 From: abraunegg Date: Tue, 7 Jun 2022 08:57:39 +1000 Subject: [PATCH 09/15] Update src/notifications/README (#1992) Update readme to correct license details --- src/notifications/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notifications/README b/src/notifications/README index 3ee1f10a..7385cb31 100644 --- a/src/notifications/README +++ b/src/notifications/README @@ -7,4 +7,4 @@ dnotify.d notify.d https://github.com/D-Programming-Deimos/libnotify/blob/master/deimos/notify/notify.d - License: GPL 2.1 or upwards, see file + License: GNU Lesser General Public License (LGPL) 2.1 or upwards, see file From bc5ad62fc08709e1cc2adae32c4c8878f357b111 Mon Sep 17 00:00:00 2001 From: abraunegg Date: Wed, 8 Jun 2022 06:16:29 +1000 Subject: [PATCH 10/15] Update README.md * Update badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9fcee3f6..9344a072 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # OneDrive Client for Linux [![Version](https://img.shields.io/github/v/release/abraunegg/onedrive)](https://github.com/abraunegg/onedrive/releases) [![Release Date](https://img.shields.io/github/release-date/abraunegg/onedrive)](https://github.com/abraunegg/onedrive/releases) -[![Docker Build](https://img.shields.io/docker/cloud/automated/driveone/onedrive)](https://hub.docker.com/r/driveone/onedrive) +[![Build Docker Images](https://github.com/abraunegg/onedrive/actions/workflows/docker.yaml/badge.svg)](https://github.com/abraunegg/onedrive/actions/workflows/docker.yaml) [![Docker Pulls](https://img.shields.io/docker/pulls/driveone/onedrive)](https://hub.docker.com/r/driveone/onedrive) A free Microsoft OneDrive Client which supports OneDrive Personal, OneDrive for Business, OneDrive for Office365 and SharePoint. From 39fba9394fe99b142ded667bd36f6afa69ce280e Mon Sep 17 00:00:00 2001 From: abraunegg Date: Wed, 8 Jun 2022 06:20:33 +1000 Subject: [PATCH 11/15] Documentation updates * Documentation updates --- docs/Docker.md | 2 +- docs/ubuntu-package-install.md | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/Docker.md b/docs/Docker.md index d2096602..a0c99cb8 100644 --- a/docs/Docker.md +++ b/docs/Docker.md @@ -18,7 +18,7 @@ The instructions below have been validated on: * Red Hat Enterprise Linux 8.x * Ubuntu Server 22.04 -The instructions below will utilise the 'edge' tag, however this can be substituted for 'edge-alpine', 'edge-debian' or 'edge-fedora' if desired. +The instructions below will utilise the 'latest' tag, however this can be substituted for 'edge-alpine', 'edge-debian' or 'edge-fedora' if desired. ## Basic Setup ### 0. Install docker using your distribution platform's instructions diff --git a/docs/ubuntu-package-install.md b/docs/ubuntu-package-install.md index fbeb741b..3d988bc9 100644 --- a/docs/ubuntu-package-install.md +++ b/docs/ubuntu-package-install.md @@ -98,12 +98,11 @@ Reading state information... Done root@ubuntu-20-LTS:~# ``` -Reboot your system after running this process before continuing with Step 2. +Reboot your system after running this process before continuing with Step 3. ```text reboot ``` - ### Step 3: Determine what your OS is based on Determine what your OS is based on. To do this, run the following command: ```text From 83a79077c68066e7b656e4fe413c84cb05a766b6 Mon Sep 17 00:00:00 2001 From: abraunegg Date: Thu, 9 Jun 2022 07:53:40 +1000 Subject: [PATCH 12/15] Update advanced-usage.md (#1999) * Add details regarding how to configure and run multiple Docker containers --- docs/Docker.md | 4 ++- docs/advanced-usage.md | 57 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 56 insertions(+), 5 deletions(-) diff --git a/docs/Docker.md b/docs/Docker.md index a0c99cb8..51e3688b 100644 --- a/docs/Docker.md +++ b/docs/Docker.md @@ -18,7 +18,9 @@ The instructions below have been validated on: * Red Hat Enterprise Linux 8.x * Ubuntu Server 22.04 -The instructions below will utilise the 'latest' tag, however this can be substituted for 'edge-alpine', 'edge-debian' or 'edge-fedora' if desired. +The instructions below will utilise the 'latest' tag, however this can be substituted for any of the other docker tags from the table above if desired. + +Additionally there are specific version release tags for each release. Refer to https://hub.docker.com/r/driveone/onedrive/tags for any other Docker tags you may be interested in. ## Basic Setup ### 0. Install docker using your distribution platform's instructions diff --git a/docs/advanced-usage.md b/docs/advanced-usage.md index 156b4c43..02712136 100644 --- a/docs/advanced-usage.md +++ b/docs/advanced-usage.md @@ -1,9 +1,10 @@ # Advanced Configuration of the OneDrive Free Client This document covers the following scenarios: -* Configuring the client to use multiple OneDrive accounts / configurations -* Configuring the client for use in dual-boot (Windows / Linux) situations -* Configuring the client for use when 'sync_dir' is a mounted directory -* Upload data from the local ~/OneDrive folder to a specific location on OneDrive +* [Configuring the client to use multiple OneDrive accounts / configurations](#configuring-the-client-to-use-multiple-onedrive-accounts--configurations) +* [Configuring the client to use multiple OneDrive accounts / configurations using Docker](#configuring-the-client-to-use-multiple-onedrive-accounts--configurations-using-docker) +* [Configuring the client for use in dual-boot (Windows / Linux) situations](#configuring-the-client-for-use-in-dual-boot-windows--linux-situations) +* [Configuring the client for use when 'sync_dir' is a mounted directory](#configuring-the-client-for-use-when-sync_dir-is-a-mounted-directory) +* [Upload data from the local ~/OneDrive folder to a specific location on OneDrive](#upload-data-from-the-local-onedrive-folder-to-a-specific-location-on-onedrive) ## Configuring the client to use multiple OneDrive accounts / configurations Essentially, each OneDrive account or SharePoint Shared Library which you require to be synced needs to have its own and unique configuration, local sync directory and service files. To do this, the following steps are needed: @@ -125,6 +126,54 @@ systemctl --user start onedrive-my-new-config@myusername.service Repeat these steps for each OneDrive new account that you wish to use. +## Configuring the client to use multiple OneDrive accounts / configurations using Docker +In some situations it may be desirable to run multiple Docker containers at the same time, each with their own configuration. + +To run the Docker container sucessfully, it needs two unique Docker volumes to operate: +* Your configuration Docker volumes +* Your data Docker volume + +When running multiple Docker containers, this is no different - each Docker container must have it's own configuration and data volume. + +### High level steps: +1. Create the required unique Docker volumes for the configuration volume +2. Create the required unique local path used for the Docker data volume +3. Start the multiple Docker containers with the required configuration for each container + +#### Create the required unique Docker volumes for the configuration volume +Create the required unique Docker volumes for the configuration volume(s): +```text +docker volume create onedrive_conf_sharepoint_site1 +docker volume create onedrive_conf_sharepoint_site2 +docker volume create onedrive_conf_sharepoint_site3 +... +docker volume create onedrive_conf_sharepoint_site50 +``` + +#### Create the required unique local path used for the Docker data volume +Create the required unique local path used for the Docker data volume +```text +mkdir -p /use/full/local/path/no/tilda/SharePointSite1 +mkdir -p /use/full/local/path/no/tilda/SharePointSite2 +mkdir -p /use/full/local/path/no/tilda/SharePointSite3 +... +mkdir -p /use/full/local/path/no/tilda/SharePointSite50 +``` + +#### Start the Docker container with the required configuration (example) +```text +docker run -it --name onedrive -v onedrive_conf_sharepoint_site1:/onedrive/conf -v "/use/full/local/path/no/tilda/SharePointSite1:/onedrive/data" driveone/onedrive:latest +docker run -it --name onedrive -v onedrive_conf_sharepoint_site2:/onedrive/conf -v "/use/full/local/path/no/tilda/SharePointSite2:/onedrive/data" driveone/onedrive:latest +docker run -it --name onedrive -v onedrive_conf_sharepoint_site3:/onedrive/conf -v "/use/full/local/path/no/tilda/SharePointSite3:/onedrive/data" driveone/onedrive:latest +... +docker run -it --name onedrive -v onedrive_conf_sharepoint_site50:/onedrive/conf -v "/use/full/local/path/no/tilda/SharePointSite50:/onedrive/data" driveone/onedrive:latest +``` + +#### TIP +To avoid 're-authenticating' and 'authorising' each individual Docker container, if all the Docker containers are using the 'same' OneDrive credentials, you can re-use the 'refresh_token' from one Docker container to another by copying this file to the configuration Docker volume of each Docker container. + +If the account credentials are different .. you will need to re-authenticate each Docker container individually. + ## Configuring the client for use in dual-boot (Windows / Linux) situations When dual booting Windows and Linux, depending on the Windows OneDrive account configuration, the 'Files On-Demand' option may be enabled when running OneDrive within your Windows environment. From c7eabab27ba5549c2da77678eb59023a411f0f32 Mon Sep 17 00:00:00 2001 From: Pavel Pivovarov <1425787+piv-pav@users.noreply.github.com> Date: Sat, 11 Jun 2022 07:55:08 +1000 Subject: [PATCH 13/15] Added ONEDRIVE_UPLOADONLY flag for Docker (#2002) * Added ONEDRIVE_UPLOADONLY environment variable --- contrib/docker/entrypoint.sh | 7 +++++++ docs/Docker.md | 1 + 2 files changed, 8 insertions(+) diff --git a/contrib/docker/entrypoint.sh b/contrib/docker/entrypoint.sh index 1a8f14d7..42252a6e 100755 --- a/contrib/docker/entrypoint.sh +++ b/contrib/docker/entrypoint.sh @@ -62,6 +62,13 @@ if [ "${ONEDRIVE_DOWNLOADONLY:=0}" == "1" ]; then ARGS=(--download-only ${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" + echo "# Adding --upload-only" + ARGS=(--upload-only ${ARGS[@]}) +fi + # Tell client to logout based on environment variable if [ "${ONEDRIVE_LOGOUT:=0}" == "1" ]; then echo "# We are logging out" diff --git a/docs/Docker.md b/docs/Docker.md index 51e3688b..7307c64e 100644 --- a/docs/Docker.md +++ b/docs/Docker.md @@ -205,6 +205,7 @@ docker run $firstRun --restart unless-stopped --name onedrive -v onedrive_conf:/ | ONEDRIVE_DEBUG_HTTPS | Controls "--debug-https" switch on onedrive sync. Default is 0 | 1 | | ONEDRIVE_RESYNC | Controls "--resync" switch on onedrive sync. Default is 0 | 1 | | ONEDRIVE_DOWNLOADONLY | Controls "--download-only" switch on onedrive sync. Default is 0 | 1 | +| ONEDRIVE_UPLOADONLY | Controls "--upload-only" switch on onedrive sync. Default is 0 | 1 | | ONEDRIVE_LOGOUT | Controls "--logout" switch. Default is 0 | 1 | | ONEDRIVE_REAUTH | Controls "--reauth" switch. Default is 0 | 1 | | ONEDRIVE_AUTHFILES | Controls "--auth-files" option. Default is "" | "authUrl:responseUrl" | From 1935def14044e62b89ed3fef69a7292ec5653eb6 Mon Sep 17 00:00:00 2001 From: abraunegg Date: Wed, 15 Jun 2022 09:16:06 +1000 Subject: [PATCH 14/15] Update when DB is updated by OneDrive API data and update when file hash is required to be generated (#2004) * Only update the database if the item modified time is different, otherwise we are needlessly updating the database with data that is the same * Generating a file hash, during the file integrity check is computationally expensive. Only generate a file hash if the modified time of the file is different, otherwise it is pointless to generate the file hash during each integrity check * Only flush SHM and WAL post integrity check --- src/main.d | 30 +++++++++++++++--------------- src/sync.d | 33 +++++++++++++++++++++++++-------- 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/src/main.d b/src/main.d index cdc6ce01..17a7e08d 100644 --- a/src/main.d +++ b/src/main.d @@ -1485,26 +1485,26 @@ int main(string[] args) log.log("Cannot initialize connection to OneDrive"); } // performSync complete, set lastCheckTime to current time - fullScanRequired = false; - if (syncListConfigured) { - syncListConfiguredFullScanOverride = false; - } lastCheckTime = MonoTime.currTime(); + // Display memory details before cleanup - if (displayMemoryUsage) { - log.displayMemoryUsagePreGC(); - } + if (displayMemoryUsage) log.displayMemoryUsagePreGC(); // Perform Garbage Cleanup GC.collect(); // Display memory details after cleanup - if (displayMemoryUsage) { - log.displayMemoryUsagePostGC(); + if (displayMemoryUsage) log.displayMemoryUsagePostGC(); + + // If we did a full scan, make sure we merge the conents of the WAL and SHM to disk + if (fullScanRequired) { + // Write WAL and SHM data to file for this loop + log.vdebug("Merge contents of WAL and SHM files into main database file"); + itemDb.performVacuum(); } - - // Write WAL and SHM data to file for this loop - log.vdebug("Merge contents of WAL and SHM files into main database file"); - itemDb.performVacuum(); - + + // reset fullScanRequired and syncListConfiguredFullScanOverride + fullScanRequired = false; + if (syncListConfigured) syncListConfiguredFullScanOverride = false; + // monitor loop complete logOutputMessage = "################################################ LOOP COMPLETE ###############################################"; @@ -1838,7 +1838,7 @@ extern(C) nothrow @nogc @system void exitHandler(int value) { // was itemDb initialised? if (itemDb !is null) { // Make sure the .wal file is incorporated into the main db before we exit - log.log("Shutting down db connection"); + log.log("Shutting down db connection and merging temporary data"); itemDb.performVacuum(); destroy(itemDb); } diff --git a/src/sync.d b/src/sync.d index 216f050a..06c78047 100644 --- a/src/sync.d +++ b/src/sync.d @@ -2437,6 +2437,7 @@ final class SyncEngine // update the item if (cached) { + // the item is in the items.sqlite3 database log.vdebug("OneDrive change is an update to an existing local item"); applyChangedItem(oldItem, oldPath, item, path); } else { @@ -2450,6 +2451,7 @@ final class SyncEngine } } } + // apply this new item applyNewItem(item, path); } @@ -2458,10 +2460,22 @@ final class SyncEngine // if the file was detected as malware and NOT downloaded, we dont want to falsify the DB as downloading it as otherwise the next pass will think it was deleted, thus delete the remote item // Likewise if the download failed, we dont want to falsify the DB as downloading it as otherwise the next pass will think it was deleted, thus delete the remote item if (cached) { - log.vdebug("Updating local database with item details"); - itemdb.update(item); + // the item is in the items.sqlite3 database + // Do we need to update the database with the details that were provided by the OneDrive API? + // Is the last modified timestamp in the DB the same as the API data? + SysTime localModifiedTime = oldItem.mtime; + localModifiedTime.fracSecs = Duration.zero; + SysTime remoteModifiedTime = item.mtime; + remoteModifiedTime.fracSecs = Duration.zero; + + if (localModifiedTime != remoteModifiedTime) { + // Database update needed for this item because our record is out-of-date + log.vdebug("Updating local database with item details as timestamps of items are different"); + itemdb.update(item); + } } else { - log.vdebug("Inserting item details to local database"); + // item is not in the items.sqlite3 database + log.vdebug("Inserting new item details to local database"); itemdb.insert(item); } // What was the item that was saved @@ -3028,12 +3042,15 @@ final class SyncEngine return true; } else { log.vlog("The local item has a different modified time ", localModifiedTime, " when compared to ", itemSource, " modified time ", itemModifiedTime); + // The file has been modified ... is the hash the same? + // Test the file hash as the date / time stamp is different + // Generating a hash is computationally expensive - only generate the hash if timestamp was modified + if (testFileHash(path, item)) { + return true; + } else { + log.vlog("The local item has a different hash when compared to ", itemSource, " item hash"); + } } - if (testFileHash(path, item)) { - return true; - } else { - log.vlog("The local item has a different hash when compared to ", itemSource, " item hash"); - } } else { // Unable to read local file log.log("Unable to determine the sync state of this file as it cannot be read (file permissions or file corruption): ", path); From dc8327e4b8d484bf69389daeeda4a7cc77f388f7 Mon Sep 17 00:00:00 2001 From: abraunegg Date: Wed, 15 Jun 2022 12:09:45 +1000 Subject: [PATCH 15/15] Release files for 2.4.19 (#2006) * Release files for 2.4.19 --- CHANGELOG.md | 12 ++++++++++++ configure | 18 +++++++++--------- configure.ac | 2 +- ...ve-2.4.18.ebuild => onedrive-2.4.19.ebuild} | 0 contrib/spec/onedrive.spec.in | 2 +- 5 files changed, 23 insertions(+), 11 deletions(-) rename contrib/gentoo/{onedrive-2.4.18.ebuild => onedrive-2.4.19.ebuild} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce4b85a9..5dc96218 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## 2.4.19 - 2022-06-15 +### Fixed +* Update Business Shared Folders to use a /delta query +* Update when DB is updated by OneDrive API data and update when file hash is required to be generated + +### Added +* Added ONEDRIVE_UPLOADONLY flag for Docker + +### Updated +* Updated GitHub workflows +* Updated documentation (various) + ## 2.4.18 - 2022-06-02 ### Fixed * Fixed various database related access issues steming from running multiple instances of the application at the same time using the same configuration data diff --git a/configure b/configure index f005c080..addc294b 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for onedrive v2.4.19-dev. +# Generated by GNU Autoconf 2.69 for onedrive v2.4.19. # # Report bugs to . # @@ -579,8 +579,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='onedrive' PACKAGE_TARNAME='onedrive' -PACKAGE_VERSION='v2.4.19-dev' -PACKAGE_STRING='onedrive v2.4.19-dev' +PACKAGE_VERSION='v2.4.19' +PACKAGE_STRING='onedrive v2.4.19' PACKAGE_BUGREPORT='https://github.com/abraunegg/onedrive' PACKAGE_URL='' @@ -1219,7 +1219,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures onedrive v2.4.19-dev to adapt to many kinds of systems. +\`configure' configures onedrive v2.4.19 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1280,7 +1280,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of onedrive v2.4.19-dev:";; + short | recursive ) echo "Configuration of onedrive v2.4.19:";; esac cat <<\_ACEOF @@ -1393,7 +1393,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -onedrive configure v2.4.19-dev +onedrive configure v2.4.19 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1410,7 +1410,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by onedrive $as_me v2.4.19-dev, which was +It was created by onedrive $as_me v2.4.19, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3159,7 +3159,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by onedrive $as_me v2.4.19-dev, which was +This file was extended by onedrive $as_me v2.4.19, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -3212,7 +3212,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -onedrive config.status v2.4.19-dev +onedrive config.status v2.4.19 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 97b2cba9..02b8b386 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ dnl - commit the changed files (configure.ac, configure) dnl - tag the release AC_PREREQ([2.69]) -AC_INIT([onedrive],[v2.4.19-dev], [https://github.com/abraunegg/onedrive], [onedrive]) +AC_INIT([onedrive],[v2.4.19], [https://github.com/abraunegg/onedrive], [onedrive]) AC_CONFIG_SRCDIR([src/main.d]) diff --git a/contrib/gentoo/onedrive-2.4.18.ebuild b/contrib/gentoo/onedrive-2.4.19.ebuild similarity index 100% rename from contrib/gentoo/onedrive-2.4.18.ebuild rename to contrib/gentoo/onedrive-2.4.19.ebuild diff --git a/contrib/spec/onedrive.spec.in b/contrib/spec/onedrive.spec.in index 6fb4ae07..320953e0 100644 --- a/contrib/spec/onedrive.spec.in +++ b/contrib/spec/onedrive.spec.in @@ -6,7 +6,7 @@ %endif Name: onedrive -Version: 2.4.18 +Version: 2.4.19 Release: 1%{?dist} Summary: Microsoft OneDrive Client Group: System Environment/Network