build_brew.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/usr/bin/env bash
  2. ### Bash Environment Setup
  3. # http://redsymbol.net/articles/unofficial-bash-strict-mode/
  4. # https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
  5. # set -o xtrace
  6. set -o errexit
  7. set -o errtrace
  8. set -o nounset
  9. set -o pipefail
  10. IFS=$'\n'
  11. REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
  12. CURRENT_PLAFORM="$(uname)"
  13. REQUIRED_PLATFORM="Darwin"
  14. if [[ "$CURRENT_PLAFORM" != "$REQUIRED_PLATFORM" ]]; then
  15. echo "[!] Skipping the Homebrew package build on $CURRENT_PLAFORM (it can only be run on $REQUIRED_PLATFORM)."
  16. exit 0
  17. fi
  18. cd "$REPO_DIR/brew_dist"
  19. # make sure archivebox.rb is up-to-date with the dependencies
  20. git pull
  21. git status | grep 'up to date'
  22. echo
  23. echo "[+] Uninstalling any exisitng archivebox versions..."
  24. brew uninstall archivebox || true
  25. brew untap archivebox/archivebox || true
  26. # echo "[*] Running Formula linters and test build..."
  27. # brew test-bot --tap=ArchiveBox/homebrew-archivebox archivebox/archivebox/archivebox || true
  28. # brew uninstall archivebox || true
  29. # brew untap archivebox/archivebox || true
  30. echo
  31. echo "[+] Installing and building hombrew bottle from https://Github.com/ArchiveBox/homebrew-archivebox#main"
  32. brew tap archivebox/archivebox
  33. brew install --build-bottle archivebox
  34. brew bottle archivebox
  35. echo
  36. echo "[√] Finished. Make sure to commit the outputted .tar.gz and bottle files!"