2019-02-19 17:05:47 -01:00
|
|
|
#!/bin/bash
|
2010-11-14 14:13:48 -01:00
|
|
|
|
2019-02-19 17:05:47 -01:00
|
|
|
HTTPBASE="https://cdimage.debian.org/cdimage"
|
|
|
|
NFHTTPBASE="https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/"
|
|
|
|
|
|
|
|
MKTORRENT=btmakemetafile.bittornado
|
2013-11-26 00:50:52 -01:00
|
|
|
|
2010-11-14 14:13:48 -01:00
|
|
|
for FILE in $@; do
|
|
|
|
ISODIR=`dirname $FILE`
|
|
|
|
BTDIR=`echo $ISODIR | sed 's/iso-/bt-/;s/usb-/bt-/'`
|
|
|
|
if [ ! -d $BTDIR ] ; then
|
|
|
|
mkdir -p $BTDIR
|
|
|
|
fi
|
2013-11-26 00:50:52 -01:00
|
|
|
|
2019-02-19 17:05:47 -01:00
|
|
|
# Add multiple http seeds: the release path *and* the archive path
|
|
|
|
# for both the free images and the non-free images - hopefully
|
|
|
|
# clients will use whichever is available!
|
2017-06-06 12:10:48 +00:00
|
|
|
case ${FILE} in
|
2019-02-19 17:05:47 -01:00
|
|
|
*live+nonfree*)
|
|
|
|
VER=$(echo ${FILE} | sed 's,^.*/debian-\(live-\)*,,;s,-.*$,,')"-live+nonfree"
|
|
|
|
FREE=0
|
|
|
|
;;
|
2017-06-06 12:10:48 +00:00
|
|
|
*live*)
|
|
|
|
VER=$(echo ${FILE} | sed 's,^.*/debian-\(live-\)*,,;s,-.*$,,')"-live"
|
2019-02-19 17:05:47 -01:00
|
|
|
FREE=1
|
|
|
|
;;
|
|
|
|
*firmware*)
|
|
|
|
VER=$(echo ${FILE} | sed 's,^.*/firmware-,,;s,-.*$,,')"+nonfree"
|
|
|
|
FREE=0
|
2017-06-06 12:10:48 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
VER=$(echo ${FILE} | sed 's,^.*/debian-*,,;s,-.*$,,')
|
2019-02-19 17:05:47 -01:00
|
|
|
FREE=1
|
2017-06-06 12:10:48 +00:00
|
|
|
;;
|
|
|
|
esac
|
2019-02-19 17:05:47 -01:00
|
|
|
if [ $FREE -eq 1 ]; then
|
|
|
|
HTTP1="${HTTPBASE}/release/${VER}/${FILE}"
|
|
|
|
HTTP2="${HTTPBASE}/archive/${VER}/${FILE}"
|
|
|
|
else
|
|
|
|
HTTP1="${NFHTTPBASE}/${VER}/${FILE}"
|
|
|
|
HTTP2="${NFHTTPBASE}/archive/${VER}/${FILE}"
|
|
|
|
fi
|
2010-11-14 14:13:48 -01:00
|
|
|
$MKTORRENT http://bttracker.debian.org:6969/announce \
|
|
|
|
--comment '"Debian CD from cdimage.debian.org"' \
|
2013-11-26 00:50:52 -01:00
|
|
|
--httpseeds ${HTTP1}\|${HTTP2} \
|
2010-11-14 14:13:48 -01:00
|
|
|
$FILE | grep -v complete
|
|
|
|
mv $FILE.torrent $BTDIR
|
|
|
|
done
|