2013年11月11日 星期一

[Linux][FUSE] 在 Linux 上面使用 google drive 的方法

由於 Google 官方並不提供 google drive 的工具,所以在 Linux 上面只能使用 web 介面來存取 Google Drive 上的檔案。這點對 Linux 上面 Google Drive 的使用者而言實在是一大遺憾。還好有人找出了可以使用 Google Drive 的方法,就是使用 Linux 上面已經很常見的 fuse 的 solution。

(總共四個步驟)
第一步:
你需要先安裝 google-drive-ocamlfuse ,所以在 debian 上面你可以這樣下: $ sudo apt-get install ocaml camlp4-extra
$ git clone https://github.com/OCamlPro/opam.git
$ cd opam
$ ./configure
$ make
$ sudo make install
$ sudo apt-get install m4 libcurl4-gnutls-dev libfuse-dev libsqlite3-dev
$ opam init
$ opam update
$ opam install google-drive-ocamlfuse

在 fedora 上面可以這樣下:
$ sudo yum install ocaml ocaml-camlp4-devel ocaml-ocamldoc
$ git clone https://github.com/OCamlPro/opam.git
$ cd opam
$ ./configure
$ make
$ sudo make install
$ sudo yum install m4 fuse fuse-devel libcurl-devel libsqlite3x-devel zlib-devel
$ opam init
$ opam update
$ opam install google-drive-ocamlfuse

裝完之後需要在你的 PATH 裡面加入 $HOME/.opam/system/bin
原文是建議在 .bashrc 裡面加入。

第二步 你需要把自已的 id 加入 fuse 的群組
$ sudo usermod -a -G fuse
$ exec su -l $USER


第三步 獲得 Google 的授權,在 console 底下執行
google-drive-ocamlfuse
它會呼叫瀏覽器,然後給予你的 application 一份授權認證。

第四步,也是最後 執行 google-drive-ocamlfuse ~/googledrive
如果是 gnome 的使用者的話,可以在 .config/autostart 裡面加入一個 local_start.desktop 的檔案內容會像是:
[Desktop Entry]
Name=Local Start
GenericName=File Synchronizer
Comment=Sync your files across computers and to the web
Exec=/home/xxxxx/.local/bin/autostart
Terminal=false
Type=Application
Icon=dropbox
Categories=Network;FileTransfer;
StartupNotify=false
Name[zh_TW]=local_start.desktop
GenericName[zh_TW.utf8]=local start
Comment[zh_TW.utf8]=local my start script

然後再在這個 .local/bin/autostart 的 script 裡面加入上面提到的 google-drive-ocamlfuse ~/googledrive 執令就可以。

2013-12-03 更新:忘了附上 原文出處

沒有留言:

張貼留言