• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

cmake/Modules/H05-Feb-2020-12086

debian/H05-Feb-2020-14596

grive/H03-May-2022-414332

icon/H05-Feb-2020-

libgrive/H03-May-2022-11,8587,079

package/fedora16/H05-Feb-2020-9466

systemd/H03-May-2022-15796

.dockerignoreH A D05-Feb-202041 54

.gitignoreH A D05-Feb-2020326 2623

COPYINGH A D05-Feb-202017.7 KiB340281

DockerfileH A D05-Feb-2020816 3222

README.mdH A D05-Feb-202010.2 KiB265194

completion.zshH A D05-Feb-20203.3 KiB6460

README.md

1# Grive2 0.5.2-dev
2
313 Nov 2019, Vitaliy Filippov
4
5http://yourcmc.ru/wiki/Grive2
6
7This is the fork of original "Grive" (https://github.com/Grive/grive) Google Drive client
8with the support for the new Drive REST API and partial sync.
9
10Grive simply downloads all the files in your Google Drive into the current directory.
11After you make some changes to the local files, run
12grive again and it will upload your changes back to your Google Drive. New files created locally
13or in Google Drive will be uploaded or downloaded respectively. Deleted files will also be "removed".
14Currently Grive will NOT destroy any of your files: it will only move the files to a
15directory named .trash or put them in the Google Drive trash. You can always recover them.
16
17There are a few things that Grive does not do at the moment:
18- continously wait for changes in file system or in Google Drive to occur and upload.
19  A sync is only performed when you run Grive (there are workarounds for almost
20  continuous sync. See below).
21- symbolic links support.
22- support for Google documents.
23
24These may be added in the future.
25
26Enjoy!
27
28## Usage
29
30When Grive is run for the first time, you should use the "-a" argument to grant
31permission to Grive to access to your Google Drive:
32
33```bash
34cd $HOME
35mkdir google-drive
36cd google-drive
37grive -a
38```
39
40A URL should be printed. Go to the link. You will need to login to your Google
41account if you haven't done so. After granting the permission to Grive, the
42browser will show you an authenication code. Copy-and-paste that to the
43standard input of Grive.
44
45If everything works fine, Grive will create .grive and .grive_state files in your
46current directory. It will also start downloading files from your Google Drive to
47your current directory.
48
49To resync the direcory, run `grive` in the folder.
50
51```bash
52cd $HOME/google-drive
53grive
54```
55
56### Exclude specific files and folders from sync: .griveignore
57
58Rules are similar to Git's .gitignore, but may differ slightly due to the different
59implementation.
60
61- lines that start with # are comments
62- leading and trailing spaces ignored unless escaped with \
63- non-empty lines without ! in front are treated as "exclude" patterns
64- non-empty lines with ! in front are treated as "include" patterns
65  and have a priority over all "exclude" ones
66- patterns are matched against the filenames relative to the grive root
67- a/**/b matches any number of subpaths between a and b, including 0
68- **/a matches `a` inside any directory
69- b/** matches everything inside `b`, but not b itself
70- \* matches any number of any characters except /
71- ? matches any character except /
72- .griveignore itself isn't ignored by default, but you can include it in itself to ignore
73
74
75### Scheduled syncs and syncs on file change events
76
77There are tools which you can use to enable both scheduled syncs and syncs
78when a file changes. Together these gives you an experience almost like the
79Google Drive clients on other platforms (it misses the almost instantious
80download of changed files in the google drive).
81
82Grive installs such a basic solution which uses inotify-tools together with
83systemd timer and services. You can enable it for a folder in your `$HOME`
84directory (in this case the `$HOME/google-drive`):
85
86First install the `inotify-tools` (seems to be named like that in all major distros):
87test that it works by calling `inotifywait -h`.
88
89Prepare a Google Drive folder in your $HOME directory with `grive -a`.
90
91```bash
92# 'google-drive' is the name of your Google Drive folder in your $HOME directory
93systemctl --user enable grive-timer@$(systemd-escape google-drive).timer
94systemctl --user start grive-timer@$(systemd-escape google-drive).timer
95systemctl --user enable grive-changes@$(systemd-escape google-drive).service
96systemctl --user start grive-changes@$(systemd-escape google-drive).service
97```
98
99You can enable and start these two units for multiple folders in your `$HOME`
100directory if you need to sync with multiple google accounts.
101
102### Shared files
103
104Files and folders which are shared with you don't automatically show up in
105your folder. They need to be added explicitly to your Google Drive: go to the
106Google Drive website, right click on the file or folder and chose 'Add to My
107Drive'.
108
109### Different OAuth2 client to workaround over quota and google approval issues
110
111Google recently started to restrict access for unapproved applications:
112https://developers.google.com/drive/api/v3/about-auth?hl=ru
113
114Grive2 is currently awaiting approval but it seems it will take forever.
115Also even if they approve it the default Client ID supplied with grive may
116exceed quota and grive will then fail to sync.
117
118You can supply your own OAuth2 client credentials to work around these problems
119by following these steps:
120
1211. Go to https://console.developers.google.com/apis/api/drive.googleapis.com
1222. Choose a project (you might need to create one first)
1233. Go to https://console.developers.google.com/apis/library/drive.googleapis.com and
124   "Enable" the Google Drive APIs
1254. Go to https://console.cloud.google.com/apis/credentials and click "Create credentials > Help me choose"
1265. In the "Find out what credentials you need" dialog, choose:
127   - Which API are you using: "Google Drive API"
128   - Where will you be calling the API from: "Other UI (...CLI...)"
129   - What data will you be accessing: "User Data"
1306. In the next steps create a client id (name doesn't matter) and
131   setup the consent screen (defaults are ok, no need for any URLs)
1327. The needed "Client ID" and "Client Secret" are either in the shown download
133   or can later found by clicking on the created credential on
134   https://console.developers.google.com/apis/credentials/
1358. When you change client ID/secret in an existing Grive folder you must first delete
136   the old `.grive` configuration file.
1379. Call `grive -a --id <client_id> --secret <client_secret>` and follow the steps
138   to authenticate the OAuth2 client to allow it to access your drive folder.
139
140## Installation
141
142For the detailed instructions, see http://yourcmc.ru/wiki/Grive2#Installation
143
144### Install dependencies
145
146You need the following libraries:
147
148- yajl 2.x
149- libcurl
150- libstdc++
151- libgcrypt
152- Boost (Boost filesystem, program_options, regex, unit_test_framework and system are required)
153- expat
154
155There are also some optional dependencies:
156- CppUnit (for unit tests)
157- libbfd (for backtrace)
158- binutils (for libiberty, required for compilation in OpenSUSE, Ubuntu, Arch and etc)
159
160On a Debian/Ubuntu/Linux Mint machine just run the following command to install all
161these packages:
162
163    sudo apt-get install git cmake build-essential libgcrypt20-dev libyajl-dev \
164        libboost-all-dev libcurl4-openssl-dev libexpat1-dev libcppunit-dev binutils-dev \
165        debhelper zlib1g-dev dpkg-dev pkg-config
166
167Fedora:
168
169    sudo dnf install git cmake libgcrypt-devel gcc-c++ libstdc++ yajl-devel boost-devel libcurl-devel expat-devel binutils zlib
170
171
172FreeBSD:
173
174    pkg install git cmake boost-libs yajl libgcrypt pkgconf cppunit libbfd
175
176### Build Debian packages
177
178On a Debian/Ubuntu/Linux Mint you can use `dpkg-buildpackage` utility from `dpkg-dev` package
179to build grive. Just clone the repository, `cd` into it and run
180
181    dpkg-buildpackage -j4 --no-sign
182
183### Manual build
184
185Grive uses cmake to build. Basic install sequence is
186
187    mkdir build
188    cd build
189    cmake ..
190    make -j4
191    sudo make install
192
193Alternativly you can define your own client_id and client_secret during build
194
195    mkdir build
196    cd build
197    cmake .. "-DAPP_ID:STRING=<client_id>" "-DAPP_SECRET:STRING=<client_secret>"
198    make -j4
199    sudo make install
200
201## Version History
202
203### Grive2 v0.5.2-dev
204
205### Grive2 v0.5.1
206
207- Support for .griveignore
208- Automatic sync solution based on inotify-tools and systemd
209- no-remote-new and upload-only modes
210- Ignore regexp does not persist anymore (note that Grive will still track it to not
211  accidentally delete remote files when changing ignore regexp)
212- Added options to limit upload and download speed
213- Faster upload of new and changed files. Now Grive uploads files without first calculating
214  md5 checksum when file is created locally or when its size changes.
215- Added -P/--progress-bar option to print ASCII progress bar for each processed file (pull request by @svartkanin)
216- Added command-line options to specify your own client_id and client_secret
217- Now grive2 skips links, sockets, fifos and other unusual files
218- Various small build fixes
219
220### Grive2 v0.5
221
222- Much faster and more correct synchronisation using local modification time and checksum cache (similar to git index)
223- Automatic move/rename detection, -m option removed
224- force option works again
225- Instead of crashing on sync exceptions Grive will give a warning and attempt to sync failed files again during the next run.
226- Revision support works again. Grive 0.4.x always created new revisions for all files during sync, regardless of the absence of the --new-rev option.
227- Shared files now sync correctly
228
229### Grive2 v0.4.2
230
231- Option to exclude files by perl regexp
232- Reimplemented HTTP response logging for debug purposes
233- Use multipart uploads (update metadata and contents at the same time) for improved perfomance & stability
234- Bug fixes
235- Simple option to move/rename files and directories, via `grive -m oldpath newpath` (by Dylan Wulf, wulfd1@tcnj.edu)
236
237Known issues:
238- force option does not work as documented #51
239
240### Grive2 v0.4.1
241
242- Bug fixes
243
244### Grive2 v0.4.0
245
246First fork release, by Vitaliy Filippov / vitalif at mail*ru
247- Support for the new Google Drive REST API (old "Document List" API is shut down by Google 20 April 2015)
248- REAL support for partial sync: syncs only one subdirectory with `grive -s subdir`
249- Major refactoring - a lot of dead code removed, JSON-C is not used anymore, API-specific code is split from non-API-specific
250- Some stability fixes from Visa Putkinen https://github.com/visap/grive/commits/visa
251- Slightly reduce number of syscalls when reading local files.
252
253### Grive v0.3
254
255Bug fix & minor feature release. Fixed bugs:
256- #93: missing reference count increment in one of the Json constructors
257- #82: retry for HTTP error 500 & 503
258- #77: Fixed a bug where grive crashed on the first run.
259
260New features:
261- #87: support for revisions
262- #86: ~~partial sync (contributed by justin at tierramedia.com)~~ that's not partial sync,
263  that's only support for specifying local path on command line
264
265