Skip to content

Commit dd62ac6

Browse files
committed
create torrent: enable webseed
1 parent c9355d0 commit dd62ac6

1 file changed

Lines changed: 19 additions & 9 deletions

File tree

create_monero_torrent.sh

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,33 @@ mv "$OUTPUT_DIR/hashes.txt" "$OUTPUT_DIR/$torrent/"
2525
mv "$OUTPUT_DIR/binaryfate.asc" "$OUTPUT_DIR/$torrent/"
2626

2727
for file in $(awk '/monero-/ {print $2}' "$OUTPUT_DIR/$torrent/hashes.txt"); do
28-
# dont re-download if exists
29-
[ -f "$OUTPUT_DIR/$torrent/$file" ] && continue
30-
echo "Downloading $file..."
3128
dir=cli
3229
if [[ $file =~ gui ]]; then
3330
dir=gui
3431
fi
32+
# dont re-download if exists
33+
[ -f "$OUTPUT_DIR/$torrent/$dir/$file" ] && continue
34+
echo "Downloading $file..."
3535
url=https://dlsrc.getmonero.org/${dir}/${file}
36-
curl -sLO --output-dir "$OUTPUT_DIR/$torrent" "$url"
36+
# make sure subdir exists
37+
mkdir -p "$OUTPUT_DIR/$torrent/$dir"
38+
# webseed compatible https://www.bittorrent.org/beps/bep_0019.html
39+
curl -sLO --output-dir "$OUTPUT_DIR/$torrent/$dir" "$url"
3740
done
3841

3942
cd "$OUTPUT_DIR/$torrent"
4043

41-
grep 'monero-' hashes.txt | sha256sum -c || {
42-
echo "One or more hashes failed"
43-
exit 1
44-
}
44+
grep 'monero-' hashes.txt | while read -r hash file; do
45+
path="cli/$file"
46+
if [[ $file =~ gui ]]; then
47+
path="gui/$file"
48+
fi
49+
50+
echo "$hash $path" | sha256sum -c - || {
51+
echo "Hash check failed for $path"
52+
exit 1
53+
}
54+
done
4555

4656
cd ../..
4757

@@ -51,4 +61,4 @@ cd ../..
5161

5262
#transmission-show "$TORRENT_DIR/$torrent.torrent"
5363

54-
py3createtorrent -p 512 -o watch/ -c "Multi file torrent for the Monero project" -v $OUTPUT_DIR/$torrent
64+
py3createtorrent -p 512 -o watch/ -c "Multi file torrent for the Monero project" --webseed https://dlsrc.getmonero.org/ -v $OUTPUT_DIR/$torrent

0 commit comments

Comments
 (0)