Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2014
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.43 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. ## generate torrents for all files in /var/www/mirrors/torproject.org/dist
  4. ## destination: /var/www/mirrors/torrents/
  5.  
  6. SOURCE=/patch/to/files/
  7. DEST=/patch/to/torrents/
  8.  
  9. ## requires mktorrent
  10.  
  11. MIRRORS='
  12. http://www.torservers.net/mirrors/torproject.org/dist/,
  13. http://www.torproject.org/dist/,
  14. http://www.oignon.net/dist/,
  15. http://tor.amorphis.eu/dist/,
  16. http://tor.ccc.de/dist/,
  17. http://tor.idnr.ws/dist/,
  18. http://cyberside.net.ee/tor/,
  19. http://mirrors.chaos-darmstadt.de/tor-mirror/dist/,
  20. http://www.torproject.us/dist/,
  21. http://tor.beme-it.de/dist/,
  22. http://torproj.xpdm.us/dist/,
  23. http://tor.askapache.com/dist/,
  24. http://torproject.nwlinux.us/dist/,
  25. http://tor.homosu.net/dist/,
  26. http://www.torproject.org.nyud.net/dist/,
  27. http://tor.kamagurka.org/dist/,
  28. http://theonionrouter.com/dist/,
  29. '
  30. # last comma required!
  31.  
  32. TRACKERS=udp://tracker.openbittorrent.com:80/announce,udp://tracker.publicbt.com:80/announce,http://tracker.openbittorrent.com:80/announce,http://tracker.publicbt.com:80/announce,udp://tracker.ccc.de/announce
  33.  
  34. MIRRORS=`echo $MIRRORS | tr -d '\n' | tr -d '[:space:]'`
  35. cd $SOURCE
  36. for file in `find . -type f`
  37. do
  38.  path=${file%/*}
  39.  path=${path#.}
  40.  name=${file##*/}
  41.  FILEMIRRORS=${MIRRORS//\/,/$path\/$name,}  #replace /, by $path/$name,
  42.  
  43.  echo Processing $path/$name
  44.  mkdir -p $DEST/$path
  45.  /usr/bin/mktorrent -a $TRACKERS -w $FILEMIRRORS $file -o $DEST/$file.torrent -c "created by www.torservers.net"
  46. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement