Permalink
Browse files

Update documentation

  • Loading branch information...
astrada committed Dec 8, 2013
1 parent fa26345 commit 8d412ee0096da6b0ba84a60ec632b6fc89bb0f23
View
@@ -0,0 +1,33 @@
+There is a way to automount the filesystem at boot, although it's not very straightforward. After completing the authorization process, you can follow the following steps, to enable mounting your Google Drive using the `mount` command. Be sure to replace `$USERNAME` with your actual username.
+
+1) Create a shell script named `gdfuse` in `/usr/bin` (as root) with this content:
+
+```bash
+#!/bin/bash
+
+su $USERNAME -l -c "google-drive-ocamlfuse -label $1 $*"
+exit 0
+```
+
+2) Give it the exec permission:
+
+ $ sudo chmod +x /usr/bin/gdfuse
+
+3) Create a mountpoint (e.g. `/mnt/gdrive`) and give ownership to `$USERNAME`:
+
+ $ sudo mkdir /mnt/gdrive
+ $ sudo chown $USERNAME.$USERNAME /mnt/gdrive
+
+4) Edit `/etc/fstab` adding a line like this:
+
+ gdfuse#default /mnt/gdrive fuse uid=1000,gid=1000 0 0
+
+If `uid` and `gid` of your user are different from 1000, modify the above line accordingly.
+
+And then you can use `mount` to mount your Google Drive:
+
+ $ sudo mount /mnt/gdrive
+
+If you have another account you can mount it specifying the label after the `#` character. E.g.:
+
+ gdfuse#account2 /mnt/gdrive2 fuse uid=1000,gid=1000 0 0
View
@@ -4,7 +4,7 @@ The configuration file is saved in `~/.gdfuse/default/config` (or `~/.gdfuse/lab
Specifies if debug mode is turned on: if `true`, logs verbose output to `~/.gdfuse/default/gdfuse.log`, and logs every curl request to `~/.gdfuse/default/curl.log`:
- debug=true
+ debug=false
Specifies the interval in seconds between queries to detect server-side changes:
@@ -26,23 +26,23 @@ Specifies whether to download Google Docs (these files are read-only, even if `r
download_docs=true
-Text document [export format](https://developers.google.com/google-apps/documents-list/#valid_download_formats_for_text_documents):
+Text document [export format](https://developers.google.com/google-apps/documents-list/#valid_download_formats_for_text_documents). `desktop` format creates a shortcut to the document that will be opened in the web browser for edit:
document_format=odt
-Drawings [export format](https://developers.google.com/google-apps/documents-list/#valid_download_formats_for_drawings):
+Drawings [export format](https://developers.google.com/google-apps/documents-list/#valid_download_formats_for_drawings). `desktop` format creates a shortcut to the document that will be opened in the web browser for edit:
drawing_format=png
-Forms [export format](https://developers.google.com/google-apps/documents-list/#valid_formats_for_spreadsheets):
+Forms [export format](https://developers.google.com/google-apps/documents-list/#valid_formats_for_spreadsheets). `desktop` format creates a shortcut to the document that will be opened in the web browser for edit:
form_format=ods
-Presentations [export format](https://developers.google.com/google-apps/documents-list/#valid_formats_for_presentations):
+Presentations [export format](https://developers.google.com/google-apps/documents-list/#valid_formats_for_presentations). `desktop` format creates a shortcut to the document that will be opened in the web browser for edit:
presentation_format=pdf
-Spreadsheets [export format](https://developers.google.com/google-apps/documents-list/#valid_formats_for_spreadsheets):
+Spreadsheets [export format](https://developers.google.com/google-apps/documents-list/#valid_formats_for_spreadsheets). `desktop` format creates a shortcut to the document that will be opened in the web browser for edit:
spreadsheet_format=ods
@@ -72,3 +72,14 @@ will always keep the target file:
keep_duplicates=false
+Specifies whether to display file extensions for Google Docs:
+
+ docs_file_extension=true
+
+Specifies the maximum cache size in MB:
+
+ max_cache_size_mb=512
+
+Specifies whether overwriting a file generates a new revision:
+
+ new_revision = true
@@ -0,0 +1,74 @@
+In the basic procedure described in [[Usage]], you need a web browser for the authorization step. On a headless server without a GUI interface or a web browser, you can get it to work by using a web browser on a separate computer, and pasting the results into the `~/.gdfuse/default/config` (or `~/.gdfuse/label/config` if you use labels) file of your headless server.
+
+Caveat: I do not know whether this is the "optimal" way to do this. I was in a pinch, and this approach worked. At first, I had a difficult time getting it to work, but Alessandro responded immediately with help, and we got it to work. These are the steps I followed, and of course, please edit this page if you have tips or a better approach.
+
+(I used the "Alternate Authorization Mode" although the Standard Authorization mode using the GAE (Google App Engine) service may work too.)
+
+1. Install normally as per the [[Installation]] page
+1. In the computer with the web browser, create an OAuth2 application and credentials.
+ These steps are similar to those described in the "Alternate Authorization Mode" section in [[Authorization]]. The following steps are what I did, based on my notes. When I tried to retrace them, I got a message, which is either new or I did not notice it the first time, pointing me to Google's new [Cloud Console](https://cloud.google.com/console). I did not use that, but I assume the steps will be similar.
+ 1. Sign in to your Google account and create a project: https://code.google.com/apis/console/
+ 1. Click "Services" in the left-hand pane (will take you to https://code.google.com/apis/console/?pli=1#:services). Turn on the service "Drive API".
+ 1. Click "API Access" in the left hand pane, then click on the button "Create an OAuth 2.0 Client ID …"
+ 1. Choose any product name, e.g "My OCAMLDrive". Leave the rest of the fields blank
+ 1. Next page is "Client ID Setting". Select Application Type: "Installed Application", Installed Application Type: "Other"
+ 1. Click "Create Client ID". You will get a Client ID, a Client Secret, and a Redirect URIs.
+ The latter should be "urn:ietf:wg:oauth:2.0:oob". I also had another Redirect URI,"http://localhost", which I ignored.
+
+ Note also on this page a button for "Reset client secret…", which you shouldn't need to use, but I ended up using because I took too long to do these steps and the authorization code timed out.
+
+
+1. Authorization: Back in your headless server, run `google-drive-ocamlfuse` for the first time. I used labels (in this document, I use the label "me") because I plan on using multiple accounts. However you can also run it without the `-label` parameter and it will use a default name for the label called "default". You will need the Client ID and secret you got from google above.
+
+ $ google-drive-ocamlfuse -label me -id ##yourClientID##.apps.googleusercontent.com -secret ###yoursecret#####
+
+ Note:
+ * the arguments are -id and -secret. Elsewhere in the documentation outdated arguments are mentioned.
+
+ This command will create the default application directory (`~/.gdfuse/me/`), containing the configuration file `config` (see the [[Configuration]] page). And it will try to start a web browser to obtain authorization. Since there is no web browser present, you will get an error such as:
+
+ /bin/sh: 1: xdg-open: not found
+ /bin/sh: 1: firefox: not found
+ /bin/sh: 1: google-chrome: not found
+ Cannot retrieve auth tokens.
+ Failure("Error opening URL:https://accounts.google.com/o/oauth2/auth?client_id=#####.apps.googleusercontent.com&redirect_uri=https%3A%2F%2Fgd-ocaml-auth.appspot.com%2Foauth2callback&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&response_type=code&access_type=offline&approval_prompt=force&state=xxxxxxxxxxxxx")
+
+ where I have substituted "xxxxxx" as needed for to obscure my personal info.
+
+1. Copy the URL in the last line and use it in the browser of your other computer.
+
+ You will get a dialog asking for authorization, and it will then respond with the verification code, which you will paste into the config file in the next step.
+
+1. Now back on your headless computer, add your Client ID, secret, and verification code, to the following three lines in the `~/.gdfuse/label/config` file:
+```
+ verification_code=
+ client_id=
+ client_secret=
+```
+ You may want to edit other lines in the config file as per [[Configuration]].
+
+1. That's it. You should be ready to mount.
+
+ mkdir /my_mnt_dir
+ google-drive-ocamlfuse -label me /my_mnt_dir
+
+1. Finally, to unmount, elsewhere in the instructions it says to use `fusermount -u mountpoint`. That did not work for me for some reason, but `umount mountpoint` did.
+
+Troubleshooting
+---------------
+
+When I first tried to mount my drive, I got an error message:
+
+
+ Cannot retrieve auth tokens.
+ Failure("OAuth2 error: invalid_grant (HTTP response code: 400)")
+
+
+I then ran the same command above, with the addition of the -debug parameter, and still got an error:
+
+ Starting application setup (label=me).
+ Opening log file: /root/.gdfuse/me/gdfuse.log
+ Cannot retrieve auth tokens.
+ Failure("OAuth2 error: invalid_grant (HTTP response code: 400)")
+
+This is where I got stuck but Alessandro helped me right away. The problem was that my verification code had expired. I don't know what the timeout period is, but I just went back to the google page mentioned above, clicked on "Reset client secret…", which gave me a new secret id and secret, re-ran the auth page to get a new verification code, pasted the new values into the `config` file, and then it worked like a charm.
View
@@ -4,4 +4,6 @@ Welcome to the google-drive-ocamlfuse wiki!
* [[Usage]]
* [[Authorization]]
* [[Configuration]]
-* [[Troubleshooting]]
+* [[Troubleshooting]]
+* [[Headless Usage & Authorization]]
+* [[Automounting]]
@@ -0,0 +1,31 @@
+[Martin Gallant](https://plus.google.com/u/0/106520267009287985667) contributed this checklist to install `google-drive-ocamlfuse` on a fresh Debian Jessie VM with only the base packages installed.
+
+These utilities get me started from a base Debian Jessie install:
+
+ sudo apt-get install sudo ssh
+
+The wiki says I need to do this, I did not check if this was all necessary:
+
+ sudo apt-get install m4 libcurl4-gnutls-dev libfuse-dev libsqlite3-dev
+
+I needed the following as well:
+
+ sudo apt-get install opam ocaml
+ sudo apt-get install make
+ sudo apt-get install fuse
+
+Debian has a special user group to allow fuse access. Log out, and log back in after this to make change effective:
+
+ sudo adduser *user* fuse
+
+I think this is a bug in Jessie, as this was already done in all my other Debian boxes:
+
+ sudo chown root.fuser /dev/fuse
+ sudo chmod 660 /dev/fuse
+
+Get the packages installed. I used the default on all installer prompts:
+
+ opam init
+ opam update
+ opam install google-drive-ocamlfuse
+ . /home/*user*/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
View
@@ -2,63 +2,25 @@ Here you can find instructions on how to install `google-drive-ocamlfuse`. You c
## PPA repository
-I've set up a [PPA repository](https://launchpad.net/~alessandro-strada/+archive/ppa) where I've uploaded the .deb packages for Ubuntu 12.04, 12.10, and 13.04 (i386 and amd64). To install the software using this method, run the following commands:
+I've set up a [PPA repository](https://launchpad.net/~alessandro-strada/+archive/ppa) where I've uploaded the .deb packages for Ubuntu 12.04, 12.10, 13.04, and 13.10 (i386 and amd64). To install the software using this method, run the following commands:
$ sudo add-apt-repository ppa:alessandro-strada/ppa
$ sudo apt-get update
$ sudo apt-get install google-drive-ocamlfuse
-## Installing the binaries
+## Archlinux
-I've uploaded some binary packages that target the distributions I've installed on my machine.
+`google-drive-ocamlfuse` is available in the [AUR](https://aur.archlinux.org/packages/google-drive-ocamlfuse/) (thanks to [mlq](http://pwmt.org/) for uploading the package). To install it, run:
-### Prerequisites
-
-This project uses these C libraries: `curl`, `fuse`, and `sqlite3`. If you are using a .deb based distribution, you can install the libraries with this command:
-
- $ sudo apt-get install libcurl3-gnutls libfuse2 libsqlite3-0
-
-### Ubuntu 12.04 32-bit
-
-Version 0.4: https://forge.ocamlcore.org/frs/download.php/1244/google-drive-ocamlfuse-0.4-bin-ubuntu12.04-32bit.tar.gz
-
-### Ubuntu 12.04 64-bit
-
-Version 0.4: https://forge.ocamlcore.org/frs/download.php/1240/google-drive-ocamlfuse-0.4-bin-ubuntu12.04-64bit.tar.gz
-
-Version 0.3.1: https://forge.ocamlcore.org/frs/download.php/1087/google-drive-ocamlfuse-0.3.1-bin-ubuntu12.04-64bit.tar.gz
-
-### Ubuntu 12.10 32-bit
-
-Version 0.4: https://forge.ocamlcore.org/frs/download.php/1241/google-drive-ocamlfuse-0.4-bin-ubuntu12.10-32bit.tar.gz
-
-Version 0.3.2: https://forge.ocamlcore.org/frs/download.php/1164/google-drive-ocamlfuse-0.3.2-bin-ubuntu12.10-32bit.tar.gz
-
-### Ubuntu 12.10 64-bit
-
-Version 0.3.2: https://forge.ocamlcore.org/frs/download.php/1163/google-drive-ocamlfuse-0.3.2-bin-ubuntu12.10-64bit.tar.gz
-
-### Ubuntu 13.04 32-bit
-
-Version 0.4: https://forge.ocamlcore.org/frs/download.php/1245/google-drive-ocamlfuse-0.4-bin-ubuntu13.04-32bit.tar.gz
-
-### Ubuntu 13.04 64-bit
-
-Version 0.4: https://forge.ocamlcore.org/frs/download.php/1217/google-drive-ocamlfuse-0.4-bin-ubuntu13.04-64bit.tar.gz
-
-Version 0.3.4: https://forge.ocamlcore.org/frs/download.php/1213/google-drive-ocamlfuse-0.3.4-bin-ubuntu13.04-64bit.tar.gz
-
-Version 0.3.3: https://forge.ocamlcore.org/frs/download.php/1193/google-drive-ocamlfuse-0.3.3-bin-ubuntu13.04-64bit.tar.gz
-
-Version 0.3.2: https://forge.ocamlcore.org/frs/download.php/1177/google-drive-ocamlfuse-0.3.2-bin-ubuntu13.04-64bit.tar.gz
+ $ yaourt -S google-drive-ocamlfuse
## Installing from source
-If you are using a different distribution or you want to build the package from source, you may want to use OPAM (an OCaml package manager).
+If you are using a different distribution or you want to build the package from source, you may want to use OPAM (an OCaml package manager). If you are on a Debian Jessie, check out these instructions (contributed by Martin Gallant): [[How to install from source on Debian Jessie]].
### Installing with OPAM
-1. Install `OPAM` (http://opam.ocamlpro.com/doc/Quick_Install.html)
+1. Install `OPAM` (http://opam.ocaml.org/doc/Quick_Install.html)
2. Install the C tools and libraries: `m4`, `curl`, `fuse`, and `sqlite3`. These dependencies are not managed by OPAM, so you have to install them in order to compile the executable. If you are using a .deb based distribution, you can install the libraries with this command:
$ sudo apt-get install m4 libcurl4-gnutls-dev libfuse-dev libsqlite3-dev
View
@@ -17,3 +17,8 @@ Using `label` to distinguish different accounts. The program will use the direct
To unmount the filesystem, issue this command:
$ fusermount -u mountpoint
+
+Options
+-------
+
+Run `google-drive-ocamlfuse -help` to get all the command options available. To find more details about `-o` mount options, you can refer to this [page](http://blog.woralelandia.com/2012/07/16/fuse-mount-options/).

0 comments on commit 8d412ee

Please sign in to comment.