Use z rather than the obsolete Z modifier.
[beanstalkd.git] / pkg.sh
blobba1e858520851e037db197178bafa983caba100a
1 #!/bin/sh -e
3 prog="$1"; shift
4 vers="$1"; shift
5 file="$1"; shift
6 tdir=/tmp/beanstalk-pkg.$$.d
7 pfx="$prog-$vers"
9 cleanup() {
10 rm -rf $tdir
13 trap cleanup EXIT
15 mkdir -p $tdir
17 git-archive --format=tar --prefix="$pfx/" "v$vers" > $tdir/p.tar
19 # Replace version.h with the actual release version.
21 cd $tdir
22 tar --delete -f p.tar "$pfx/version.h" || true
23 mkdir -p "$pfx"
24 cat > "$pfx/version.h" <<END
25 /* version.h - beanstalkd version header */
26 /* This file was generated by pkg.sh */
27 #define VERSION "$vers"
28 END
29 tar rf p.tar "$pfx/version.h"
32 gzip -9 < $tdir/p.tar > "$file"