Merge branch 'master' into fix-issue-966

This commit is contained in:
abraunegg 2022-06-16 09:45:57 +10:00
commit 47c3dcd849
15 changed files with 150 additions and 85 deletions

View file

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

View file

@ -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@v2.0.3
with:
github-token: ${{ github.token }}
github-token: ${{ secrets.LOCK_THREADS }}
issue-lock-inactive-days: '7'
issue-exclude-created-before: ''
issue-exclude-labels: ''

View file

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

View file

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

18
configure vendored
View file

@ -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 <https://github.com/abraunegg/onedrive>.
#
@ -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\\"

View file

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

View file

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

View file

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

View file

@ -7,10 +7,10 @@ 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' |✔|✔|✔|
| 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 | 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 |✔|✔|✔|
These containers offer a simple monitoring-mode service for the OneDrive Client for Linux.
@ -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 '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 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
@ -203,6 +205,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_UPLOADONLY</B> | Controls "--upload-only" switch on onedrive sync. Default is 0 | 1 |
| <B>ONEDRIVE_LOGOUT</B> | Controls "--logout" switch. Default is 0 | 1 |
| <B>ONEDRIVE_REAUTH</B> | Controls "--reauth" switch. Default is 0 | 1 |
| <B>ONEDRIVE_AUTHFILES</B> | Controls "--auth-files" option. Default is "" | "authUrl:responseUrl" |

View file

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

View file

@ -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
@ -154,7 +153,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 +180,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 +207,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 +234,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,36 +261,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 '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.
### 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 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
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
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
@ -299,4 +276,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

View file

@ -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);
}

View file

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

View file

@ -1516,11 +1516,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
@ -1533,7 +1533,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);
@ -2465,6 +2465,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 {
@ -2478,6 +2479,7 @@ final class SyncEngine
}
}
}
// apply this new item
applyNewItem(item, path);
}
@ -2486,10 +2488,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
@ -3056,12 +3070,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);