Raspberry Pi – Synchronize Raspberry Pi with your Google Drive

If like me you have a Google Drive, you have surely a customer to your timing is on Mac, Windows or Linux. There is no reason that the Raspberry cannot do : Thank you Grive !

4236d1f70a72ab39201e1b0d54f1bf4b.media.200x204

Grive allows to synchronize your Google Drive with a local directory. Synchronization in both directions.

There is no package for powerpcspe so it'll have to do all the steps to compile this tool.

  1. Install packages needed for compiling
    apt - get install git cmake build-essential libgcrypt11-dev libjson0-dev libcurl4-openssl-dev libexpat1-dev libboost-filesystem-dev libboost-program-options-dev binutils-dev qt4-dev-tools libyajl-dev libboost-all-dev
  2. Retrieve the sources of Grive
    git clone git://github.com/Grive/grive.git
  3. Prepare the compilation of Grive
    cd grive
    cmake .
  4. To make the compilation should change the file libgrive/src/drive/State.cc. Replace (lines 251 and 252 Home)
    last_sync.Add( "SEC",   JSON(m_last_sync.SEC() ) );
    last_sync.Add( "NSEC",  JSON(m_last_sync.NanoSec() ) );

    by

    last_sync.Add( "SEC",   JSON((boost::uint64_t)m_last_sync.SEC() ) );
    last_sync.Add( "NSEC",  JSON((boost::uint64_t)m_last_sync.NanoSec() ) );

    and the following line (256 Home)

    result.Add( "change_stamp", JSON(m_cstamp) ) ;

    by

    result.Add( "change_stamp", JSON((boost::uint64_t)m_cstamp) ) ;
  5. Compile Grive
    make
  6. Now you have the executable in a sub directory Grive. The program synchronizes the drive in the directory where it is located. Therefore, move it there where you will put your files
    cp grive/grive /path/vers/le/repertoire/google
  7. When the first execution :
    cd /path/vers/le/repertoire/google
    ./grive -a
  8. The tool will display a URL. Copy and paste into a browser to give your permission to Grive :
    Grive-1
  9. You get a code to copy/paste in the terminal where runs Grive :
    Grive-2
  10. Here's what you should get (with a Google Drive blank in my case) :
    1._ssh
  11. For the next time you want to synchronize, do not use the-a parameter and run just the thrush from the directory where you sync :
    cd /path/vers/le/repertoire/google
    ./grive

You now have your files on your Raspberry Pi.

Like this article ? Bear with me on patreon!

You may also like...