backup-utils/script/package-deb

43 строки
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Usage: script/package-deb
# Script to build a deb release package from the current HEAD version.
# The package version comes from the debian/changelog file so that should
# be edited before running this.
set -e
# Change into project root
cd "$(dirname "$0")"/..
# Fetch tags from remote repository
git fetch --tags
# Basic package name and version.
PKG_BASE="github-backup-utils"
PKG_VERS="$(git describe --tags)"
PKG_NAME="${PKG_BASE}-${PKG_VERS}"
PKG_HEAD="$(git rev-parse HEAD)"
# Run git-archive to generate tarball
rm -rf dist/debuild
trap "rm -rf dist/debuild" EXIT
mkdir -p dist/debuild
distdir="$(pwd)/dist/debuild/$PKG_NAME"
git clone -q . "$distdir"
cd "$distdir"
echo "Removing files listed in .releaseignore ..."
while IFS= read -r line; do
rm -rf "$line"
done < .releaseignore
echo "Removing .releaseignore ..."
rm -f .releaseignore
git checkout -q "$PKG_HEAD"
debuild -uc -us 1>&2
cd ..
files=$(ls -1 *.deb *.tar.xz *.dsc *.changes)
mv $files ../
for f in $files; do echo "dist/$f"; done