-
Notifications
You must be signed in to change notification settings - Fork 50
Manual
The intention is that GSync will provide as much of if not all of the same upload and download functionality of RSync, excluding the transport, encoding layers and daemon support of course. So for a full explanation of how to use GSync, you could refer to the RSync man page. However, a demonstration of some use cases are shown below.
Authentication is handled by the Google OAuth2 authentication layer. It works in much the same way as any Android application, which has to obtain permission to access features of your device. The difference is that the applications that use oauth2 have to request explicit permission to access your Google services, like GMail, Drive, Calendar and so on. In order to do that, a special permissions token has been generated for this application (which currently is not perpetual so has a limited lifetime; I'll regenerate a new one when the current one runs out). This token is used to request authorisation from you to allow an application using this token to access your Google Drive. However, the token is only permitted when combined with a unique authorisation token that you will get from Google once you have granted permission for GSync to access your drive. This token is then stored in your home directory on the computer you run GSync from, under ~/.gsync. If you remove the ~/.gsync directory, it will remove the cookie and you will need to regenerate a new authentication token. Here is how the process would look:
$ time gsync --owner --group --progress --perms -u -d -r -vi ~/tmp/gsynctest/Debian_Flamme2.jpg drive://unittest/
Warning: Not running as root, file ownership may be ignored
Authorization is required to access your Google Drive.
Navigate to the following URL:
https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&client_id=542942405111.apps.googleusercontent.com&access_type=offline
Type in the received code:
If you navigate to the URL provided, you will see something like this:
If you accept, you will see a unique authentication token appear that you must paste into the awaiting prompt. Once done, the cookie is created and authentication need only take place if the cookie is removed or when the token expires.
Note: The authentication message will only appear when data is required to be transferred to or received from your Google Drive. If you do not specify any local files to transfer, the authentication steps shown above will not appear.
$ time gsync --owner --group --progress --perms -u -d -r -vi ~/tmp/gsynctest/Debian_Flamme2.jpg drive://unittest/
Warning: Not running as root, file ownership may be ignored
<f+++++++++ Debian_Flamme2.jpg
73558 0% 35.92KB/s 0:00:02
sent 73558 bytes received 0 bytes 17611.13 bytes/sec
real 0m6.220s user 0m0.492s sys 0m0.064s