diff options
author | Andrei Belov <defan@nginx.com> | 2020-02-06 18:25:25 +0300 |
---|---|---|
committer | Andrei Belov <defan@nginx.com> | 2020-02-06 18:25:25 +0300 |
commit | 2dc01938cf02cc05b41a09e618f712129c4cdf91 (patch) | |
tree | 556dd40a0ec8c194774d53eed9ff62ed1d25ee7c /auto/modules/java_chk_sha512 | |
parent | 477a58e14010ab14d6ab453860b360cf806f5012 (diff) | |
parent | 6e19090736612b39d4c5d0836d7df0722b8955e7 (diff) | |
download | unit-2dc01938cf02cc05b41a09e618f712129c4cdf91.tar.gz unit-2dc01938cf02cc05b41a09e618f712129c4cdf91.tar.bz2 |
Merged with the default branch.1.15.0-1
Diffstat (limited to 'auto/modules/java_chk_sha512')
-rw-r--r-- | auto/modules/java_chk_sha512 | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/auto/modules/java_chk_sha512 b/auto/modules/java_chk_sha512 new file mode 100644 index 00000000..10891cee --- /dev/null +++ b/auto/modules/java_chk_sha512 @@ -0,0 +1,49 @@ + +# Copyright (C) NGINX, Inc. + +# NXT_JAR_FILE= +# NXT_JAR_CHK_FILE= + +NXT_SHA512_TOOL=${NXT_SHA512_TOOL=} + +if [ -z "$NXT_SHA512_TOOL" ]; then + $echo -n "looking for sha512 check tool ..." + $echo "looking for sha512 check tool ..." >> $NXT_AUTOCONF_ERR + + if sha512sum --version >/dev/null 2>&1; then + NXT_SHA512_TOOL="sha512sum --check" + else + if shasum --version >/dev/null 2>&1; then + NXT_SHA512_TOOL="shasum -a 512 --check" + else + if openssl version >/dev/null 2>&1; then + NXT_SHA512_TOOL="openssl dgst -sha512" + fi + fi + fi + + if [ -z "$NXT_SHA512_TOOL" ]; then + $echo " not found" + $echo + $echo $0: error: no sha512 tool found. + $echo + $echo "error: no sha512 tool found" >> $NXT_AUTOCONF_ERR + exit 1 + fi + + $echo " $NXT_SHA512_TOOL" + $echo "found $NXT_SHA512_TOOL" >> $NXT_AUTOCONF_ERR +fi + +if [ -f "$NXT_JAR_CHK_FILE" ]; then + NXT_JAR_SHA512=`grep -F $NXT_JAR_FILE auto/modules/java_jar.sha512 | head -c 128` + NXT_JAR_CHK=${NXT_JAR_CHK_FILE}.sha512.$$ + $echo "$NXT_JAR_SHA512 $NXT_JAR_CHK_FILE" > $NXT_JAR_CHK + + if ! $NXT_SHA512_TOOL $NXT_JAR_CHK >/dev/null 2>&1; then + $echo "SHA512 not matched for $NXT_JAR_FILE, removing $NXT_JAR_CHK_FILE" + rm -f $NXT_JAR_CHK_FILE + fi + + rm -f $NXT_JAR_CHK +fi |