2018-05-31 09:15:53 +00:00
|
|
|
#!/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
|
2021-08-25 22:31:38 +00:00
|
|
|
if [[ -z $DEB_ARCH ]]; then
|
2018-05-31 09:15:53 +00:00
|
|
|
echo "Error: debian architecture not configured in \$DEB_ARCH"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Define some useful variables
|
2021-08-25 22:31:38 +00:00
|
|
|
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
2018-05-31 09:15:53 +00:00
|
|
|
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
|
|
|
|
|
2018-05-31 22:04:13 +00:00
|
|
|
# Create an application directory, copy the binary into it
|
2021-08-25 22:31:38 +00:00
|
|
|
mkdir -p "$DIR/ffsend-$VERSION"
|
|
|
|
cp -- "$DIR/../ffsend" "$DIR/ffsend-$VERSION/ffsend"
|
2018-05-31 09:15:53 +00:00
|
|
|
|
2018-05-31 22:04:13 +00:00
|
|
|
# Create an application tarbal
|
2021-08-25 22:31:38 +00:00
|
|
|
cd -- "$DIR/.."
|
|
|
|
git archive --format tar.gz -o "$DIR/ffsend-$VERSION/ffsend-$VERSION.tar.gz" "$TRAVIS_TAG"
|
2018-05-31 22:04:13 +00:00
|
|
|
|
|
|
|
# Change into the app directory
|
2021-08-25 22:31:38 +00:00
|
|
|
cd -- "$DIR/ffsend-$VERSION"
|
2018-05-31 09:15:53 +00:00
|
|
|
|
|
|
|
# Build the debian package
|
2018-05-31 22:04:13 +00:00
|
|
|
# TODO: define GPG?
|
2021-08-25 22:31:38 +00:00
|
|
|
dh_make -e "timvisee@gmail.com" -c gpl3 -f "ffsend-$VERSION.tar.gz" -s -y
|
|
|
|
rm -- *.ex README.Debian README.source
|
2018-05-31 22:04:13 +00:00
|
|
|
|
|
|
|
# Remove the project tar ball, we're not using it anymore
|
2021-08-25 22:31:38 +00:00
|
|
|
rm -- "$DIR/ffsend-$VERSION/ffsend-$VERSION.tar.gz"
|
2018-05-31 22:04:13 +00:00
|
|
|
|
|
|
|
# TODO: configure the debian/control file
|
|
|
|
# TODO: configure copyright file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# # 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 .
|