Using ODrive with Ubuntu 18.04 and Caja (file browser)

I wanted to integrate Onedrive into my Linux desktop without having to manually sync files one by one. While it is great to have the option to resort to single handedly syncing files one by one, it may just be more convenient to select a couple of them and tell the computer to sync them.

And while Nautilus (the Ubuntu/Gnome file browser) seems to slowly get deprived of features, where are the glorious file browsers of times past; so I got myself Caja including the Caja-Actions configuration tool, and tweaked the file sync commands into a file action so I can now right mouse click any selection of files in the Caja browser’s directory display of the ODrive synced folder, and get the files to down- or upload (whichever is newer).

I put the rundown for the installation here for further convenience.

How to install ODrive client on Ubuntu 18.04 is described on the ODrive help pages [link] (only a practical small amount of all the options on how to proceed is listed here); one could copy / paste the commands into a terminal for example. Maybe consider to not run the setup as root unless you want the stuff in your root home ; ) ($HOME being relative to the user performing actions in the terminal):

Install on 32-bit Linux

od="$HOME/.odrive-agent/bin" && curl -L "http://dl.odrive.com/odrive-py" --create-dirs -o "$od/odrive.py" && curl -L "http://dl.odrive.com/odriveagent-lnx-32" | tar -xvzf- -C "$od/" && curl -L "http://dl.odrive.com/odrivecli-lnx-32" | tar -xvzf- -C "$od/"

Install on 64-bit Linux

od="$HOME/.odrive-agent/bin" && curl -L "http://dl.odrive.com/odrive-py" --create-dirs -o "$od/odrive.py" && curl -L "http://dl.odrive.com/odriveagent-lnx-64" | tar -xvzf- -C "$od/" && curl -L "http://dl.odrive.com/odrivecli-lnx-64" | tar -xvzf- -C "$od/"

To run the odrive Sync Agent server in the background, use the following command in your terminal:

nohup "$HOME/.odrive-agent/bin/odriveagent">/dev/null&

Now the odrive Sync Agent server is running and you can use the odrive CLI to control it. For example, the following command will display the available client commands:

Binary client

"$HOME/.odrive-agent/bin/odrive" -h

The following command will show the current status of the odrive Sync Agent:

Binary client

"$HOME/.odrive-agent/bin/odrive" status

Using odrive Sync Agent

1. Create an odrive account

If you don’t have an odrive account yet, get it here.

2. Create an auth key for odrive Agent

Once you have signed-in, navigate to your Authentication Codes and click on “Create Auth Key” to create an auth key that you can then use to authenticate your odrive Sync Agent install.

3. Authenticate odrive Agent: general format authenticate [auth key]

 
Linux binary client
"$HOME/.odrive-agent/bin/odrive" authenticate 00000000-0000-0000-0000-000000000000-00000000

4. Create an agent mount

This will mount the root of your odrive to the local folder “odrive-agent-mount”. Make sure the local folder exists before attempting to mount:

mkdir "$HOME/odrive-agent-mount"

You can then mount and see your odrive links listed in ./odrive-agent-mount: mount [local path] [remote odrive path]

Linux binary client
"$HOME/.odrive-agent/bin/odrive" mount "$HOME/odrive-agent-mount" 
 

5. Sync an odrive folder:

Linux binary client
"$HOME/.odrive-agent/bin/odrive" sync "$HOME/odrive-agent-mount/ODrive.cloudf"
(or any other *.cloudf file for download, or native file format for upload)
 

6. Sync a file

Syntax: sync [local path to placeholder file]
 
Linux binary client
"$HOME/.odrive-agent/bin/odrive" sync "$HOME/odrive-agent-mount/Dropbox/myfile.txt.cloud"
Using actions within file browser on a larger selection of files requires a browser that allows you to add a command that then is executed on a selection of one or several files or cloudf/cloud-synchronization files.
 
Install browser caja and the action editor:
apt install caja caja-actions
 
Create a new action in Caja-Actions configuration tool:
 
1. Open Caja Actions configuration tool
2. File > New Action
3. Rename that action to “odrive”  both in the items list and under the tab “action”
4. Select the tab “command” for that item
5. The Command path textbox will have the path to the odrive binary, explicitly (and not based on a variable), so you if your user name is “test”, the path may be
/home/test/.odrive-agent/bin/odrive
6. The Command Parameters to be entered in that textbox will be:
sync %f
7. Then,one selectes File >Save
8. After that, one should be able to synchronize one or several selected files with a right mouse click by selecting the newly created Caja action.
 

If you want the home directory to be relatively encoded, i.e., instead of a hard coded path to a specific directory you would want to use “~/.odrive-agent/bin/odrive” to indicate the location of the odrive binary application, then you may have to change the execution mode of the action in the “execution” tab to not excute as “normal” but to use “display output”. I found that whereas the normal mode does not work, the display output mode works. Last but not the least, the display output mode is the one to use for trouble shooting – if you do not get a result from a sync desktop command, a verbal error message might help. And no, I have not yet really understood the size mismatch error ; )

tech Cite this article:
Wolf Schweitzer: swisswuff.ch - Using ODrive with Ubuntu 18.04 and Caja (file browser); published 06/11/2018, 11:22; URL: https://www.swisswuff.ch/wordpress/?p=1650

BibTeX: @MISC{schweitzer_wolf_1775117274, author = {Wolf Schweitzer}, title = {{swisswuff.ch - Using ODrive with Ubuntu 18.04 and Caja (file browser)}}, month = {November}, year = {2018}, url = {https://www.swisswuff.ch/wordpress/?p=1650} }