#!/bin/sh

for FILE in $@; do
    MKTORRENT=/home/debian-cd/bt/btmakemetafile.py
    ISODIR=`dirname $FILE`
    BTDIR=`echo $ISODIR | sed 's/iso-/bt-/;s/usb-/bt-/'`
    if [ ! -d $BTDIR ] ; then
        mkdir -p $BTDIR
    fi
    $MKTORRENT http://bttracker.debian.org:6969/announce \
        --comment '"Debian CD from cdimage.debian.org"' \
        $FILE | grep -v complete
    mv $FILE.torrent $BTDIR
done
