diff --git a/build-deb.sh b/build-deb.sh index c67d099..ae64d1d 100755 --- a/build-deb.sh +++ b/build-deb.sh @@ -1,33 +1,34 @@ #!/bin/bash -TORCH_VERSION=$(git describe --tags --abbrev=0) -PROJECT=torch-agent-$TORCH_VERSION - -if [[ -z "${DEBEMAIL}" ]]; then - DEBEMAIL="$1" +if [[ -z "${DEB_EMAIL}" ]]; then + DEB_EMAIL="$1" fi -if [[ -z "${DEBEMAIL}" ]]; then +if [[ -z "${DEB_EMAIL}" ]]; then echo "E-mail address required for packaging signing with gpg key!" echo "Usage: ./build-deb.sh EMAIL" exit 1 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/* +rm -rf "${BUILD_DIR:?}/"* python3 setup.py sdist -mkdir -p $DEB_DIR/src/etc/torch -cp -r debian $DEB_DIR/ -cp torch.conf $DEB_DIR/src/etc/torch/ +mkdir -p "$DEB_DIR/src/etc/torch" +cp -r debian "$DEB_DIR/" +cp torch.conf "$DEB_DIR/src/etc/torch/" -cd $BUILD_DIR -tar -xzmf $PROJECT.tar.gz +cd $BUILD_DIR || exit +tar -xzmf "$PROJECT.tar.gz" -cd $PROJECT -export USER=`whoami` -dh_make --createorig -e $DEBEMAIL -s -y -dpkg-buildpackage -k$DEBEMAIL +cd "$PROJECT" || exit +export USER +USER=$(whoami) +dh_make --createorig -e "$DEB_EMAIL" -s -y +dpkg-buildpackage -k"$DEB_EMAIL"