--- /dev/null
+#!/bin/sh -e
+
+NEWDIR=./qmail
+
+cat <<-'!END!'
+
+ This script unpacks the qmail source in /usr/src/qmail-src
+ into a directory, and compiles it to produce a binary qmail*.deb file
+ The directory where this is done will end up containing the
+ source and package files for the qmail binary package, along
+ with a directory containing the unpacked source.
+
+ !END!
+
+echo -n "Where would you like to do this [$NEWDIR] "
+read line
+
+NEWDIR="${line:-$NEWDIR}"
+
+if test -d $NEWDIR
+then
+ echo -n "'$NEWDIR' already exists, should I use it anyway ? [yN] "
+ read yn
+ test "$yn" = y -o "$yn" = Y || exit 1
+else
+ mkdir $NEWDIR
+fi
+
+cd $NEWDIR
+dpkg-source -x /usr/src/qmail-src/qmail_*.dsc
+cd qmail-*
+
+BECOMEROOT=fakeroot
+cat <<-'!END!'
+
+ For some reason fakeroot causes install to hang on my system, so I'm
+ giving you the option of running sudo or fakeroot. Give fakeroot a try
+ but if it does not work use sudo instead.
+
+ !END!
+echo -n "Should I use sudo or fakeroot to build the package ? [sF] "
+read yn
+test "$yn" = s -o "$yn" = S && BECOMEROOT=sudo
+
+dpkg-buildpackage -us -uc -r$BECOMEROOT