| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
HTTPBASE="https://cdimage.debian.org/cdimage" |
| 4 |
|
| 5 |
MKTORRENT=mktorrent |
| 6 |
|
| 7 |
BASEDIR="$1"/ |
| 8 |
shift |
| 9 |
|
| 10 |
for FILE in $@; do |
| 11 |
ISODIR=`dirname $FILE` |
| 12 |
BTDIR=`echo $ISODIR | sed 's/iso-/bt-/;s/usb-/bt-/'` |
| 13 |
if [ ! -d $BTDIR ] ; then |
| 14 |
mkdir -p $BTDIR |
| 15 |
fi |
| 16 |
|
| 17 |
# Add multiple http seeds: the release path *and* the archive path |
| 18 |
# for both the free images and the non-free images - hopefully |
| 19 |
# clients will use whichever is available! |
| 20 |
case ${FILE} in |
| 21 |
*live*) |
| 22 |
VER=$(echo ${FILE} | sed 's,^.*/debian-\(live-\)*,,;s,-.*$,,')"-live" |
| 23 |
FREE=1 |
| 24 |
;; |
| 25 |
*) |
| 26 |
VER=$(echo ${FILE} | sed 's,^.*/debian-*,,;s,-.*$,,') |
| 27 |
FREE=1 |
| 28 |
;; |
| 29 |
esac |
| 30 |
|
| 31 |
# Remove some of the leading path here for the HTTP seeds |
| 32 |
BASEFILE=${FILE##$BASEDIR} |
| 33 |
|
| 34 |
HTTP1="${HTTPBASE}/release/${VER}/${BASEFILE}" |
| 35 |
HTTP2="${HTTPBASE}/archive/${VER}/${BASEFILE}" |
| 36 |
|
| 37 |
$MKTORRENT -a http://bttracker.debian.org:6969/announce \ |
| 38 |
-c 'Debian CD from cdimage.debian.org' \ |
| 39 |
-w ${HTTP1} \ |
| 40 |
-w ${HTTP2} \ |
| 41 |
-o ${FILE}.torrent \ |
| 42 |
$FILE > /dev/null |
| 43 |
mv $FILE.torrent $BTDIR |
| 44 |
done |