@@ -376,3 +376,37 @@ Add your fs to the docs - you'll need to pick an icon for it from [fontawesome](
376
376
* ` docs/content/about.md ` - front page of rclone.org
377
377
* ` docs/layouts/chrome/navbar.html ` - add it to the website navigation
378
378
* ` bin/make_manual.py ` - add the page to the ` docs ` constant
379
+
380
+ ## Writing a plugin ##
381
+
382
+ New features (backends, commands) can also be added "out-of-tree", through Go plugins.
383
+ Changes will be kept in a dynamically loaded file instead of being compiled into the main binary.
384
+ This is useful if you can't merge your changes upstream or don't want to maintain a fork of rclone.
385
+
386
+ Usage
387
+
388
+ - Naming
389
+ - Plugins names must have the pattern ` librcloneplugin_KIND_NAME.so ` .
390
+ - ` KIND ` should be one of ` backend ` , ` command ` or ` bundle ` .
391
+ - Example: A plugin with backend support for PiFS would be called
392
+ ` librcloneplugin_backend_pifs.so ` .
393
+ - Loading
394
+ - Supported on macOS & Linux as of now. ([ Go issue for Windows support] ( https://github.com/golang/go/issues/19282 ) )
395
+ - Supported on rclone v1.50 or greater.
396
+ - All plugins in the folder specified by variable ` $RCLONE_PLUGIN_PATH ` are loaded.
397
+ - If this variable doesn't exist, plugin support is disabled.
398
+ - Plugins must be compiled against the exact version of rclone to work.
399
+ (The rclone used during building the plugin must be the same as the source of rclone)
400
+
401
+ Building
402
+
403
+ To turn your existing additions into a Go plugin, move them to an external repository
404
+ and change the top-level package name to ` main ` .
405
+
406
+ Check ` rclone --version ` and make sure that the plugin's rclone dependency and host Go version match.
407
+
408
+ Then, run ` go build -buildmode=plugin -o PLUGIN_NAME.so . ` to build the plugin.
409
+
410
+ [ Go reference] ( https://godoc.org/github.com/rclone/rclone/lib/plugin )
411
+
412
+ [ Minimal example] ( https://gist.github.com/terorie/21b517ee347828e899e1913efc1d684f )
0 commit comments