summaryrefslogtreecommitdiff
path: root/release.sh
blob: 447246930963aed107bdc2f55ea0cad872be650f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh -xe
# 
# Script for generating a release
#

PACKAGE=tftp-hpa

if [ -z "$1" ]; then
  echo "Usage: $0 release-id" 1>&2
  exit 1
fi

release="$1"
releasetag=$PACKAGE-$release
releasedir=$PACKAGE-$release

GIT_DIR=`cd "${GIT_DIR-.git}" && pwd`
export GIT_DIR

if [ x"$release" = x'test' ]; then
  release=`cat version`
  releasetag=HEAD
  releasedir=$PACKAGE-$release
else
  echo $release > version.new
  if ! cmp -s version version.new ; then
    mv -f version.new version
    cg-commit -m 'Update version for release' version
  else
    rm -f version.new
  fi
  rm -f "$GIT_DIR"/refs/tags/$releasetag
  cg-tag $releasetag
fi

here=`pwd`

tmpdir=/var/tmp/release.$$
rm -rf $tmpdir
mkdir -p $tmpdir
cd $tmpdir
cg-export -r $releasetag $releasedir
cd $releasedir
make release
rm -f release.sh
cd ..
tar cvvf $releasedir.tar $releasedir
gzip -9 $releasedir.tar
mv -f $releasedir.tar.gz $here/..
cd ..
rm -rf $tmpdir