use md5_get instead of TokyoCabinet::HDB
[cloudstore.git] / torrent / mktorrent.sh
index f0d1bb1..13a424c 100755 (executable)
@@ -1,18 +1,30 @@
-#!/bin/sh -xe
+#!/bin/sh -e
 
-chmod 444 $1
+cd /rsync1/s1
 
-if [ ! -e $1.torrent ] ; then
+
+test -d torrent/md5 || mkdir torrent/md5
+
+torrent="torrent/md5/$1.torrent"
+file="md5/$1"
+
+if [ ! -f $file ] ; then
+       echo "usage: $0 md5"
+       exit 1
+fi
+
+if [ ! -e $torrent ] ; then
+
+eval export `grep s1 /var/lib/extrausers/group | cut -d: -f4`
 
 # -p prevents sharing between clients
-mktorrent --announce http://10.60.0.240:6969/announce --announce http://10.60.0.244:6969/announce --no-date --verbose --output $1.torrent $1
+mktorrent --announce http://$tracker_ip:$tracker_port/announce --no-date --verbose --output $torrent $file
 
 fi
 
+test -d torrent/seed || mkdir torrent/seed
+test -d torrent/download || mkdir torrent/download
 # start seeding
-md5=`basename $1`
-cd send
-ln -sfv ../$1 .
-cd watch
-ln -sfv ../../$1.torrent .
+ln -fv `pwd`/$file torrent/download/
+ln -sfv `pwd`/$torrent torrent/seed/