Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions create_monero_torrent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,42 @@ gpg --import "$OUTPUT_DIR/binaryfate.asc"
gpg --verify "$OUTPUT_DIR/hashes.txt"

version=$(awk '/monero-source-v/ {print $2}' "$OUTPUT_DIR/hashes.txt" | awk -F".tar.bz2" '{print $1}' | awk -F"-" '{print $3}')
torrent="Monero-project-torrent-$version"
torrent="monero-project-torrent"
torrent_comment="Multi file torrent for the Monero project $version"

mkdir -p "$OUTPUT_DIR/$torrent"

mv "$OUTPUT_DIR/hashes.txt" "$OUTPUT_DIR/$torrent/"
mv "$OUTPUT_DIR/binaryfate.asc" "$OUTPUT_DIR/$torrent/"

for file in $(awk '/monero-/ {print $2}' "$OUTPUT_DIR/$torrent/hashes.txt"); do
# dont re-download if exists
[ -f "$OUTPUT_DIR/$torrent/$file" ] && continue
echo "Downloading $file..."
dir=cli
if [[ $file =~ gui ]]; then
dir=gui
fi
# dont re-download if exists
[ -f "$OUTPUT_DIR/$torrent/$dir/$file" ] && continue
echo "Downloading $file..."
url=https://dlsrc.getmonero.org/${dir}/${file}
curl -sLO --output-dir "$OUTPUT_DIR/$torrent" "$url"
# make sure subdir exists
mkdir -p "$OUTPUT_DIR/$torrent/$dir"
# webseed compatible https://www.bittorrent.org/beps/bep_0019.html
curl -sLO --output-dir "$OUTPUT_DIR/$torrent/$dir" "$url"
done

cd "$OUTPUT_DIR/$torrent"

grep 'monero-' hashes.txt | sha256sum -c || {
echo "One or more hashes failed"
exit 1
}
grep 'monero-' hashes.txt | while read -r hash file; do
path="cli/$file"
if [[ $file =~ gui ]]; then
path="gui/$file"
fi

echo "$hash $path" | sha256sum -c - || {
echo "Hash check failed for $path"
exit 1
}
done

cd ../..

Expand All @@ -51,4 +62,4 @@ cd ../..

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

py3createtorrent -p 512 -o watch/ -c "Multi file torrent for the Monero project" -v $OUTPUT_DIR/$torrent
py3createtorrent -p 512 -o watch/ -c "$torrent_comment" --webseed "https://dlsrc.getmonero.org/" --webseed "http://node.monerodevs.org/" -v $OUTPUT_DIR/$torrent