Fix codacy issues (#332)

* Fix codacy issues
This commit is contained in:
abraunegg 2019-01-07 03:02:58 +11:00 committed by GitHub
parent b75163245f
commit a31fdc6a6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 119 additions and 122 deletions

View file

@ -10,36 +10,36 @@ about: Create a report to help us improve
A clear and concise description of what the bug is. A clear and concise description of what the bug is.
**Application and Operating System Details:** **Application and Operating System Details:**
- OS: Output of `uname -a` & provide your OS & version (CentOS 6.x, Ubuntu 18.x etc) * OS: Output of `uname -a` & provide your OS & version (CentOS 6.x, Ubuntu 18.x etc)
- Are you using a headless system (no gui) or with a gui installed? * Are you using a headless system (no gui) or with a gui installed?
- OneDrive Account Type * OneDrive Account Type
- DMD or LDC compiler version `dmd --version` or `ldmd2 --version` * DMD or LDC compiler version `dmd --version` or `ldmd2 --version`
- Application configuration: Output of `onedrive --display-config` * Application configuration: Output of `onedrive --display-config`
- Curl Version: Output of `curl --version` * Curl Version: Output of `curl --version`
**Note:** If curl version is >= 7.62.0 please generate a full debug log as per https://github.com/abraunegg/onedrive/wiki/Generate-debug-log-for-support and email to support@mynas.com.au **Note:** If curl version is >= 7.62.0 please generate a full debug log as per [https://github.com/abraunegg/onedrive/wiki/Generate-debug-log-for-support](https://github.com/abraunegg/onedrive/wiki/Generate-debug-log-for-support) and email to support@mynas.com.au
Once the full degug log has been generated & emailed, please retry your sync by adding `--force-http-1.1`. If this is successful, please advise in issue ticket that `--force-http-1.1` was sucessful in resolving your issue. Once the full degug log has been generated & emailed, please retry your sync by adding `--force-http-1.1`. If this is successful, please advise in issue ticket that `--force-http-1.1` was sucessful in resolving your issue.
**To Reproduce** **To Reproduce**
Steps to reproduce the behavior if not causing an application crash: Steps to reproduce the behavior if not causing an application crash:
1. Go to '...' 1. Go to '...'
2. Click on '....' 2. Click on '....'
3. Scroll down to '....' 3. Scroll down to '....'
4. See error 4. See error
If issue is replicated by a specific 'file' or 'path' please archive the file and path tree & email to support@mynas.com.au If issue is replicated by a specific 'file' or 'path' please archive the file and path tree & email to support@mynas.com.au
**Complete Verbose Log Output** **Complete Verbose Log Output**
A clear and full log of the problem when running the application in the following manner (ie, not in monitor mode): A clear and full log of the problem when running the application in the following manner (ie, not in monitor mode):
``` ```bash
onedrive --synchronize --verbose <any of your other needed options> onedrive --synchronize --verbose <any of your other needed options>
``` ```
Run the application in a separate terminal window or SSH session and provide the entire application output including the error & crash. When posing the logs, Please format log output to make it easier to read. See https://guides.github.com/features/mastering-markdown/ for more details. Run the application in a separate terminal window or SSH session and provide the entire application output including the error & crash. When posing the logs, Please format log output to make it easier to read. See [https://guides.github.com/features/mastering-markdown/](https://guides.github.com/features/mastering-markdown/) for more details.
Application Log Output: Application Log Output:
``` ```bash
Verbose console log output goes here Verbose console log output goes here
``` ```
@ -50,6 +50,6 @@ If applicable, add screenshots to help explain your problem.
Add any other context about the problem here. Add any other context about the problem here.
### Bug Report Checklist ### ### Bug Report Checklist ###
- [ ] Detailed description * [] Detailed description
- [ ] Reproduction steps (if applicable) * [] Reproduction steps (if applicable)
- [ ] Verbose Log Output * [] Verbose Log Output

View file

@ -5,7 +5,7 @@ about: Suggest an idea for this project
--- ---
**Is your feature request related to a problem? Please describe.** **Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] A clear and concise description of what the problem is. Ex. I'm always frustrated when ...
**Describe the solution you'd like** **Describe the solution you'd like**
A clear and concise description of what you want to happen. A clear and concise description of what you want to happen.

View file

