I’d like to attach a Google Drive with my Calibre books library to a Debian host because to run the Calibre Web application, as Nextcloud with a big data not too much stable and I have around 5 GB of books (see the Calibre Web: home in-browser online-library with Nextcloud storage and Moon+ Reader on Android post).
After some ingestion over existing clients, I decided to use the Insync (15 days trial, 30 USD cost for one user).
The latest version can easily be installed from a repository – but it doesn’t support CLI anymore.
So, to install it add a key:
[simterm]
root@rtfm-do-production:/opt# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ACCAF35C Executing: /tmp/apt-key-gpghome.mCNEtjtItQ/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys ACCAF35C gpg: key A684470CACCAF35C: 1 signature not checked due to a missing key gpg: key A684470CACCAF35C: public key "Insynchq Inc <[email protected]>" imported gpg: Total number processed: 1 gpg: imported: 1
[/simterm]
Create a /etc/apt/sources.list.d/insync.list
file:
deb http://apt.insync.io/debian stretch non-free contrib
And install it:
[simterm]
root@rtfm-do-production:/opt# apt update && apt -y install insync
[/simterm]
Contents
insync-headless
But there is another story with the insync-headless
, which actually provides CLI – its support was dropped in the latest versions, see the (LINUX) Headless and CLI community support for more details.
Still, you can use the older version, particularly 1.5.7.
Download its package:
[simterm]
root@rtfm-do-production:/tmp# wget https://d2t3ff60b2tol4.cloudfront.net/builds/insync-headless_1.5.7.37371-wheezy_amd64.deb
[/simterm]
Install it:
[simterm]
root@rtfm-do-production:/tmp# dpkg -i insync-headless_1.5.7.37371-wheezy_amd64.deb
[/simterm]
Start the service:
[simterm]
root@rtfm-do-production:/tmp# insync-headless start
[/simterm]
In your browser navigate to the https://insynchq.com/auth and log in with your Google used for Insync, and get your auth-code:
Authenticate your CLI application using the code above:
[simterm]
root@rtfm-do-production:/tmp# insync-headless add_account -a 4/z***MIA
[/simterm]
Synchronization will be started once you’ll add an account:
[simterm]
root@rtfm-do-production:/tmp# ls -l /root/[email protected]/ total 1928 -rw-r--r-- 1 root root 210 Jun 4 2019 Apartments.gdsheet -rw-r--r-- 1 root root 171 Oct 1 2015 Blank Flowchart.gdlink drwxr-xr-x 113 root root 4096 Apr 23 16:07 CALIBRE drwxr-xr-x 309 root root 16384 Apr 23 16:07 CloudCalibre -rw-r--r-- 1 root root 206 May 23 2016 DEGREE_Word.gddoc ...
[/simterm]
To check its status use:
[simterm]
root@rtfm-do-production:/tmp# insync-headless get_sync_progress Downloading Jenkins_ The Definitive Guide - John Ferguson Smart.pdf (0% of 24.6 MB) The Docker Book - James Turnbull.pdf (0% of 5.6 MB) Utro novoi ery - Aleksei Doronin.fb2 (0% of 1.2 MB) metadata.opf (0% of 3.3 KB) 1060 files queued
[/simterm]
@
and a directory name
But here is one small caveat: because the path to the folder containing your Google Drive data will have your email in its name with the @
– some applications, like Calibre Web, for example, won’t accept it as a valid pathname.
To solve it we can use well-know crunch – our lovely symlinks:
[simterm]
root@rtfm-do-production:/tmp# ln -s /root/[email protected]/CloudCalibre/ /opt/calibre/books
[/simterm]
Check it:
[simterm]
root@rtfm-do-production:/tmp# ll /opt/calibre/books/ | head -5 total 2776 drwxr-xr-x 3 root root 4096 Apr 23 16:05 A. A. Orlov drwxr-xr-x 9 root root 4096 Apr 23 16:06 A. Avramienko drwxr-xr-x 3 root root 4096 Apr 23 16:06 A. Bielash drwxr-xr-x 3 root root 4096 Apr 23 16:06 A. B_iuli
[/simterm]
See more commands and documentation here>>>.