2023-04-07 20:10:12 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# For the file paths to work correctly, call this script with this command from the cloned repo folder root:
|
|
|
|
# sh automation_tools/update_sha.sh
|
|
|
|
|
2023-04-13 15:27:37 +00:00
|
|
|
rd_manifest=${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml
|
2023-04-13 15:31:04 +00:00
|
|
|
sha_update_list=${GITHUB_WORKSPACE}/automation_tools/sha_update_list.cfg
|
2023-04-07 20:10:12 +00:00
|
|
|
|
2023-04-13 15:51:43 +00:00
|
|
|
echo "Manifest location: $rd_manifest"
|
|
|
|
echo "Hash update list location: $sha_update_list"
|
|
|
|
echo
|
2023-04-13 15:58:23 +00:00
|
|
|
echo "Update list contents:"
|
|
|
|
cat "$sha_update_list"
|
|
|
|
echo
|
2023-04-13 15:51:43 +00:00
|
|
|
|
2023-04-11 19:52:04 +00:00
|
|
|
while IFS="^" read -r url placeholder
|
2023-04-07 20:10:12 +00:00
|
|
|
do
|
2023-04-13 15:51:43 +00:00
|
|
|
echo "Placeholder text: $placeholder"
|
|
|
|
echo "URL to hash: $url"
|
2023-04-07 20:10:12 +00:00
|
|
|
hash=$(curl -sL "$url" | sha256sum | cut -d ' ' -f1)
|
|
|
|
sed -i 's^'"$placeholder"'^'"$hash"'^' $rd_manifest
|
2023-04-13 16:01:53 +00:00
|
|
|
done < <(cat "$sha_update_list")
|