diff options
Diffstat (limited to 'bin/create-checksum')
-rwxr-xr-x | bin/create-checksum | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/bin/create-checksum b/bin/create-checksum new file mode 100755 index 0000000..7d6ac1f --- /dev/null +++ b/bin/create-checksum | |||
@@ -0,0 +1,36 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # Copyright (c) 2013 Nagios Plugins Development Team | ||
4 | # | ||
5 | # Originally written by Holger Weiss <holger@zedat.fu-berlin.de>. | ||
6 | # | ||
7 | # This file is free software; the Nagios 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 -u | ||
16 | |||
17 | export PATH='/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' | ||
18 | |||
19 | create_checksum() | ||
20 | { | ||
21 | tarball=$1 | ||
22 | |||
23 | shasum -a 1 -b "$tarball" >"$tarball.sha1" | ||
24 | touch --date="$(stat --format='%y' "$tarball")" "$tarball.sha1" | ||
25 | } | ||
26 | |||
27 | if [ $# -eq 1 ] && [ "x$1" = 'x-h' -o "x$1" = 'x--help' ] | ||
28 | then | ||
29 | echo "Usage: $myself [branch ...]" | ||
30 | exit 0 | ||
31 | fi | ||
32 | |||
33 | for tarball in "$@" | ||
34 | do | ||
35 | create_checksum "$tarball" | ||
36 | done | ||