Monday, July 29, 2013

GDrive mounting released!

So version libferris-1.5.18.tar.xz is hot off the make dist; including this much ado about mounting Google Drive support. The last additional feature I decided to add before rolling the tarball was support for viewing and adding to the sharing information of a file. It didn't really do much for me being able to "cp" a file to google://drive without being able to unlock it for given people I know to have access to it. So now you can do that from the filesystem as well.

So, since the previous posts have been about the GDrive API and various snags I ran into along the way, this post is about how you can actually use this stuff.

Firstly run up the ferris-capplet-auth app and select the GDrive tab. I know I should overhaul the UI for this auth tool, but since it's mostly only used once for a web service I haven't found the personal desire to beautify it. So inside the GDrive tab, clicking on the "Authenticate with GDrive" button opens a dialog (should become a wizard), the first thing to do as it tells you is visit the console page on google to enable the GDrive API. Then click or paste the auth link in the dialog to allow libferris to get its hands on your data. The auth link goes to google and tells you what libferris is wanting. When you OK that you are given a "code" that you have to copy and paste back into the lower part of the auth capplet this dialog window. Then OKing the dialog will have libferris get a proper auth token from google and you are all set.

So to get started the below command will list the contents of your GDrive:

$ ferrisls google://drive


To put a file up on there you can do something like;

$ date >/tmp/sample.txt
$ ferriscp /tmp/sample.txt google://drive


And you can get it back with cat if you like. Or ferriscp it somewhere else etc.

$ fcat google://drive/sample.txt
Mon Jul 29 17:21:28 EST 2013


If you want to see your shares for this new sample file use the "shares" extended attribute.

$ fcat -a shares google://drive/sample.txt
write,monkeyiq

The shares attribute is a BINEBO (Bytes In Not Equal Bytes Out). Yay for me coining new terms! This means that what you write to it is not exactly what you will get when you read back from it. The handy part of that is that if you write an email address into the extended attribute, you are adding that person to the list of folks who can write to the file. Because I'm using libferris without FUSE and bash doesn't understand libferris URLs, I have to use ferris-redirect in the below command. You can think of ferris-redirect like the shell redirection (>) but you can also supply the extended attribute to redirect data into with (-a). If I read back the shares extended attribute I'll see a new entry in there. Google will have sent a notification email to my friend with a link to the file for me also.

$ echo niceguy@example.com \
   | ferris-redirect -a shares google://drive/sample.txt
$ fcat -a shares google://drive/sample.txt
write,monkeyiq
write,Really Nice Guy

I could also add some hookup to your "contacts" to this, so your evolution addressbook nick names or google contacts could be used to lookup a person. In this case, with names changed to protect the innocent etc, so hypothetically google thinks the name for that email address is Really Nice Guy because he is in my contacts on gmail.

All of this extends to other virtual filesystem that libferris supports. You can "cp" from your scanner or webcam or a tuple of a database directly to google drive if that floats your boat.

I've already had a bit of a sniff at the dropbox API and others, so you might be able to bounce data between clouds in a future release.

1 comment:

Unknown said...

Hi, I'm trying to compile libferris on Chakra. I successfully packaged ferrisloki, ferrisstreams, stldb4. The first problem: kde/plasma not found during configure. Searching config.log for 'kde' I found the following line:

configure:25859: g++ -o conftest -march=x86-64 -mtune=generic -O2 -pipe -I/usr/include/ -DQT_SHARED -I/usr/include/QtCore -I/usr/include/Qt -Wl,--hash-style=gnu -Wl,--as-needed -L/usr/local/lib -L/usr/lib/kde4/devel -lkdeui -lkdecore -lQtCore conftest.cpp -lfam >&5

I dunno where did it get "/usr/lib/kde4/devel" but kde libs are in "/usr/lib". If I'm not wrong this path is in Fedora.

If I use the following configure line:

./configure --prefix=/usr \
--with-sigcxx-2x=yes \
--libdir=/usr/lib \
--includedir=/usr/include \
--with-kde-includedir=/usr/include \
--with-kde-libdir=/usr/lib \
--with-plasma-includedir=/usr/include/plasma \
--with-plasma-libdir=/usr/lib

kde/plasma still not found and config.log shows this strange line:

configure:25859: g++ -o conftest -march=x86-64 -mtune=generic -O2 -pipe -I -I/usr/include -DQT_SHARED -I/usr/include/QtCore -I/usr/include/Qt -Wl,--hash-style=gnu -Wl,--as-needed -L/usr/local/lib -L -I/usr/lib -lkdeui -lkdecore -lQtCore conftest.cpp -lfam >&5

Anyway, libferris build fails:

http://paste.chakra-project.org/4937/

Dunno if important but I read it try to use /usr/lib64: again a Fedora heritage? My 64bit system has libs in /usr/lib.

I hope that with your help can soon release ferris in Chakra CCR.

Regards