git-annex/doc/special_remotes/external.mdwn
Joey Hess fabc3863d5 add working external special remote for torrents
Not IMHO good enough quality to be more than an example, but it does work!
2014-12-11 18:09:44 -04:00

31 lines
1.4 KiB
Markdown

There are three ways to implement a new special remote:
1. Using the [[hook]] special remote to tell git-annex what commands
to run to store and retrieve data. This is the easiest way, and
is great for prototyping.
2. Writing it in Haskell and adding it to git-annex.
3. Writing a program in any language you like that speaks the
[[design/external_special_remote_protocol]].
The rest of this page concentrates on writing new external special remotes.
It's not hard!
* All you need is to make a program with a name like `git-annex-remote-$bar`.
* Install it in PATH.
* When the user runs `git annex initremote foo type=external externaltype=$bar`,
it will use your program.
* See [[design/external_special_remote_protocol]] for what the program
needs to do. There's an example at the end of this page.
* If things don't seem to work, pass `--debug` and you'll see, amoung other
things, a transcript of git-annex's communication with your program.
* If you build a new special remote, please add it to the list
of [[special_remotes]].
Here's an example of using an external special remote to add torrent
support to git-annex: [[external/git-annex-remote-torrent]]
Here's a simple shell script example, which can easily be adapted
to run whatever commands you need. Or better, re-written in some better
language of your choice.
[[!inline pages="special_remotes/external/example.sh" feeds=no]]