summaryrefslogtreecommitdiff
path: root/maint/gen-tag-message
blob: f84cb8db0ddba77b1f075f5a318ffa7afd494b4e (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
#!/bin/sh -efu
# Copyright (c) 2017-2020 The strace developers.
# All rights reserved.
#
# SPDX-License-Identifier: LGPL-2.1-or-later

get_commit_id()
{
	git rev-parse --verify "$1^{commit}"
}

id="$(get_commit_id "${1:-@}")"

tmpf=
cleanup()
{
	trap - EXIT
	[ -z "$tmpf" ] ||
		rm -f -- "$tmpf"
	exit "$@"
}

trap 'cleanup $?' EXIT
trap 'cleanup 1' HUP PIPE INT QUIT TERM
tmpf="$(mktemp -t "${0##*/}.XXXXXX")"

git show "$id:NEWS" > "$tmpf"
marker='^Release \([^ ]\+\)$'
vers="$(sed -n "/$marker/ {s/$marker/\\1/p;q}" "$tmpf")"

printf 'Linux-PAM release %s\n\n' "$vers"

sed "0,/$marker/d;/$marker/,\$d" "$tmpf"