-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·57 lines (49 loc) · 1.07 KB
/
release.sh
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
52
53
54
55
56
57
#!/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 [ `git diff --cached | wc -l` -ne 0 ]; then
echo "$0: index not clean" 1>&2
exit 1
fi
if [ x"$release" = x'test' ]; then
release=`cat version`
releasetag=HEAD
releasedir=$PACKAGE-$release
else
echo $release > version
if [ `git diff version | wc -l` -ne 0 ]; then
git add version
git commit -m "Update version for release $release" version
else
git checkout version
fi
rm -f "$GIT_DIR"/refs/tags/$releasetag
git tag -a -m "$releasetag" -f "$releasetag"
fi
here=`pwd`
tmpdir=/var/tmp/release.$$
rm -rf $tmpdir
mkdir -p $tmpdir
cd $tmpdir
mkdir -p $releasedir
git archive --format=tar $releasetag | tar -xf - -C $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