ffsend/pkg/create_deb
Tim Visée 5d780cdc52
Build first Debian packages on release (#4)
* Build .deb packages for some architectures on CI to publish on GitHub

* Add release binaries to archive root, update Cargo.toml
2018-05-31 11:15:53 +02:00

37 lines
1 KiB
Bash
Executable file

#!/usr/bin/env bash
set -e
# Ensure the version tag is valid
if [[ ! $TRAVIS_TAG =~ ^v([0-9]+\.)*[0-9]+$ ]]; then
echo "Error: invalid Git tag in \$TRAVIS_TAG, must be in 'v0.0.0' format"
exit 1
fi
# Ensure the debian architecture is set
if [[ -z "$DEB_ARCH" ]]; then
echo "Error: debian architecture not configured in \$DEB_ARCH"
exit 1
fi
# Define some useful variables
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
VERSION=${TRAVIS_TAG:1}
# Ensure the binary file exists
if [[ ! -f "$DIR/../ffsend" ]]; then
echo "Error: missing 'ffsend' binary in repository root"
exit 1
fi
# Copy the binary into the package directory
mkdir -p $DIR/deb/usr/bin
cp $DIR/../ffsend $DIR/deb/usr/bin/ffsend
# Update version and architecture in the control file
sed -i "/Version:\.*/c\\Version: $VERSION" $DIR/deb/DEBIAN/control
sed -i "/Architecture:\.*/c\\Architecture: $DEB_ARCH" $DIR/deb/DEBIAN/control
# Build the debian package
echo "Building debian package..."
dpkg-deb --verbose --build $DIR/deb .