mirror

Mirror free and open-source projects you like with minimal effort
git clone git://git.server.ky/slackcoder/mirror
Log | Files | Refs | README

make-package.sh (1009B)


      1 #!/bin/bash
      2 #
      3 # Created using the tutorial
      4 # https://john-tucker.medium.com/debian-packaging-by-example-118c18f5dbfe And
      5 # this confusing one -> https://wiki.debian.org/Packaging/Intro
      6 #
      7 # Define expected version when running.
      8 #
      9 # VERSION=0.0.4 ./make-package.sh
     10 #
     11 
     12 cd $(dirname $0) ; CWD=$(pwd)
     13 
     14 PRGNAM=mirror
     15 PROJECT_PATH="$(realpath ./../..)"
     16 VERSION="${VERSION:-#VERSION#}"
     17 
     18 TMP="${TMP:-/tmp/debian}"
     19 PKG="$TMP/package-$PRGNAM"
     20 OUTPUT="${OUTPUT:-/tmp}"
     21 
     22 set -e
     23 
     24 #
     25 # Prepare what the debian build tools run on from these files.
     26 #
     27 rm -fr "$PKG"
     28 mkdir -p "$TMP" "$PKG" "$OUTPUT"
     29 cd "$TMP"
     30 rm -fr "$PRGNAM-$VERSION"
     31 cp -R "$PROJECT_PATH" "$PRGNAM-$VERSION"
     32 cd "$PRGNAM-$VERSION"
     33 cp -r . "$PKG"
     34 #cp contrib/debian/Makefile "$PKG"
     35 tar -C .. -f "$PKG/${PRGNAM}_${VERSION}.orig.tar.gz" -c "${PRGNAM}-${VERSION}"
     36 cp -r contrib/debian/debian "$PKG"
     37 sed -i "s/#VERSION#/${VERSION}/g" "$PKG/debian/changelog"
     38 
     39 #
     40 # Make the deliverable using Debian's tools.
     41 #
     42 cd "$PKG"
     43 debuild -b -uc -us
     44 mv ../mirror_*.deb "$OUTPUT"