Google Drive on the Raspberry Pi using Grive

Google still hasn't released a Google Drive client for Linux (and when they do, it won't necessarily run on an ARM chip) so the best option I've found so far is Grive - an open source client.  It syncs with Google Drive, although doesn't "watch" for changes, so it needs to be run regularly (e.g. on a cron-job).

Diving straight ahead into installation...

Install the dependencies (this was sufficient for my Pi, running Raspbian):

sudo apt-get install git cmake build-essential libgcrypt11-dev libjson0-dev libcurl4-openssl-dev libexpat1-dev libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-test-dev binutils-dev libyajl-dev qt4-dev-tools patch

Download the Grive source code (this uses Git to get the latest version and puts it into a subfolder named 'grive'):

cd ~
git clone git://github.com/Grive/grive.git

Patch Grive so that it compiles on the Raspberry Pi (download the attached file and save it in your home directory as State.cc.patch):

patch ~/grive/libgrive/src/drive/State.cc -i ~/State.cc.patch

Compile Grive (this will take a while!):

cd grive
cmake .
make

If you have an error about something missing during the "cmake ." stage, then there was a missing dependency - please let me know what it is, so I can add it to these instructions!

Setting up Grive to sync your Google Drive...

Create a directory for your Google Drive to sync to (everything in your Google Drive will download to here, and everything in here will upload to Google Drive), and copy the program into it:

mkdir ~/GoogleDrive
cp ~/grive/grive/grive ~/GoogleDrive

On the first run, you need to authenticate Grive so it can access your Google Drive - Grive will give you a URL, which you need to visit, copy the access code Google gives you, and paste that into Grive (this could take a while, as it will now sync everything!):

cd ~/GoogleDrive
./grive -a

Keeping your sync up to date...

As Grive doesn't "watch" for changes, it needs to be run regularly in order to upload any files you've created or changed, and download any new or updated files from Google Drive.  The easiest way to do this is using cron:

crontab -e

Insert this line to run grive at midnight every night:

0 0 * * * cd ~/GoogleDrive && ./grive

AttachmentSize
File Patch for libgrive/src/drive/State.cc594 bytes