25 lines
468 B
Bash
Executable file
25 lines
468 B
Bash
Executable file
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
NAME="$1"
|
|
|
|
if [ "$WEBSEED" = "" ]; then
|
|
echo '$WEBSEED not provided' >&2
|
|
exit 1
|
|
fi
|
|
if [ "$ANNOUNCE" = "" ]; then
|
|
echo '$ANNOUNCE not provided' >&2
|
|
exit 1
|
|
fi
|
|
|
|
TORRENT_FILE="$NAME.torrent"
|
|
WEBSEED_URL="$WEBSEED/$NAME"
|
|
|
|
if [ -e "$TORRENT_FILE" ]; then rm "$TORRENT_FILE"; fi
|
|
|
|
mktorrent-borg -a "$ANNOUNCE" -o "$TORRENT_FILE" -l 22 -w "$WEBSEED_URL" "$NAME"
|
|
|
|
if [ "$user" != "" ] && [ "$group" != "" ]; then
|
|
chown "$user:$group" "$TORRENT_FILE"
|
|
fi
|