• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2
3proj="iperf"
4
5if [ "x$2" != "x" ]; then
6tag=$2
7else
8tag=`awk '/IPERF_VERSION / {
9  gsub(/"/, "", $3);
10  print $3 }' src/version.h`
11fi
12
13dirname=`echo $tag $proj | awk '{
14  gsub(/-ALPHA/, "a", $1);
15  gsub(/-BETA/, "b", $1);
16  gsub(/-RELEASE/, "", $1);
17  print $2"-"$1 }'`
18
19# echo tag $tag
20# echo dirname $dirname
21
22do_tag ()
23{
24    git tag -s -m "tagging $tag" $tag
25}
26
27do_tar ()
28{
29    tarball=${dirname}.tar.gz
30    rm -f ${tarball}
31    git archive --format=tar --prefix ${dirname}/ ${tag} | gzip -9 > ${tarball}
32
33    # Compute SHA256 hash
34    case `uname -s` in
35	FreeBSD) sha=sha256 ;;
36	Linux) sha=sha256sum ;;
37	Darwin) sha="shasum -a 256" ;;
38	*) sha=echo ;;
39    esac
40    ${sha} ${tarball} | tee ${tarball}.sha256
41}
42
43usage ()
44{
45    cat <<EOF
46$0: tag|tar
47
48   tag  -- create a tag
49   tar  -- create a tarball from a tag
50
51General use is to do:
52
53./$0 tag
54./$0 tar
55
56An optional argument may be specified to both the tag and tar
57subcommands to explicitly specify a tag string.  If not specified, the
58contents of src/version.h are used.
59
60EOF
61}
62
63case $1 in
64    tag) do_tag ;;
65    tar) do_tar ;;
66    *) echo "unknown command: $1"; usage ;;
67esac
68
69exit
70