build_brew.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. brew uninstall --ignore-dependencies yt-dlp || true
  27. brew uninstall python-mutagen || true
  28. brew uninstall python-brotli || true
  29. pip3 uninstall archivebox || true
  30. pip3 uninstall mutagen || true
  31. pip3 uninstall brotli || true
  32. pip3 uninstall yt-dlp || true
  33. # echo "[*] Running Formula linters and test build..."
  34. # brew test-bot --tap=ArchiveBox/homebrew-archivebox archivebox/archivebox/archivebox || true
  35. # brew uninstall archivebox || true
  36. # brew untap archivebox/archivebox || true
  37. echo
  38. echo "[+] Installing and building hombrew bottle from https://github.com/ArchiveBox/homebrew-archivebox#main"
  39. brew tap archivebox/archivebox
  40. brew install --build-bottle archivebox
  41. brew bottle archivebox
  42. echo
  43. echo "[√] Finished. Make sure to commit the outputted .tar.gz and bottle files!"