File: mktorrent

package info (click to toggle)
debian-cd 3.1.17
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,056 kB
  • ctags: 180
  • sloc: sh: 5,391; perl: 3,927; makefile: 388
file content (23 lines) | stat: -rwxr-xr-x 753 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

HTTPBASE="http://cdimage.debian.org/cdimage"

for FILE in $@; do
    MKTORRENT=btmakemetafile.bittornado
    ISODIR=`dirname $FILE`
    BTDIR=`echo $ISODIR | sed 's/iso-/bt-/;s/usb-/bt-/'`
    if [ ! -d $BTDIR ] ; then
        mkdir -p $BTDIR
    fi

    # Add 2 http seeds: the release path *and* the archive path -
    # hopefully clients will use whichever is available!
    VER=$(echo ${FILE} | sed 's,^.*/debian-,,;s,-.*$,,')
    HTTP1="${HTTPBASE}/release/${VER}/${FILE}"
    HTTP2="${HTTPBASE}/archive/${VER}/${FILE}"
    $MKTORRENT http://bttracker.debian.org:6969/announce \
        --comment '"Debian CD from cdimage.debian.org"' \
	--httpseeds ${HTTP1}\|${HTTP2} \
        $FILE | grep -v complete
    mv $FILE.torrent $BTDIR
done