blob: 8b4dcd4d025625853d1154c8f6ad87811f7be9fc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#! /bin/sh
set -e
# environment from transmission:
# TR_APP_VERSION
# TR_TIME_LOCALTIME
# TR_TORRENT_DIR
# TR_TORRENT_HASH
# TR_TORRENT_ID
# TR_TORRENT_NAME
# source: https://trac.transmissionbt.com/wiki/Scripts
if [ -z "$TR_APP_VERSION" ]; then
echo "missing expected $TR_APP_VERSION from Transmission"
exit 1
fi
message="transmission adding torrent '$TR_TORRENT_NAME'
TR_APP_VERSION: $TR_APP_VERSION
TR_TIME_LOCALTIME: $TR_TIME_LOCALTIME
TR_TORRENT_DIR: $TR_TORRENT_DIR
TR_TORRENT_HASH: $TR_TORRENT_HASH
TR_TORRENT_ID: $TR_TORRENT_ID
TR_TORRENT_NAME: $TR_TORRENT_NAME
"
# heredocs preserve newlines
cat <<EOF
$message
EOF
# add the actual torrent and commit whatever's left to commit
cd "$TR_TORRENT_DIR"
git annex add "$TR_TORRENT_NAME" && \
git commit -F- <<EOF
$message
EOF
|