build_deb.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. CURRENT_PLAFORM="$(uname)"
  12. REQUIRED_PLATFORM="Linux"
  13. if [[ "$CURRENT_PLAFORM" != "$REQUIRED_PLATFORM" ]]; then
  14. echo "[!] Skipping the Debian package build on $CURRENT_PLAFORM (it can only be run on $REQUIRED_PLATFORM)."
  15. exit 0
  16. fi
  17. REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
  18. VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")"
  19. DEBIAN_VERSION="${DEBIAN_VERSION:-1}"
  20. cd "$REPO_DIR"
  21. if [[ -f "$REPO_DIR/.venv/bin/activate" ]]; then
  22. source "$REPO_DIR/.venv/bin/activate"
  23. else
  24. echo "[!] Warning: No virtualenv presesnt in $REPO_DIR.venv"
  25. fi
  26. # cleanup build artifacts
  27. rm -Rf build deb_dist dist archivebox-*.tar.gz
  28. # build source and binary packages
  29. # make sure the stdeb.cfg file is up-to-date with all the dependencies
  30. python3 setup.py --command-packages=stdeb.command \
  31. sdist_dsc --debian-version=$DEBIAN_VERSION \
  32. bdist_deb
  33. # should output deb_dist/archivebox_0.5.4-1.{deb,changes,buildinfo,tar.gz}