#! /bin/sh umask 022 VERSION=`cat version.txt` # Make sure to run the script as unprivileged user if [ "X$LOGNAME" = "Xroot" ] then echo 'ERROR: This script must not be run as root!' exit 1 fi # Make sure we are in the correct directory if [ "X$VERSION" = "X" ] then echo 'ERROR: Failed to find version number!' echo 'Make sure to call this script in the correct directory!' exit 1 fi # Make sure the original archive is still in the parent directory if [ ! -f ../dktools-${VERSION}.tar.gz ] then echo 'ERROR: File' ../dktools-${VERSION}.tar.gz 'not found!' exit 1 fi # Create a .orig copy of the original archive if [ -f ../dktools_${VERSION}.orig.tar.gz ] then rm -f ../dktools_${VERSION}.orig.tar.gz fi ln ../dktools-${VERSION}.tar.gz ../dktools_${VERSION}.orig.tar.gz # The 'debian' subdirectory must be present if [ ! -d debian ] then echo 'ERROR: Missing directory debian!' exit 1 fi # Build the package, save output for later inspection if [ "X$DEB_SIGN_KEYID" != "X" ] then dpkg-buildpackage 2>&1 | tee ../dpkg-buildpackage.out else dpkg-buildpackage -us -uc 2>&1 | tee ../dpkg-buildpackage.out fi # Finally list the created packages and show some notes echo 'If the dpkg-buildpackage command succeeded, you should find the' echo '*.deb archive in the parent directory.' echo '' ls -l ../dktools*${VERSION}*.deb echo '' echo 'Otherwise you should inspect the ../dpkg-buildpackage.out file' echo 'for error messages.' echo '' exit 0