diff options
author | Claire Robinson <claire@mageia.org> | 2016-03-12 16:44:05 +0000 |
---|---|---|
committer | Claire Robinson <claire@mageia.org> | 2016-03-12 16:44:05 +0000 |
commit | 0af73deb4c5aac4140bf1494c7a5bee57aa70bcc (patch) | |
tree | 1dfc2786cfc6a9ba5d05801a4748cf01b4cb72f1 | |
parent | 6bebdd0334ffdb84974cbc9eebf647fe3cd02f21 (diff) | |
download | dorsync-0af73deb4c5aac4140bf1494c7a5bee57aa70bcc.tar dorsync-0af73deb4c5aac4140bf1494c7a5bee57aa70bcc.tar.gz dorsync-0af73deb4c5aac4140bf1494c7a5bee57aa70bcc.tar.bz2 dorsync-0af73deb4c5aac4140bf1494c7a5bee57aa70bcc.tar.xz dorsync-0af73deb4c5aac4140bf1494c7a5bee57aa70bcc.zip |
Add sha512sum checks and reporting
-rw-r--r-- | dorsync | 48 |
1 files changed, 45 insertions, 3 deletions
@@ -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 |