You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by rv...@apache.org on 2018/06/25 10:43:10 UTC
svn commit: r1834300 - /jena/dist/chksum
Author: rvesse
Date: Mon Jun 25 10:43:10 2018
New Revision: 1834300
URL: http://svn.apache.org/viewvc?rev=1834300&view=rev
Log:
Use openssl sha -sha512 for systems without a direct sha512sum command and massage the output to match expected format
Modified:
jena/dist/chksum
Modified: jena/dist/chksum
URL: http://svn.apache.org/viewvc/jena/dist/chksum?rev=1834300&r1=1834299&r2=1834300&view=diff
==============================================================================
--- jena/dist/chksum (original)
+++ jena/dist/chksum Mon Jun 25 10:43:10 2018
@@ -1,5 +1,30 @@
#!/bin/bash
+# Check we have an appropriate tool available
+which sha512sum >/dev/null 2>&1
+if [ $? -eq 0 ]; then
+ SUM=chksumDirect
+else
+ which openssl >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ SUM=chksumOpenSSL
+ else
+ echo "No suitable SHA512 sum command available"
+ exit 1
+ fi
+fi
+
+function chksumDirect() {
+ local F="$1"
+ sha512sum $F | sed -e 's![^ ]*/!!' > "$F.sha512"
+}
+
+function chksumOpenSSL() {
+ local F="$1"
+ local SUM=$(openssl sha -sha512 $F | awk '{print $2}')
+ echo "$SUM $F" > "$F.sha512"
+}
+
function chksum() {
local F="$1"
if [[ ! -e $F ]]
@@ -9,8 +34,8 @@ function chksum() {
fi
if [[ ! -e "$F.sha512" ]]
then
- ## Basename only
- sha512sum $F | sed -e 's![^ ]*/!!' > "$F.sha512"
+ ## Baseman only
+ $SUM $F
else
true
echo "Checksum already exists: $F"