Show More
@@ -1,62 +1,63 b'' | |||||
1 | #!/bin/sh -e |
|
1 | #!/bin/sh -e | |
2 | # |
|
2 | # | |
3 | # Build a Mercurial debian package from the current repo |
|
3 | # Build a Mercurial debian package from the current repo | |
4 | # |
|
4 | # | |
5 | # Tested on Jessie (stable as of original script authoring.) |
|
5 | # Tested on Jessie (stable as of original script authoring.) | |
6 |
|
6 | |||
7 | . $(dirname $0)/packagelib.sh |
|
7 | . $(dirname $0)/packagelib.sh | |
8 |
|
8 | |||
9 | BUILD=1 |
|
9 | BUILD=1 | |
10 | DEBBUILDDIR="$PWD/debbuild" |
|
10 | DEBBUILDDIR="$PWD/debbuild" | |
11 | while [ "$1" ]; do |
|
11 | while [ "$1" ]; do | |
12 | case "$1" in |
|
12 | case "$1" in | |
13 | --prepare ) |
|
13 | --prepare ) | |
14 | shift |
|
14 | shift | |
15 | BUILD= |
|
15 | BUILD= | |
16 | ;; |
|
16 | ;; | |
17 | --debbuilddir ) |
|
17 | --debbuilddir ) | |
18 | shift |
|
18 | shift | |
19 | DEBBUILDDIR="$1" |
|
19 | DEBBUILDDIR="$1" | |
20 | shift |
|
20 | shift | |
21 | ;; |
|
21 | ;; | |
22 | * ) |
|
22 | * ) | |
23 | echo "Invalid parameter $1!" 1>&2 |
|
23 | echo "Invalid parameter $1!" 1>&2 | |
24 | exit 1 |
|
24 | exit 1 | |
25 | ;; |
|
25 | ;; | |
26 | esac |
|
26 | esac | |
27 | done |
|
27 | done | |
28 |
|
28 | |||
29 | set -u |
|
29 | set -u | |
30 |
|
30 | |||
31 | rm -rf $DEBBUILDDIR |
|
31 | rm -rf $DEBBUILDDIR | |
32 | mkdir -p $DEBBUILDDIR |
|
32 | mkdir -p $DEBBUILDDIR | |
33 |
|
33 | |||
34 | if [ ! -d .hg ]; then |
|
34 | if [ ! -d .hg ]; then | |
35 | echo 'You are not inside a Mercurial repository!' 1>&2 |
|
35 | echo 'You are not inside a Mercurial repository!' 1>&2 | |
36 | exit 1 |
|
36 | exit 1 | |
37 | fi |
|
37 | fi | |
38 |
|
38 | |||
39 | gethgversion |
|
39 | gethgversion | |
40 |
|
40 | |||
41 | cp -r $PWD/contrib/debian $DEBBUILDDIR/DEBIAN |
|
41 | cp -r $PWD/contrib/debian $DEBBUILDDIR/DEBIAN | |
42 | chmod -R 0755 $DEBBUILDDIR/DEBIAN |
|
42 | chmod -R 0755 $DEBBUILDDIR/DEBIAN | |
43 |
|
43 | |||
44 | control=$DEBBUILDDIR/DEBIAN/control |
|
44 | control=$DEBBUILDDIR/DEBIAN/control | |
45 |
|
45 | |||
46 | # This looks like sed -i, but sed -i behaves just differently enough |
|
46 | # This looks like sed -i, but sed -i behaves just differently enough | |
47 | # between BSD and GNU sed that I gave up and did the dumb thing. |
|
47 | # between BSD and GNU sed that I gave up and did the dumb thing. | |
48 | sed "s/__VERSION__/$version/" < $control > $control.tmp |
|
48 | sed "s/__VERSION__/$version/" < $control > $control.tmp | |
49 | mv $control.tmp $control |
|
49 | mv $control.tmp $control | |
50 |
|
50 | |||
51 | if [ "$BUILD" ]; then |
|
51 | if [ "$BUILD" ]; then | |
|
52 | make PREFIX=$DEBBUILDDIR/usr install | |||
52 | dpkg-deb --build $DEBBUILDDIR |
|
53 | dpkg-deb --build $DEBBUILDDIR | |
53 | mv $DEBBUILDDIR.deb $DEBBUILDDIR/mercurial-$version-$release.deb |
|
54 | mv $DEBBUILDDIR.deb $DEBBUILDDIR/mercurial-$version-$release.deb | |
54 | if [ $? = 0 ]; then |
|
55 | if [ $? = 0 ]; then | |
55 | echo |
|
56 | echo | |
56 | echo "Built packages for $version-$release:" |
|
57 | echo "Built packages for $version-$release:" | |
57 | find $DEBBUILDDIR/ -type f -newer $control |
|
58 | find $DEBBUILDDIR/ -type f -newer $control | |
58 | fi |
|
59 | fi | |
59 | else |
|
60 | else | |
60 | echo "Prepared sources for $version-$release $control are in $DEBBUILDDIR - use like:" |
|
61 | echo "Prepared sources for $version-$release $control are in $DEBBUILDDIR - use like:" | |
61 | echo "dpkg-deb --build $DEBBUILDDIR" |
|
62 | echo "dpkg-deb --build $DEBBUILDDIR" | |
62 | fi |
|
63 | fi |
General Comments 0
You need to be logged in to leave comments.
Login now