@ -113,8 +113,8 @@ function configure_chroot {
function build_onedrive { function build_onedrive {
# Depending on architecture, build onedrive using applicable tool # Depending on architecture, build onedrive using applicable tool
echo `uname -a` echo "$(uname -a)"
HOMEDIR=`pwd` HOMEDIR=$(pwd)
if [ "${ARCH}" = "x64" ]; then if [ "${ARCH}" = "x64" ]; then
# Build on x86_64 as normal # Build on x86_64 as normal
make clean; make; make clean; make;

189
README.md
View file

@ -1,47 +1,47 @@
# OneDrive Free Client # OneDrive Free Client
###### A complete tool to interact with OneDrive on Linux. Built following the UNIX philosophy. A complete tool to interact with OneDrive on Linux. Built following the UNIX philosophy
### Features: ## Features
* State caching * State caching
* Real-Time file monitoring with Inotify * Real-Time file monitoring with Inotify
* Resumable uploads * Resumable uploads
* Support OneDrive for Business (part of Office 365) * Support OneDrive for Business (part of Office 365)
* Shared folders (OneDrive Personal) * Shared folders (OneDrive Personal)
* SharePoint / Office 365 Shared Libraries (refer to README.Office365.md to configure) * SharePoint / Office 365 Shared Libraries (refer to README.Office365.md to configure)
* Notifications * Notifications
### What's missing: ## What's missing
* While local changes are uploaded right away, remote changes are delayed * While local changes are uploaded right away, remote changes are delayed
* No GUI * No GUI
## Build Requirements ## Build Requirements
* Build environment must have at least 1GB of memory & 1GB swap space * Build environment must have at least 1GB of memory & 1GB swap space
* [libcurl](http://curl.haxx.se/libcurl/) * [libcurl](http://curl.haxx.se/libcurl/)
* [SQLite 3](https://www.sqlite.org/) * [SQLite 3](https://www.sqlite.org/)
* [Digital Mars D Compiler (DMD)](http://dlang.org/download.html) * [Digital Mars D Compiler (DMD)](http://dlang.org/download.html)
### Dependencies: Ubuntu/Debian - x86_64 ### Dependencies: Ubuntu/Debian - x86_64
``` ```text
sudo apt install build-essential sudo apt install build-essential
sudo apt install libcurl4-openssl-dev sudo apt install libcurl4-openssl-dev
sudo apt install libsqlite3-dev sudo apt install libsqlite3-dev
curl -fsS https://dlang.org/install.sh | bash -s dmd curl -fsS https://dlang.org/install.sh | bash -s dmd
``` ```
For notifications the following is necessary: For notifications the following is necessary:
``` ```text
sudo apt install libnotify-dev sudo apt install libnotify-dev
``` ```
### Dependencies: Ubuntu - i386 / i686 ### Dependencies: Ubuntu - i386 / i686
**Note:** Validated with `Linux ubuntu-i386-vm 4.13.0-36-generic #40~16.04.1-Ubuntu SMP Fri Feb 16 23:26:51 UTC 2018 i686 i686 i686 GNU/Linux` and DMD 2.081.1 **Note:** Validated with `Linux ubuntu-i386-vm 4.13.0-36-generic #40~16.04.1-Ubuntu SMP Fri Feb 16 23:26:51 UTC 2018 i686 i686 i686 GNU/Linux` and DMD 2.081.1
``` ```text
sudo apt install build-essential sudo apt install build-essential
sudo apt install libcurl4-openssl-dev sudo apt install libcurl4-openssl-dev
sudo apt install libsqlite3-dev sudo apt install libsqlite3-dev
curl -fsS https://dlang.org/install.sh | bash -s dmd curl -fsS https://dlang.org/install.sh | bash -s dmd
``` ```
For notifications the following is necessary: For notifications the following is necessary:
``` ```text
sudo apt install libnotify-dev sudo apt install libnotify-dev
``` ```
@ -49,14 +49,14 @@ sudo apt install libnotify-dev
**Note:** Validated with `Linux debian-i386 4.9.0-7-686-pae #1 SMP Debian 4.9.110-1 (2018-07-05) i686 GNU/Linux` and LDC - the LLVM D compiler (1.8.0). **Note:** Validated with `Linux debian-i386 4.9.0-7-686-pae #1 SMP Debian 4.9.110-1 (2018-07-05) i686 GNU/Linux` and LDC - the LLVM D compiler (1.8.0).
First install development dependencies as per below: First install development dependencies as per below:
``` ```text
sudo apt install build-essential sudo apt install build-essential
sudo apt install libcurl4-openssl-dev sudo apt install libcurl4-openssl-dev
sudo apt install libsqlite3-dev sudo apt install libsqlite3-dev
sudo apt install git sudo apt install git
``` ```
Second, install the LDC compiler as per below: Second, install the LDC compiler as per below:
``` ```text
mkdir ldc && cd ldc mkdir ldc && cd ldc
wget http://ftp.us.debian.org/debian/pool/main/l/ldc/ldc_1.8.0-3_i386.deb wget http://ftp.us.debian.org/debian/pool/main/l/ldc/ldc_1.8.0-3_i386.deb
wget http://ftp.us.debian.org/debian/pool/main/l/ldc/libphobos2-ldc-shared-dev_1.8.0-3_i386.deb wget http://ftp.us.debian.org/debian/pool/main/l/ldc/libphobos2-ldc-shared-dev_1.8.0-3_i386.deb
@ -66,93 +66,93 @@ wget http://ftp.us.debian.org/debian/pool/main/n/ncurses/libtinfo6_6.1+20180714-
sudo dpkg -i ./*.deb sudo dpkg -i ./*.deb
``` ```
For notifications the following is necessary: For notifications the following is necessary:
``` ```text
sudo apt install libnotify-dev sudo apt install libnotify-dev
``` ```
### Dependencies: Fedora < Version 18 / CentOS / RHEL ### Dependencies: Fedora < Version 18 / CentOS / RHEL
``` ```text
sudo yum groupinstall 'Development Tools' sudo yum groupinstall 'Development Tools'
sudo yum install libcurl-devel sudo yum install libcurl-devel
sudo yum install sqlite-devel sudo yum install sqlite-devel
curl -fsS https://dlang.org/install.sh | bash -s dmd curl -fsS https://dlang.org/install.sh | bash -s dmd
``` ```
For notifications the following is necessary: For notifications the following is necessary:
``` ```text
sudo yum install libnotify-devel sudo yum install libnotify-devel
``` ```
### Dependencies: Fedora > Version 18 ### Dependencies: Fedora > Version 18
``` ```text
sudo dnf groupinstall 'Development Tools' sudo dnf groupinstall 'Development Tools'
sudo dnf install libcurl-devel sudo dnf install libcurl-devel
sudo dnf install sqlite-devel sudo dnf install sqlite-devel
curl -fsS https://dlang.org/install.sh | bash -s dmd curl -fsS https://dlang.org/install.sh | bash -s dmd
``` ```
For notifications the following is necessary: For notifications the following is necessary:
``` ```text
sudo yum install libnotify-devel sudo yum install libnotify-devel
``` ```
### Dependencies: Arch Linux ### Dependencies: Arch Linux
``` ```text
sudo pacman -S curl sqlite dmd sudo pacman -S curl sqlite dmd
``` ```
For notifications the following is necessary: For notifications the following is necessary:
``` ```text
sudo pacman -S libnotify sudo pacman -S libnotify
``` ```
### Dependencies: Raspbian (ARMHF) ### Dependencies: Raspbian (ARMHF)
``` ```text
sudo apt-get install libcurl4-openssl-dev sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libsqlite3-dev sudo apt-get install libsqlite3-dev
wget https://github.com/ldc-developers/ldc/releases/download/v1.11.0/ldc2-1.11.0-linux-armhf.tar.xz wget https://github.com/ldc-developers/ldc/releases/download/v1.11.0/ldc2-1.11.0-linux-armhf.tar.xz
tar -xvf ldc2-1.11.0-linux-armhf.tar.xz tar -xvf ldc2-1.11.0-linux-armhf.tar.xz
``` ```
For notifications the following is necessary: For notifications the following is necessary:
``` ```text
sudo apt install libnotify-dev sudo apt install libnotify-dev
``` ```
### Dependencies: Debian (ARM64) ### Dependencies: Debian (ARM64)
``` ```text
sudo apt-get install libcurl4-openssl-dev sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libsqlite3-dev sudo apt-get install libsqlite3-dev
wget https://github.com/ldc-developers/ldc/releases/download/v1.11.0/ldc2-1.11.0-linux-aarch64.tar.xz wget https://github.com/ldc-developers/ldc/releases/download/v1.11.0/ldc2-1.11.0-linux-aarch64.tar.xz
tar -xvf ldc2-1.11.0-linux-aarch64.tar.xz tar -xvf ldc2-1.11.0-linux-aarch64.tar.xz
``` ```
For notifications the following is necessary: For notifications the following is necessary:
``` ```text
sudo apt install libnotify-dev sudo apt install libnotify-dev
``` ```
### Dependencies: Gentoo ### Dependencies: Gentoo
``` ```text
sudo emerge app-portage/layman sudo emerge app-portage/layman
sudo layman -a dlang sudo layman -a dlang
``` ```
Add ebuild from contrib/gentoo to a local overlay to use. Add ebuild from contrib/gentoo to a local overlay to use.
For notifications the following is necessary: For notifications the following is necessary:
``` ```text
sudo emerge x11-libs/libnotify sudo emerge x11-libs/libnotify
``` ```
### Dependencies: OpenSuSE Leap 15.0 ### Dependencies: OpenSuSE Leap 15.0
``` ```text
sudo zypper addrepo --check --refresh --name "D" http://download.opensuse.org/repositories/devel:/languages:/D/openSUSE_Leap_15.0/devel:languages:D.repo sudo zypper addrepo --check --refresh --name "D" http://download.opensuse.org/repositories/devel:/languages:/D/openSUSE_Leap_15.0/devel:languages:D.repo
sudo zypper install git libcurl-devel sqlite3-devel D:dmd D:libphobos2-0_81 D:phobos-devel D:phobos-devel-static sudo zypper install git libcurl-devel sqlite3-devel D:dmd D:libphobos2-0_81 D:phobos-devel D:phobos-devel-static
``` ```
For notifications the following is necessary: For notifications the following is necessary:
``` ```text
sudo zypper install libnotify-devel sudo zypper install libnotify-devel
``` ```
## Compilation & Installation ## Compilation & Installation
### Building using DMD Reference Compiler: ### Building using DMD Reference Compiler
Before cloning and compiling, if you have installed DMD via curl for your OS, you will need to activate DMD as per example below: Before cloning and compiling, if you have installed DMD via curl for your OS, you will need to activate DMD as per example below:
``` ```text
Run `source ~/dlang/dmd-2.081.1/activate` in your shell to use dmd-2.081.1. Run `source ~/dlang/dmd-2.081.1/activate` in your shell to use dmd-2.081.1.
This will setup PATH, LIBRARY_PATH, LD_LIBRARY_PATH, DMD, DC, and PS1. This will setup PATH, LIBRARY_PATH, LD_LIBRARY_PATH, DMD, DC, and PS1.
Run `deactivate` later on to restore your environment. Run `deactivate` later on to restore your environment.
@ -161,23 +161,23 @@ Without performing this step, the compilation process will fail.
**Note:** Depending on your DMD version, substitute `2.081.1` above with your DMD version that is installed. **Note:** Depending on your DMD version, substitute `2.081.1` above with your DMD version that is installed.
``` ```text
git clone https://github.com/abraunegg/onedrive.git git clone https://github.com/abraunegg/onedrive.git
cd onedrive cd onedrive
make make
sudo make install sudo make install
``` ```
### Build options ### ### Build options
By passing `NOTIFICATIONS=1` to the `make` call, notifications via By passing `NOTIFICATIONS=1` to the `make` call, notifications via
libnotify are enabled. Necessary libraries are libnotify are enabled. Necessary libraries are
`gmodule-2.0`, `glib-2.0`, and `notify`. If these libraries are `gmodule-2.0`, `glib-2.0`, and `notify`. If these libraries are
named differently on the build system, the make variable named differently on the build system, the make variable
`DFLAGSNOTIFICATIONS` can be adjusted. `DFLAGSNOTIFICATIONS` can be adjusted.
### Building using a different compiler (for example [LDC](https://wiki.dlang.org/LDC)): ### Building using a different compiler (for example [LDC](https://wiki.dlang.org/LDC))
#### Debian - i386 / i686 #### Debian - i386 / i686
``` ```text
git clone https://github.com/abraunegg/onedrive.git git clone https://github.com/abraunegg/onedrive.git
cd onedrive cd onedrive
make DC=/usr/bin/ldmd2 make DC=/usr/bin/ldmd2
@ -185,7 +185,7 @@ sudo make install
``` ```
#### ARMHF Architecture #### ARMHF Architecture
``` ```text
git clone https://github.com/abraunegg/onedrive.git git clone https://github.com/abraunegg/onedrive.git
cd onedrive cd onedrive
make DC=~/ldc2-1.11.0-linux-armhf/bin/ldmd2 make DC=~/ldc2-1.11.0-linux-armhf/bin/ldmd2
@ -193,7 +193,7 @@ sudo make install
``` ```
#### ARM64 Architecture #### ARM64 Architecture
``` ```text
git clone https://github.com/abraunegg/onedrive.git git clone https://github.com/abraunegg/onedrive.git
cd onedrive cd onedrive
make DC=~/ldc2-1.11.0-linux-aarch64/bin/ldmd2 make DC=~/ldc2-1.11.0-linux-aarch64/bin/ldmd2
@ -201,7 +201,7 @@ sudo make install
``` ```
#### Docker onedrive monitor #### Docker onedrive monitor
``` ```text
# Update onedriveDir with correct existing OneDrive directory path # Update onedriveDir with correct existing OneDrive directory path
onedriveDir="${HOME}/OneDrive" onedriveDir="${HOME}/OneDrive"
@ -226,11 +226,11 @@ You will be asked to open a specific link using your web browser where you will
### Show your configuration ### Show your configuration
To validate your configuration the application will use, utilise the following: To validate your configuration the application will use, utilise the following:
``` ```text
onedrive --display-config onedrive --display-config
``` ```
This will display all the pertinent runtime interpretation of the options and configuration you are using. This is helpful to validate the client will perform the operations your asking without performing a sync. Example output is as follows: This will display all the pertinent runtime interpretation of the options and configuration you are using. This is helpful to validate the client will perform the operations your asking without performing a sync. Example output is as follows:
``` ```text
Config path = /home/alex/.config/onedrive Config path = /home/alex/.config/onedrive
Config file found in config path = false Config file found in config path = false
Config option 'sync_dir' = /home/alex/OneDrive Config option 'sync_dir' = /home/alex/OneDrive
@ -243,19 +243,19 @@ Selective sync configured = false
### Performing a sync ### Performing a sync
By default all files are downloaded in `~/OneDrive`. After authorizing the application, a sync of your data can be performed by running: By default all files are downloaded in `~/OneDrive`. After authorizing the application, a sync of your data can be performed by running:
``` ```text
onedrive --synchronize onedrive --synchronize
``` ```
This will synchronize files from your OneDrive account to your `~/OneDrive` local directory. This will synchronize files from your OneDrive account to your `~/OneDrive` local directory.
If you prefer to use your local files as stored in `~/OneDrive` as the 'source of truth' use the following sync command: If you prefer to use your local files as stored in `~/OneDrive` as the 'source of truth' use the following sync command:
``` ```text
onedrive --synchronize --local-first onedrive --synchronize --local-first
``` ```
### Performing a selective directory sync ### Performing a selective directory sync
In some cases it may be desirable to sync a single directory under ~/OneDrive without having to change your client configuration. To do this use the following command: In some cases it may be desirable to sync a single directory under ~/OneDrive without having to change your client configuration. To do this use the following command:
``` ```text
onedrive --synchronize --single-directory '<dir_name>' onedrive --synchronize --single-directory '<dir_name>'
``` ```
@ -263,19 +263,19 @@ Example: If the full path is `~/OneDrive/mydir`, the command would be `onedrive
### Performing a 'one-way' download sync ### Performing a 'one-way' download sync
In some cases it may be desirable to 'download only' from OneDrive. To do this use the following command: In some cases it may be desirable to 'download only' from OneDrive. To do this use the following command:
``` ```text
onedrive --synchronize --download-only onedrive --synchronize --download-only
``` ```
### Performing a 'one-way' upload sync ### Performing a 'one-way' upload sync
In some cases it may be desirable to 'upload only' to OneDrive. To do this use the following command: In some cases it may be desirable to 'upload only' to OneDrive. To do this use the following command:
``` ```text
onedrive --synchronize --upload-only onedrive --synchronize --upload-only
``` ```
### Increasing logging level ### Increasing logging level
When running a sync it may be desirable to see additional information as to the progress and operation of the client. To do this, use the following command: When running a sync it may be desirable to see additional information as to the progress and operation of the client. To do this, use the following command:
``` ```text
onedrive --synchronize --verbose onedrive --synchronize --verbose
``` ```
@ -283,7 +283,7 @@ onedrive --synchronize --verbose
When running onedrive all actions can be logged to a separate log file. This can be enabled by using the `--enable-logging` flag. By default, log files will be written to `/var/log/onedrive/` When running onedrive all actions can be logged to a separate log file. This can be enabled by using the `--enable-logging` flag. By default, log files will be written to `/var/log/onedrive/`
**Note:** You will need to ensure your user has the applicable permissions to write to this directory or the following warning will be printed: **Note:** You will need to ensure your user has the applicable permissions to write to this directory or the following warning will be printed:
``` ```text
Unable to access /var/log/onedrive/ Unable to access /var/log/onedrive/
Please manually create '/var/log/onedrive/' and set appropriate permissions to allow write access Please manually create '/var/log/onedrive/' and set appropriate permissions to allow write access
The requested client activity log will instead be located in the users home directory The requested client activity log will instead be located in the users home directory
@ -293,13 +293,13 @@ All logfiles will be in the format of `%username%.onedrive.log`, where `%usernam
**Note:** **Note:**
To use a different log directory rather than the default above, add the following as a configuration option to `~/.config/onedrive/config`: To use a different log directory rather than the default above, add the following as a configuration option to `~/.config/onedrive/config`:
``` ```text
log_dir = "/path/to/location/" log_dir = "/path/to/location/"
``` ```
Trailing slash required Trailing slash required
An example of the log file is below: An example of the log file is below:
``` ```text
2018-Apr-07 17:09:32.1162837 Loading config ... 2018-Apr-07 17:09:32.1162837 Loading config ...
2018-Apr-07 17:09:32.1167908 No config file found, using defaults 2018-Apr-07 17:09:32.1167908 No config file found, using defaults
2018-Apr-07 17:09:32.1170626 Initializing the OneDrive API ... 2018-Apr-07 17:09:32.1170626 Initializing the OneDrive API ...
@ -331,7 +331,7 @@ An example of the log file is below:
``` ```
### Uninstall ### Uninstall
``` ```text
sudo make uninstall sudo make uninstall
# delete the application state # delete the application state
rm -rf ~/.config/onedrive rm -rf ~/.config/onedrive
@ -339,14 +339,14 @@ rm -rf ~/.config/onedrive
If you are using the `--confdir option`, substitute `~/.config/onedrive` above for that directory. If you are using the `--confdir option`, substitute `~/.config/onedrive` above for that directory.
If you want to just delete the application key, but keep the items database: If you want to just delete the application key, but keep the items database:
``` ```text
rm -f ~/.config/onedrive/refresh_token rm -f ~/.config/onedrive/refresh_token
``` ```
## Additional Configuration ## Additional Configuration
Additional configuration is optional. Additional configuration is optional.
If you want to change the defaults, you can copy and edit the included config file into your `~/.config/onedrive` directory: If you want to change the defaults, you can copy and edit the included config file into your `~/.config/onedrive` directory:
``` ```text
mkdir -p ~/.config/onedrive mkdir -p ~/.config/onedrive
cp ./config ~/.config/onedrive/config cp ./config ~/.config/onedrive/config
nano ~/.config/onedrive/config nano ~/.config/onedrive/config
@ -354,10 +354,10 @@ nano ~/.config/onedrive/config
This file does not get created by default, and should only be created if you want to change the 'default' operational parameters. This file does not get created by default, and should only be created if you want to change the 'default' operational parameters.
Available options: Available options:
* `sync_dir`: directory where the files will be synced * `sync_dir`: directory where the files will be synced
* `skip_file`: any files or directories that match this pattern will be skipped during sync * `skip_file`: any files or directories that match this pattern will be skipped during sync
* `skip_symlinks`: any files or directories that are symlinked will be skipped during sync * `skip_symlinks`: any files or directories that are symlinked will be skipped during sync
* `monitor_interval`: time interval in seconds by which the monitor process will process local and remote changes * `monitor_interval`: time interval in seconds by which the monitor process will process local and remote changes
### sync_dir ### sync_dir
Example: `sync_dir="~/MyDirToSync"` Example: `sync_dir="~/MyDirToSync"`
@ -407,42 +407,42 @@ Folders shared with you can be synced by adding them to your OneDrive. To do tha
### OneDrive service running as root user ### OneDrive service running as root user
There are two ways that onedrive can be used as a service There are two ways that onedrive can be used as a service
* via init.d * via init.d
* via systemd * via systemd
**Note:** If using the service files, you may need to increase the `fs.inotify.max_user_watches` value on your system to handle the number of files in the directory you are monitoring as the initial value may be too low. **Note:** If using the service files, you may need to increase the `fs.inotify.max_user_watches` value on your system to handle the number of files in the directory you are monitoring as the initial value may be too low.
**init.d** **init.d**
``` ```text
chkconfig onedrive on chkconfig onedrive on
service onedrive start service onedrive start
``` ```
To see the logs run: To see the logs run:
``` ```text
tail -f /var/log/onedrive/<username>.onedrive.log tail -f /var/log/onedrive/<username>.onedrive.log
``` ```
To change what 'user' the client runs under (by default root), manually edit the init.d service file and modify `daemon --user root onedrive_service.sh` for the correct user. To change what 'user' the client runs under (by default root), manually edit the init.d service file and modify `daemon --user root onedrive_service.sh` for the correct user.
**systemd - Arch, Ubuntu, Debian, OpenSuSE, Fedora** **systemd - Arch, Ubuntu, Debian, OpenSuSE, Fedora**
``` ```text
systemctl --user enable onedrive systemctl --user enable onedrive
systemctl --user start onedrive systemctl --user start onedrive
``` ```
To see the logs run: To see the logs run:
``` ```text
journalctl --user-unit onedrive -f journalctl --user-unit onedrive -f
``` ```
**systemd - Red Hat Enterprise Linux, CentOS Linux** **systemd - Red Hat Enterprise Linux, CentOS Linux**
``` ```text
systemctl enable onedrive systemctl enable onedrive
systemctl start onedrive systemctl start onedrive
``` ```
To see the logs run: To see the logs run:
``` ```text
journalctl onedrive -f journalctl onedrive -f
``` ```
@ -450,50 +450,50 @@ journalctl onedrive -f
In some cases it is desirable to run the OneDrive client as a service, but not running as the 'root' user. In this case, follow the directions below to configure the service for a non-root user. In some cases it is desirable to run the OneDrive client as a service, but not running as the 'root' user. In this case, follow the directions below to configure the service for a non-root user.
1. As the user, who will be running the service, run the application in standalone mode, authorize the application for use & validate that the synchronization is working as expected: 1. As the user, who will be running the service, run the application in standalone mode, authorize the application for use & validate that the synchronization is working as expected:
``` ```text
onedrive --synchronize --verbose onedrive --synchronize --verbose
``` ```
2. Once the application is validated and working for your user, as the 'root' user, where <username> is your username from step 1 above. 2. Once the application is validated and working for your user, as the 'root' user, where <username> is your username from step 1 above.
``` ```text
systemctl enable onedrive@<username>.service systemctl enable onedrive@<username>.service
systemctl start onedrive@<username>.service systemctl start onedrive@<username>.service
``` ```
3. To view the status of the service running for the user, use the following: 3. To view the status of the service running for the user, use the following:
``` ```text
systemctl status onedrive@username.service systemctl status onedrive@username.service
``` ```
### Using multiple OneDrive accounts ### Using multiple OneDrive accounts
You can run multiple instances of the application by specifying a different config directory in order to handle multiple OneDrive accounts. For example, if you have a work and a personal account, you can run the onedrive command using the --confdir parameter. Here is an example: You can run multiple instances of the application by specifying a different config directory in order to handle multiple OneDrive accounts. For example, if you have a work and a personal account, you can run the onedrive command using the --confdir parameter. Here is an example:
``` ```text
onedrive --synchronize --verbose --confdir="~/.config/onedrivePersonal" & onedrive --synchronize --verbose --confdir="~/.config/onedrivePersonal" &
onedrive --synchronize --verbose --confdir="~/.config/onedriveWork" & onedrive --synchronize --verbose --confdir="~/.config/onedriveWork" &
``` ```
or or
``` ```text
onedrive --monitor --verbose --confdir="~/.config/onedrivePersonal" & onedrive --monitor --verbose --confdir="~/.config/onedrivePersonal" &
onedrive --monitor --verbose --confdir="~/.config/onedriveWork" & onedrive --monitor --verbose --confdir="~/.config/onedriveWork" &
``` ```
* `--synchronize` does a one-time sync * `--synchronize` does a one-time sync
* `--monitor` keeps the application running and monitoring for changes both local and remote * `--monitor` keeps the application running and monitoring for changes both local and remote
* `&` puts the application in background and leaves the terminal interactive * `&` puts the application in background and leaves the terminal interactive
**Automatic syncing of both OneDrive accounts** ### Automatic syncing of both OneDrive accounts
In order to automatically start syncing your OneDrive accounts, you will need to create a service file for each account. From the `~/onedrive` folder: In order to automatically start syncing your OneDrive accounts, you will need to create a service file for each account. From the `~/onedrive` folder:
``` ```text
cp onedrive.service onedrive-work.service cp onedrive.service onedrive-work.service
``` ```
And edit the line beginning with `ExecStart` so that the command mirrors the one you used above: And edit the line beginning with `ExecStart` so that the command mirrors the one you used above:
``` ```text
ExecStart=/usr/local/bin/onedrive --monitor --confdir="/path/to/config/dir" ExecStart=/usr/local/bin/onedrive --monitor --confdir="/path/to/config/dir"
``` ```
Then you can safely run these commands: Then you can safely run these commands:
``` ```text
systemctl --user enable onedrive-work systemctl --user enable onedrive-work
systemctl --user start onedrive-work systemctl --user start onedrive-work
``` ```
@ -504,17 +504,14 @@ Repeat these steps for each OneDrive account that you wish to use.
### Reporting issues ### Reporting issues
If you encounter any bugs you can report them here on Github. Before filing an issue be sure to: If you encounter any bugs you can report them here on Github. Before filing an issue be sure to:
1. Check the version of the application you are using `onedrive --version` 1. Check the version of the application you are using `onedrive --version` and ensure that you are running either the latest [release](https://github.com/abraunegg/onedrive/releases) or built from master.
2. Run the application in verbose mode `onedrive --verbose` 2. Fill in a new bug report using the [issue template](https://github.com/abraunegg/onedrive/issues/new?template=bug_report.md)
3. Have the log of the error (preferably uploaded on an external website such as [pastebin](https://pastebin.com/)) 3. Generate a debug log for support using the following [process](https://github.com/abraunegg/onedrive/wiki/Generate-debug-log-for-support)
4. Collect any information that you may think it is relevant to the error 4. Upload the debug log to [pastebin](https://pastebin.com/) or archive and email to support@mynas.com.au
- The steps to trigger the error
- What have you already done to try solve it
- ...
### All available commands: ### All available commands
Output of `onedrive --help` Output of `onedrive --help`
``` ```text
OneDrive - a client for OneDrive Cloud Services OneDrive - a client for OneDrive Cloud Services
Usage: Usage:

View file

@ -5,7 +5,7 @@ Thats right folks onedrive is now dockerized ;)
This container offers simple monitoring-mode service for 'Free Client for OneDrive on Linux'. This container offers simple monitoring-mode service for 'Free Client for OneDrive on Linux'.
## Usage instructions ## Usage instructions
``` ```bash
docker pull driveone/onedrive docker pull driveone/onedrive
``` ```
**NOTE:** SELinux context needs to be configured or disabled for Docker, to be able to write to OneDrive host directory. **NOTE:** SELinux context needs to be configured or disabled for Docker, to be able to write to OneDrive host directory.
@ -23,23 +23,23 @@ docker run $firstRun --restart unless-stopped --name onedrive -v onedrive_conf:/
``` ```
## Poweruser section ## Poweruser section
1. Check if monitor service is running 1. Check if monitor service is running
``` ```bash
docker ps -f name=onedrive docker ps -f name=onedrive
``` ```
2. Show monitor run logs 2. Show monitor run logs
``` ```bash
docker logs onedrive docker logs onedrive
``` ```
3. Stop running monitor 3. Stop running monitor
``` ```bash
docker stop onedrive docker stop onedrive
``` ```
4. Resume monitor 4. Resume monitor
``` ```bash
docker start onedrive docker start onedrive
``` ```
5. Unregister onedrive monitor 5. Unregister onedrive monitor
``` ```bash
docker rm -f onedrive docker rm -f onedrive
``` ```
## Build instructions ## Build instructions