4
0

update-thanks 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/sh
  2. # Copyright (c) 2014 Monitoring Plugins Development Team
  3. #
  4. # Originally written by Holger Weiss <holger@zedat.fu-berlin.de>.
  5. #
  6. # This file is free software; the Monitoring Plugins Development Team gives
  7. # unlimited permission to copy and/or distribute it, with or without
  8. # modifications, as long as this notice is preserved.
  9. #
  10. # This program is distributed in the hope that it will be useful, but WITHOUT
  11. # ANY WARRANTY, to the extent permitted by law; without even the implied
  12. # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. set -e
  14. set -u
  15. tempfile=$(mktemp '/tmp/.plugins.XXXXXX')
  16. trap 'rm -f $tempfile' EXIT INT TERM
  17. if [ ! -e THANKS.in ]
  18. then
  19. echo >&2 'Please change into the "monitoring-plugins" repository.'
  20. exit 2
  21. fi
  22. case $# in
  23. 1) since=$1; git cat-file -e "$since";;
  24. 0) since=$(git tag -l 'v*' | tail -n 1);;
  25. *) echo >&2 "Usage: $0 [<since>]"; exit 2;;
  26. esac
  27. git log --pretty='%an' "$since.." | sort -u | while read first last rest
  28. do
  29. if [ -n "$first" -a -n "$last" -a -z "$rest" ]
  30. then
  31. if ! grep -q -i "^$first $last$" AUTHORS THANKS.in
  32. then
  33. echo "$first $last" >> THANKS.in
  34. fi
  35. else
  36. echo "$first $last $rest" | sed 's/ *$//' >> "$tempfile"
  37. fi
  38. done
  39. if ! git diff --quiet THANKS.in
  40. then
  41. echo 'Please check/commit the changes in the THANKS.in file.'
  42. fi
  43. if [ -s "$tempfile" ]
  44. then
  45. echo 'The following authors were NOT added to the THANKS.in file:'
  46. echo
  47. cat "$tempfile"
  48. fi