summaryrefslogtreecommitdiffstats
path: root/packaging/release-msg
blob: 01ec381489f392c18e87f004349eaae32d9350aa (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
52
53
54
55
56
57
58
59
#!/bin/bash

#
# release-msg
#
scriptname=release-msg
if ! MYTMP=$(mktemp -d -t $scriptname-XXXXXX)
then
            echo >&2
            echo >&2
            echo >&2 "Cannot create temporary directory."
            echo >&2
            exit 1
fi

cleanup() {
  status=$?
  rm -rf "${MYTMP}"
  exit $status
}

# clean up if we get stopped by Crtl-C or forced logout or normal exit
trap cleanup INT
trap cleanup HUP
trap cleanup 0

set -e
if [ "$1" = "--debug" ]
then
  set -x
  shift
fi

if [ $# -lt 1 ]
then
  echo "Use only from .git/hooks/prepare-commit-msg"
  exit 1
fi

if [ ! -x packaging/release-msg ]
then
  echo "Must be run from base directory"
  exit 1
fi

dirname="${0%/*}"
if [ "$dirname" = "$0" ]; then dirname="."; fi
source $dirname/packaging.functions

mkdir -p $MYTMP/files
git show :configure.ac > $MYTMP/files/configure.ac
version=`get_configure_ac_version`
case "$(match_version $version)" in
  prerelease|candidate|release)
    sed -i -e "1s/.*/Prepare release $version/" "$1"
  ;;
esac

exit 0