torch-agent/build-deb.sh

35 lines
680 B
Bash
Executable File

#!/bin/bash
if [[ -z "${DEB_EMAIL}" ]]; then
DEB_EMAIL="$1"
DPKG_BUILD_OPTS=-k"$DEB_EMAIL"
fi
if [[ -z "${DEB_EMAIL}" ]]; then
DEB_EMAIL="none@none.com"
DPKG_BUILD_OPTS="-us -uc"
fi
TORCH_VERSION=$(git describe --tags --abbrev=0)
PROJECT=torch-agent-$TORCH_VERSION
BUILD_DIR=dist
DEB_DIR=$BUILD_DIR/$PROJECT
rm -rf "${BUILD_DIR:?}"
mkdir -p "$DEB_DIR/src/etc/torch"
cp -r debian "$DEB_DIR/"
cp torch.conf "$DEB_DIR/src/etc/torch/"
pip3 install -r requirements.txt
python3 setup.py sdist
cd $BUILD_DIR || exit
tar -xzmf "$PROJECT.tar.gz"
cd "$PROJECT" || exit
export USER
USER=$(whoami)
dh_make --createorig -e "$DEB_EMAIL" -s -y
dpkg-buildpackage $DPKG_BUILD_OPTS