Skip to content

Commit

Permalink
feat: update sha256 script
Browse files Browse the repository at this point in the history
  • Loading branch information
chenasraf committed Nov 18, 2024
1 parent f6cdf95 commit 681a1b5
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions scripts/sha256.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,39 @@ build_url="https://github.com/Redot-Engine/redot-engine/releases/download/redot-

verify_sha256() {
filename="$1"
url="$2"
label="$2"
url="$3"

if [[ ! -f "$dir/$filename" ]]; then
echo -e "\e[33mDownloading $filename...\e[0m"
curl -L "$url" -o "$dir/$filename"
echo
else
echo -e "\e[36mFile $dir/$filename already exists.\e[0m"
fi

echo -e "\e[36mSummary of $filename:\e[0m"
echo -e "\e[36mSummary of $filename ($label):\e[0m"
echo
echo "URL: $url"
echo "SHA256: $(sha256sum "$dir/$filename" | awk '{print $1}')"
echo -e "SHA256: \e[32m$(sha256sum "$dir/$filename" | awk '{print $1}')\e[0m"
}

verify_sha256 "$src_filename" "$src_url"
echo -e "\e[34mChecking SHA256 sums for Redot Engine v$tag...\e[0m"
echo "Directory: $dir"
echo "Tag: $tag"
echo "Source: $src_url"
echo "Binary: $build_url"
echo
verify_sha256 "$build_filename" "$build_url"

echo -e -n "\e[35mWould you like to continue? (Y/n)\e[0m "
read -r answer

if [[ -n "$answer" && "$answer" != "y" ]]; then
echo -e "\e[31mAborted.\e[0m"
exit 1
fi

echo
verify_sha256 "$src_filename" "Source code tarball" "$src_url"
echo
verify_sha256 "$build_filename" "Binary taball" "$build_url"

0 comments on commit 681a1b5

Please sign in to comment.