#!/bin/bash # # Created using the tutorial # https://john-tucker.medium.com/debian-packaging-by-example-118c18f5dbfe And # this confusing one -> https://wiki.debian.org/Packaging/Intro # # Define expected version when running. # # VERSION=0.0.4 ./make-package.sh # cd $(dirname $0) ; CWD=$(pwd) PRGNAM=mirror PROJECT_PATH="$(realpath ./../..)" VERSION="${VERSION:-#VERSION#}" TMP="${TMP:-/tmp/debian}" PKG="$TMP/package-$PRGNAM" OUTPUT="${OUTPUT:-/tmp}" set -e # # Prepare what the debian build tools run on from these files. # rm -fr "$PKG" mkdir -p "$TMP" "$PKG" "$OUTPUT" cd "$TMP" rm -fr "$PRGNAM-$VERSION" cp -R "$PROJECT_PATH" "$PRGNAM-$VERSION" cd "$PRGNAM-$VERSION" cp -r . "$PKG" #cp contrib/debian/Makefile "$PKG" tar -C .. -f "$PKG/${PRGNAM}_${VERSION}.orig.tar.gz" -c "${PRGNAM}-${VERSION}" cp -r contrib/debian/debian "$PKG" sed -i "s/#VERSION#/${VERSION}/g" "$PKG/debian/changelog" # # Make the deliverable using Debian's tools. # cd "$PKG" debuild -b -uc -us mv ../mirror_*.deb "$OUTPUT"