🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.2 KiB

  1. #!/bin/sh
  2. # only argument should be the version to upgrade to
  3. if [ $# != 1 ]
  4. then
  5. echo "Expected a version tag like v2.7.1"
  6. exit 1
  7. fi
  8. VERSION="$1"
  9. URL="https://github.com/skypjack/entt/archive/$VERSION.tar.gz"
  10. FORMULA="entt.rb"
  11. echo "Updating homebrew package to $VERSION"
  12. echo "Cloning..."
  13. git clone https://github.com/skypjack/homebrew-entt.git
  14. if [ $? != 0 ]
  15. then
  16. exit 1
  17. fi
  18. cd homebrew-entt
  19. # download the repo at the version
  20. # exit with error messages if curl fails
  21. echo "Curling..."
  22. curl "$URL" --location --fail --silent --show-error --output archive.tar.gz
  23. if [ $? != 0 ]
  24. then
  25. exit 1
  26. fi
  27. # compute sha256 hash
  28. echo "Hashing..."
  29. HASH="$(openssl sha256 archive.tar.gz | cut -d " " -f 2)"
  30. # delete the archive
  31. rm archive.tar.gz
  32. echo "Sedding..."
  33. # change the url in the formula file
  34. # the slashes in the URL must be escaped
  35. ESCAPED_URL="$(echo "$URL" | sed -e 's/[\/&]/\\&/g')"
  36. sed -i -e '/url/s/".*"/"'$ESCAPED_URL'"/' $FORMULA
  37. # change the hash in the formula file
  38. sed -i -e '/sha256/s/".*"/"'$HASH'"/' $FORMULA
  39. # delete temporary file created by sed
  40. rm -rf "$FORMULA-e"
  41. # update remote repo
  42. echo "Gitting..."
  43. git add entt.rb
  44. git commit -m "Update to $VERSION"
  45. git push origin master
  46. # out of homebrew-entt dir
  47. cd ..