diff options
| author | Holger Weiss <holger@zedat.fu-berlin.de> | 2014-12-15 22:35:02 +0100 |
|---|---|---|
| committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2014-12-15 22:35:02 +0100 |
| commit | 0a236c7c70a5d3b9f921338fca8ea67196a05c12 (patch) | |
| tree | 292b3a01f37f09f8e4022f7af1f079439e80ca46 /tools/update-thanks | |
| parent | 8235fd0aef2945e0d638fba3493134588d085d5a (diff) | |
| download | monitoring-plugins-0a236c7c70a5d3b9f921338fca8ea67196a05c12.tar.gz | |
Add tools/update-thanks script
The tools/update-thanks script can be used to update the THANKS.in file.
Diffstat (limited to 'tools/update-thanks')
| -rwxr-xr-x | tools/update-thanks | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/tools/update-thanks b/tools/update-thanks new file mode 100755 index 00000000..27932f94 --- /dev/null +++ b/tools/update-thanks | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # Copyright (c) 2014 Monitoring Plugins Development Team | ||
| 4 | # | ||
| 5 | # Originally written by Holger Weiss <holger@zedat.fu-berlin.de>. | ||
| 6 | # | ||
| 7 | # This file is free software; the Monitoring Plugins Development Team gives | ||
| 8 | # unlimited permission to copy and/or distribute it, with or without | ||
| 9 | # modifications, as long as this notice is preserved. | ||
| 10 | # | ||
| 11 | # This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | # ANY WARRANTY, to the extent permitted by law; without even the implied | ||
| 13 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 14 | |||
| 15 | set -e | ||
| 16 | set -u | ||
| 17 | |||
| 18 | tempfile=$(mktemp '/tmp/.plugins.XXXXXX') | ||
| 19 | trap 'rm -f $tempfile' EXIT INT TERM | ||
| 20 | |||
| 21 | if [ ! -e THANKS.in ] | ||
| 22 | then | ||
| 23 | echo >&2 'Please change into the "monitoring-plugins" repository.' | ||
| 24 | exit 2 | ||
| 25 | fi | ||
| 26 | |||
| 27 | case $# in | ||
| 28 | 1) since=$1; git cat-file -e "$since";; | ||
| 29 | 0) since=$(git tag -l 'v*' | tail -n 1);; | ||
| 30 | *) echo >&2 "Usage: $0 [<since>]"; exit 2;; | ||
| 31 | esac | ||
| 32 | |||
| 33 | git log --pretty='%an' "$since.." | sort -u | while read first last rest | ||
| 34 | do | ||
| 35 | if [ -n "$first" -a -n "$last" -a -z "$rest" ] | ||
| 36 | then | ||
| 37 | if ! grep -q "^$first $last$" AUTHORS THANKS.in | ||
| 38 | then | ||
| 39 | echo "$first $last" >> THANKS.in | ||
| 40 | fi | ||
| 41 | else | ||
| 42 | echo "$first $last $rest" | sed 's/ *$//' >> "$tempfile" | ||
| 43 | fi | ||
| 44 | done | ||
| 45 | |||
| 46 | if ! git diff --quiet THANKS.in | ||
| 47 | then | ||
| 48 | echo 'Please check/commit the changes in the THANKS.in file.' | ||
| 49 | fi | ||
| 50 | |||
| 51 | if [ -s "$tempfile" ] | ||
| 52 | then | ||
| 53 | echo 'The following authors were NOT added to the THANKS.in file:' | ||
| 54 | echo | ||
| 55 | cat "$tempfile" | ||
| 56 | fi | ||
