2020-11-23 16:52:15 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
### Bash Environment Setup
|
|
|
|
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
|
|
|
|
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
|
|
|
|
# set -o xtrace
|
|
|
|
set -o errexit
|
|
|
|
set -o errtrace
|
|
|
|
set -o nounset
|
|
|
|
set -o pipefail
|
|
|
|
IFS=$'\n'
|
|
|
|
|
|
|
|
|
2020-12-11 09:59:53 -05:00
|
|
|
CURRENT_PLAFORM="$(uname)"
|
|
|
|
REQUIRED_PLATFORM="Linux"
|
|
|
|
if [[ "$CURRENT_PLAFORM" != "$REQUIRED_PLATFORM" ]]; then
|
|
|
|
echo "[!] Skipping the Debian package build on $CURRENT_PLAFORM (it can only be run on $REQUIRED_PLATFORM)."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2021-02-08 23:22:24 -05:00
|
|
|
|
|
|
|
REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
|
2020-11-23 16:52:15 -05:00
|
|
|
VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")"
|
2021-02-08 23:22:24 -05:00
|
|
|
DEBIAN_VERSION="${DEBIAN_VERSION:-1}"
|
|
|
|
cd "$REPO_DIR"
|
2020-11-23 16:52:15 -05:00
|
|
|
|
|
|
|
|
2021-02-08 23:22:24 -05:00
|
|
|
if [[ -f "$REPO_DIR/.venv/bin/activate" ]]; then
|
|
|
|
source "$REPO_DIR/.venv/bin/activate"
|
|
|
|
else
|
|
|
|
echo "[!] Warning: No virtualenv presesnt in $REPO_DIR.venv"
|
|
|
|
fi
|
|
|
|
|
2020-11-23 16:52:15 -05:00
|
|
|
# cleanup build artifacts
|
|
|
|
rm -Rf build deb_dist dist archivebox-*.tar.gz
|
|
|
|
|
2020-11-28 04:10:48 -05:00
|
|
|
|
2020-11-23 16:52:15 -05:00
|
|
|
# build source and binary packages
|
2021-02-08 23:22:24 -05:00
|
|
|
# make sure the stdeb.cfg file is up-to-date with all the dependencies
|
2020-11-23 16:52:15 -05:00
|
|
|
python3 setup.py --command-packages=stdeb.command \
|
|
|
|
sdist_dsc --debian-version=$DEBIAN_VERSION \
|
|
|
|
bdist_deb
|
|
|
|
|
2021-02-08 23:22:24 -05:00
|
|
|
# should output deb_dist/archivebox_0.5.4-1.{deb,changes,buildinfo,tar.gz}
|