abraunegg-onedrive/README.md

161 lines
5.8 KiB
Markdown
Raw Normal View History

2017-06-16 16:44:48 +02:00
# OneDrive Free Client
###### A complete tool to interact with OneDrive on Linux. Built following the UNIX philosophy.
2015-09-22 18:31:10 +02:00
### Features:
* State caching
* Real-Time file monitoring with Inotify
2015-09-28 13:49:29 +02:00
* Resumable uploads
2017-06-16 16:44:48 +02:00
* Support OneDrive for Business (part of Office 365)
2018-01-19 23:08:48 +01:00
* Shared folders (not Business)
2015-09-22 18:31:10 +02:00
### What's missing:
2017-06-16 16:44:48 +02:00
* While local changes are uploaded right away, remote changes are delayed
2015-09-22 18:31:10 +02:00
* No GUI
2017-06-16 16:44:48 +02:00
## Setup
2015-10-13 17:32:51 +02:00
### Dependencies
* [libcurl](http://curl.haxx.se/libcurl/)
* [SQLite 3](https://www.sqlite.org/)
* [Digital Mars D Compiler (DMD)](http://dlang.org/download.html)
2017-06-16 16:44:48 +02:00
### Dependencies: Ubuntu/Debian
```sh
2018-01-02 21:25:27 +01:00
sudo apt install libcurl4-openssl-dev
sudo apt install libsqlite3-dev
sudo wget http://master.dl.sourceforge.net/project/d-apt/files/d-apt.list -O /etc/apt/sources.list.d/d-apt.list
sudo apt-get update && sudo apt-get -y --allow-unauthenticated install --reinstall d-apt-keyring
sudo apt-get update && sudo apt-get install dmd-compiler dub
2017-06-16 18:41:57 +02:00
```
### Dependencies: Fedora/CentOS
```sh
2017-06-30 10:54:14 +02:00
sudo yum install libcurl-devel
sudo yum install sqlite-devel
2017-06-16 18:41:57 +02:00
curl -fsS https://dlang.org/install.sh | bash -s dmd
```
2015-10-13 17:32:51 +02:00
2018-01-02 21:25:27 +01:00
### Dependencies: Arch Linux
```sh
sudo pacman -S curl sqlite dmd
```
### Installation
2017-06-16 16:44:48 +02:00
```sh
git clone https://github.com/skilion/onedrive.git
2016-12-25 20:53:46 +01:00
cd onedrive
make
sudo make install
```
2015-10-13 17:32:51 +02:00
2018-01-02 21:25:27 +01:00
Using a different compiler (for example [LDC](https://wiki.dlang.org/LDC)):
```sh
make DC=ldmd2
```
2017-06-16 16:44:48 +02:00
### First run :zap:
2018-01-19 17:53:22 +01:00
After installing the application you must run it at least once from the terminal to authorize it.
You will be asked to open a specific link using your web browser where you will have to login into your Microsoft Account and give the application the permission to access your files. After giving the permission, you will be redirected to a blank page. Copy the URI of the blank page into the application.
2017-06-16 16:44:48 +02:00
### Uninstall
```sh
sudo make uninstall
# delete the application state
rm -rf .config/onedrive
2015-10-13 18:18:03 +02:00
```
2017-06-16 16:44:48 +02:00
## Configuration
Configuration is optional. By default all files are downloaded in `~/OneDrive` and only hidden files are skipped.
If you want to change the defaults, you can copy and edit the included config file into your `~/.config/onedrive` directory:
```sh
2015-10-13 18:18:03 +02:00
mkdir -p ~/.config/onedrive
cp ./config ~/.config/onedrive/config
2017-06-16 16:44:48 +02:00
nano ~/.config/onedrive/config
2015-10-13 18:18:03 +02:00
```
2015-09-22 18:31:10 +02:00
Available options:
* `sync_dir`: directory where the files will be synced
2017-06-16 16:44:48 +02:00
* `skip_file`: any files or directories that match this pattern will be skipped during sync.
2015-09-22 18:31:10 +02:00
2017-06-16 16:44:48 +02:00
Patterns are case insensitive. `*` and `?` [wildcards characters](https://technet.microsoft.com/en-us/library/bb490639.aspx) are supported. Use `|` to separate multiple patterns.
2015-09-22 18:31:10 +02:00
2017-06-16 16:44:48 +02:00
Note: after changing `skip_file`, you must perform a full synchronization by executing `onedrive --resync`
2018-01-02 21:25:27 +01:00
### Selective sync
Selective sync allows you to sync only specific files and directories.
To enable selective sync create a file named `sync_list` in `~/.config/onedrive`.
2018-01-02 21:25:27 +01:00
Each line of the file represents a relative path from your `sync_dir`. All files and directories not matching any line of the file will be skipped during all operations.
Here is an example of `sync_list`:
2017-06-16 16:44:48 +02:00
```text
Backup
2017-06-16 16:44:48 +02:00
Documents/latest_report.docx
Work/ProjectX
notes.txt
```
2017-06-16 16:44:48 +02:00
Note: after changing the sync list, you must perform a full synchronization by executing `onedrive --resync`
2015-09-22 18:31:10 +02:00
2018-01-02 21:25:27 +01:00
### Shared folders
Folders shared with you can be synced by adding them to your OneDrive. To do that open your Onedrive, go to the Shared files list, right click on the folder you want to sync and then click on "Add to my OneDrive".
2017-06-16 16:44:48 +02:00
### OneDrive service
2015-12-29 20:01:03 +01:00
If you want to sync your files automatically, enable and start the systemd service:
2017-06-16 16:44:48 +02:00
```sh
2015-12-29 20:01:03 +01:00
systemctl --user enable onedrive
systemctl --user start onedrive
```
To see the logs run:
2017-06-16 16:44:48 +02:00
```sh
2015-12-29 20:01:03 +01:00
journalctl --user-unit onedrive -f
```
2018-01-02 21:25:27 +01:00
Note: systemd is supported on Ubuntu only starting from version 15.04
2017-06-16 16:44:48 +02:00
### Using multiple accounts
You can run multiple instances of the application specifying a different config directory in order to handle multiple OneDrive accounts.
To do this you can use the `--confdir` parameter.
Here is an example:
```sh
onedrive --monitor --confdir="~/.config/onedrivePersonal" &
onedrive --monitor --confdir="~/.config/onedriveWork" &
```
2015-09-22 18:31:10 +02:00
2017-06-16 16:44:48 +02:00
`--monitor` keeps the application running and monitoring for changes
`&` puts the application in background and leaves the terminal interactive
## Extra
### Reporting issues
If you encounter any bugs you can report them here on Github. Before filing an issue be sure to:
2018-01-02 21:25:27 +01:00
1. Check the version of the application you are using `onedrive --version`
2017-06-16 16:44:48 +02:00
2. Run the application in verbose mode `onedrive --verbose`
3. Have the log of the error (preferably uploaded on an external website such as [pastebin](https://pastebin.com/))
4. Collect any information that you may think it is relevant to the error
- The steps to trigger the error
- What have you already done to try solve it
- ...
2017-06-16 16:44:48 +02:00
### All available commands:
```text
Usage: onedrive [OPTION]...
2017-07-14 11:31:16 +02:00
no option Sync and exit
--confdir Set the directory used to store the configuration files
2018-01-02 21:25:27 +01:00
-d --download Only download remote changes
2017-07-14 11:31:16 +02:00
--logout Logout the current user
-m --monitor Keep monitoring for local and remote changes
--print-token Print the access token, useful for debugging
--resync Forget the last saved state, perform a full sync
2018-01-19 12:18:47 +01:00
--syncdir Set the directory used to sync the files that are synced
2017-07-14 11:31:16 +02:00
-v --verbose Print more details, useful for debugging
--version Print the version and exit
2017-06-16 16:44:48 +02:00
-h --help This help information.
```
2015-09-22 18:31:10 +02:00
2017-06-16 16:44:48 +02:00
### File naming
The files and directories in the synchronization directory must follow the [Windows naming conventions](https://msdn.microsoft.com/en-us/library/aa365247).
The application will crash for example if you have two files with the same name but different case. This is expected behavior and won't be fixed.