GoogleCL on Synology DiskStation

Some time ago I decided I would not upgrade my SOHO server (the dearly beloved Zeus, a Windows 2003 box acting as a file/print/mail/etc server) but to move these services to the cloud. Despite my mainly Microsoft oriented professional background, I choose Google Apps rather than Microsoft Office 365. I buried the server, reluctantly concluded not to use Active Directory any more (nor any other directory service)  in this heterogeneous environment of Windows, Linux and Mac clients (and plenty of other devices). As far as storage is concerned, I bought a Synology DiskStation DS212+ NAS to safeguard my personal and business files. In short: less is more.

I’m using Google Docs intensively now. Despite my beliefs and unconditional trust in the cloud (and Google in particular), the paranoid control freak in me wanted to have a local “backup” of what I’m storing in the cloud. So here’s a little post on how to copy files from Google Docs to the DS212+.

Prerequisites

Enable Secure Shell on the NAS first if you haven’t done so yet:

By doing so we’ll be able to connect by ssh from a Linux or OSX terminal session (or PuTTY if you’re running Windows). Connect to the NAS with root (which has the same password as admin).

In the next following three steps, we’ll 1) bootstrap the Synology NAS to install ipkg (the Itsy Package Management System), 2) install Python, the Google Data APIs Python Client Library (gdata-python-client) and the Command Line Tools (GoogleCL) and finally 3) Test GoogleCL.

Bootstrap

In order to install ipkg (via a bootstrap script), you need to figure out the CPU of your Synology NAS beforehand because these scripts are specific to the processor. In my case, the DS212+ CPU seems to be a Marvell Kirkwood mv6282.

On this page, you’ll find URLs to download each specific script (xsh) and straightforward instructions on how to install it, follow these carefully. In short: download the xsh file, execute it and reboot (there is a reboot command available in Synology’s BusyBox).

After rebooting, ipkg should be functional. First thing to do after rebooting is to update the package repository by executing ipkg update. There is no need to upgrade (as stated in this article) as we don’t have any packages installed yet.

Python

In order to install Python, we’ll check which packages are available first:

ipkg list python*

Install the Python 2.7 package (ipkg will automatically download and install dependencies):

ipkg install python27

Next, test if Python is working properly:


If Python was installed successfully, download, extract and install Google’s gdata-python-client first, then GoogleCL. Builds 2.0.15 and 16 of gdata-python-client seem to be broken (at least they didn’t work on my box – AttributeError: 'module' object has no attribute 'DOCLIST_FEED_URI' error upon testing GoogleCL), so I advice to download build 2.0.14 available here:

wget http://gdata-python-client.googlecode.com/files/gdata-2.0.14.tar.gz

Decompress the tarball:

tar xvf gdata-2.0.14.tar.gz

And finally, install the goodies:

cd gdata-2.0.14/
python2.7 setup.py install --record=files.txt

Check files.txt if you need to troubleshoot and eventually delete the source files downloaded and extracted here if the installation succeeded.

Repeat the same procedure for GoogleCL, latest version, available here.

Test

Time to test GoogleCL! google should be installed in /opt/local/bin. Try to execute google and invoke help:


Done for now, in a next post we’ll create a (cron)job to backup files from Google Docs to the Synology DiskStation automatically on a daily or weekly basis.

Advertisements

8 Responses to GoogleCL on Synology DiskStation

  1. sean says:

    Hi, how do you get over the need to have a browser installed ?

    > youtube list auser
    Please specify user: Please specify user: auser
    Could not get default browser: could not locate runnable browser
    Please log in and/or grant access via your browser at https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token=4%2F6GDR802UV9jaqv7EPEz7T5s9_W00&hd=default then hit enter.

    Token upgrade failed! Could not get OAuth access token.
    Failed to get valid access token!

  2. matthew says:

    Is there already a way to automatically backup your files from Synology to Google Drive?

  3. vanderholm says:

    Thank you for a great tutorial!
    I got so far with no problems and learned a few things. But what about the promised next post? I am yearning to learn how to set up a cron job on my synology!
    Pax C

  4. Shahnan says:

    Thanks for tutorial! It worked perfectly. Now I just need to figure out how to do a sync, then set-up a cron job for the sync.

  5. Patrick Yiu says:

    It works! Thanks for sharing the procedures.

    In addition to your article, I found that it has a problem while synchronizing those utf-8 folders/files. The solution is to obtain the missing files to add locale support from the Synology toolchain. Reference:
    http://pcloadletter.co.uk/2011/08/02/serviio-0-6-on-synology-nas/

  6. I’d love to see the follow up post as well :)

  7. Suffi says:

    “I’d love to see the follow up post as well :)”

    ME THREE!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: