Grive2 — различия между версиями

Материал из YourcmcWiki
Перейти к: навигация, поиск
(Новая страница: «Welcome to the Grive2 project homepage! The purpose of this project is to provide an independent open source implementation of Google Drive client for GNU/Linux.…»)
(нет различий)

Версия 13:48, 25 сентября 2015

Welcome to the Grive2 project homepage!

The purpose of this project is to provide an independent open source implementation of Google Drive client for GNU/Linux. It uses the Google Document List API to talk to the servers in Google. The code is written in standard C++.

Grive2 is the fork of the original «Grive» (https://github.com/Grive/grive) with added support for the new Drive REST API and some new features, for example partial sync.

The source code of Grive2 is released under GPLv2.

Features

  • Grive can do two-side synchronization between the Google Drive and local directory: it can download and upload changed files, create new directories, and move deleted files to trash.
  • Dry run: you can see what actions Grive wants to perform with your files without really performing them (--dry-run option).
  • You can select a single subdirectory to sync with '-s subdir' option and you can exclude some files from sync with '--ignore <regexp>' option. <regexp> has perl regexp syntax and is matched against local path inside synced root directory.

Limitations

The following features are not planned to be supported in the near future. The main reason is that Google Drive supports much more features than a local file system. It is not easy/feasible/practical to mimic everything in Google Drive to a directory in a computer.

See also the FAQ for the rationale behind them.

Folders/files with multiple parents
The structure of a Google Drive is not exactly organized in a hierarchy. It is more similar to an interconnected net attached to a single root point (quoted from the API reference). Obviously the files and directories in the file system have only one parent. Therefore, this feature cannot be implemented very easily.
Folders/files with '/' in name
'/' is the directory separator and cannot be used in file names.
Multiple folders/files with the same name
Current Grive behaviour is undefined with such files.
Downloading Google Documents
This feature is not currently implemented. If the demand for it is big enough, it may be implemented later. Patches are welcomed.

Installation

The following are instructions for compiling from the very latest «master branch» source and running grive in Debian/Ubuntu/Linux Mint.

Get dependencies

Then you need to get the dependency libraries along with their development (-dev or -devel) packages:

  • yajl
  • libcurl
  • STL (libstdc++)
  • libgcrypt
  • Boost (filesystem, program_options and regex)
  • expat

There are also some optional dependencies:

  • CppUnit (for unit tests)
  • libbfd (for backtrace)
  • binutils (for libiberty, required for compilation in OpenSUSE, Ubuntu, Arch and etc)

On a Debian/Ubuntu/Linux Mint machine just install the following packages:

sudo apt-get install git cmake build-essential libgcrypt11-dev libyajl-dev libboost-filesystem-dev libboost-program-options-dev libboost-regex-dev libcurl4-openssl-dev libexpat1-dev libcppunit-dev binutils-dev

Download sources

First, checkout the master branch: git clone https://github.com/vitalif/grive2 or download it in a ZIP archive and unpack it in some directory.

CMake

Now that you are in the source code's “grive2” subdirectory (after 'cd /path/to/yourGriveSourceCodeDir/grive2'), at the prompt type:

mkdir build
cd build
cmake ..
  • note the double period (..) as the argument to cmake, to denote the parent directory.
  • You should get a success message like: ”– Build files have been written to: /your/dir”
  • Don't run it with sudo - root access is not needed for building.

Make and install

At the prompt type:

make -j4

You'll get lots of messages & hopefully a success message: ”[100%] Built target grive_executable”. The executable file itself (called “grive”) will be placed in the “grive” subdirectory.

Then install it to the system binary directory (/usr/local/bin by default) by running:

sudo make install

Updates

For subsequent updates, you'll run `git pull` to get the latest source and then just rebuild and re-install it:

cd /path/to/yourGriveSourceCodeDir/grive2
git pull
cd build
cmake ..
make -j4
sudo make install

Note.svg Check out this git book for more info about git, if you don't know what it is.

Note that there can be a delay in updating the tarball (tar.gz button on upper right) at http://grive.github.com/grive/, and it may not have the very latest. Pulling from git ensures the very latest.

Usage

Backup

Since grive is still "beta" or "alpha", so you should better keep a backup copy of your google directory.

First run

Change to your google drive sync directory, and run grive -a:

cd /home/you/yourGoogleDrive/
grive -a

Note.svg The «-a» option is only needed the very first time you run grive.

Visit the URL that comes up, then post the auth code given (you must have been logged into Google). You should get some messages including «Synchronizing files» … now you are running.

Syncs

To sync, you must run the program manually (there is no «real-time watching» yet). At the prompt, type:

cd /home/you/yourGoogleDrive/
grive

You can set up a cron job, if you want this done on a regular basis.

If you get a «crash» (bunch of error messages on the screen), create an issue on github: https://github.com/vitalif/grive2/issues/new. Attach program output from the console; also you can run grive -l log.txt and also submit 'log.txt'. As the file will contain a log of the sync operation, you may want to edit the file first to remove personally sensitive information.

Command line options

Short option Long option Description
-h --help Produce help message
-v --version Display Grive version
-a --auth Request authorization token
-p arg --path arg Path to sync
-s arg --dir arg Subdirectory to sync
-V --verbose Verbose mode. Enable more messages than normal.
--log-xml Log more HTTP responses as XML for debugging.
--new-rev Create new revisions in server for updated files.
-d --debug Enable debug level messages. Implies -v.
-l arg --log arg Set log output filename.
-f --force Force grive to always download a file from Google Drive instead of uploading it.
--dry-run Only detect which files need to be uploaded/downloaded, without actually performing them.
--ignore arg Ignore files relative paths of which match this Perl RegExp.