aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaire Robinson <claire@mageia.org>2016-03-12 16:44:05 +0000
committerClaire Robinson <claire@mageia.org>2016-03-12 16:44:05 +0000
commit0af73deb4c5aac4140bf1494c7a5bee57aa70bcc (patch)
tree1dfc2786cfc6a9ba5d05801a4748cf01b4cb72f1
parent6bebdd0334ffdb84974cbc9eebf647fe3cd02f21 (diff)
Add sha512sum checks and reporting
-rw-r--r--dorsync48
1 files changed, 45 insertions, 3 deletions
diff --git a/dorsync b/dorsync
index f537881..097a1e9 100644
--- a/dorsync
+++ b/dorsync
@@ -116,19 +116,40 @@ do
sha1sum -c --quiet --status *.sha1 2>/dev/null
OUT=$?
if [ $OUT -eq 0 ];then
- echo -e "SHA1: ${green}OK${endcolour}"
+ echo -e "SHA1: ${green}OK${endcolour} \c"
sha1ok[$i]=true
missingsha1[$i]=false
else
- echo -e "SHA1: ${red}Failed${endcolour}"
+ echo -e "SHA1: ${red}Failed${endcolour} \c"
sha1ok[$i]=false
missingsha1[$i]=false
fi
else
- echo -e "SHA1: ${red}Missing${endcolour}"
+ echo -e "SHA1: ${red}Missing${endcolour} \c"
sha1ok[$i]=false
missingsha1[$i]=true
fi
+
+ # Check for sha512 file and then sha512sum it or warn if missing
+ if [ -e ${iso[$i]}.sha512 ]
+ then
+ sha512sum -c --quiet --status *.sha512 2>/dev/null
+ OUT=$?
+ if [ $OUT -eq 0 ];then
+ echo -e "SHA512: ${green}OK${endcolour}"
+ sha512ok[$i]=true
+ missingsha512[$i]=false
+ else
+ echo -e "SHA512: ${red}Failed${endcolour}"
+ sha512ok[$i]=false
+ missingsha512[$i]=false
+ fi
+ else
+ echo -e "SHA512: ${red}Missing${endcolour}"
+ sha512ok[$i]=false
+ missingsha512[$i]=true
+ fi
+
echo ""
cd "$location"
(( i++ ))
@@ -192,6 +213,27 @@ do
(( warnings++ ))
fi
fi
+ # Warn of missing sha512 files
+ if [ ${missingsha512[$i]} = true ]
+ then
+ if [ $warnings = 0 ]
+ then
+ echo -e $startwarning
+ fi
+ echo "${directory[$i]}/${iso[$i]}.sha512 missing"
+ (( warnings++ ))
+ else
+ # Warn of bad sha512sum if present
+ if [ ${sha512ok[$i]} = false ]
+ then
+ if [ $warnings = 0 ]
+ then
+ echo -e $startwarning
+ fi
+ echo "${iso[$i]} sha512sum failed"
+ (( warnings++ ))
+ fi
+ fi
done
echo ""
# If anything failed, provide a count