builddeb
70 lines
| 1.5 KiB
| text/plain
|
TextLexer
/ contrib / builddeb
Augie Fackler
|
r24971 | #!/bin/sh -e | ||
# | ||||
# Build a Mercurial debian package from the current repo | ||||
# | ||||
# Tested on Jessie (stable as of original script authoring.) | ||||
Augie Fackler
|
r24972 | . $(dirname $0)/packagelib.sh | ||
Augie Fackler
|
r24971 | BUILD=1 | ||
Augie Fackler
|
r26108 | DEBVERSION=jessie | ||
Augie Fackler
|
r24971 | while [ "$1" ]; do | ||
case "$1" in | ||||
Augie Fackler
|
r26108 | --release ) | ||
shift | ||||
DEBVERSION="$1" | ||||
shift | ||||
;; | ||||
Augie Fackler
|
r24971 | --prepare ) | ||
shift | ||||
BUILD= | ||||
;; | ||||
--debbuilddir ) | ||||
shift | ||||
DEBBUILDDIR="$1" | ||||
shift | ||||
;; | ||||
* ) | ||||
echo "Invalid parameter $1!" 1>&2 | ||||
exit 1 | ||||
;; | ||||
esac | ||||
done | ||||
Augie Fackler
|
r26108 | DEBBUILDDIR=${OUTPUTDIR:="$PWD/debbuild"} | ||
Augie Fackler
|
r24971 | set -u | ||
rm -rf $DEBBUILDDIR | ||||
mkdir -p $DEBBUILDDIR | ||||
if [ ! -d .hg ]; then | ||||
echo 'You are not inside a Mercurial repository!' 1>&2 | ||||
exit 1 | ||||
fi | ||||
Augie Fackler
|
r24972 | gethgversion | ||
Augie Fackler
|
r24971 | |||
cp -r $PWD/contrib/debian $DEBBUILDDIR/DEBIAN | ||||
chmod -R 0755 $DEBBUILDDIR/DEBIAN | ||||
control=$DEBBUILDDIR/DEBIAN/control | ||||
# This looks like sed -i, but sed -i behaves just differently enough | ||||
# between BSD and GNU sed that I gave up and did the dumb thing. | ||||
sed "s/__VERSION__/$version/" < $control > $control.tmp | ||||
mv $control.tmp $control | ||||
if [ "$BUILD" ]; then | ||||
Augie Fackler
|
r26090 | make PREFIX=$DEBBUILDDIR/usr install | ||
Augie Fackler
|
r24971 | dpkg-deb --build $DEBBUILDDIR | ||
mv $DEBBUILDDIR.deb $DEBBUILDDIR/mercurial-$version-$release.deb | ||||
if [ $? = 0 ]; then | ||||
echo | ||||
echo "Built packages for $version-$release:" | ||||
find $DEBBUILDDIR/ -type f -newer $control | ||||
fi | ||||
else | ||||
echo "Prepared sources for $version-$release $control are in $DEBBUILDDIR - use like:" | ||||
echo "dpkg-deb --build $DEBBUILDDIR" | ||||
fi | ||||