updated on Sun Jan 15 04:04:02 UTC 2012
[aur-mirror.git] / checksums / checksums.sh
blob061a9cfd5eb6c32a5e1c83daef4605c491f0627d
1 #!/bin/sh
2 # Checksums v0.4
3 #
4 # For original author please refer to:
5 # http://kde-look.org/content/show.php/KonqCheckSum?content=83460
7 md5=`md5sum $1 | awk '{ print $1;}'`
8 sha1=`sha1sum $1 | awk '{ print $1;}'`
9 sha256=`sha256sum $1 | awk '{ print $1;}'`
10 ERROR=0
11 N=3
13 if [ -f $1.md5 ]; then
14 refmd5=`cat $1.md5 | awk '{ print $1;}'`
15 if [ "$md5" != "$refmd5" ]; then
16 kdialog --icon=security-low.png --sorry "md5 doesn't match!"
17 ERROR=1
19 else
20 let N=$N-1
23 if [ -f $1.sha1 ]; then
24 refsha1=`cat $1.sha1 | awk '{ print $1;}'`
25 if [ "$sha1" != "$refsha1" ]; then
26 kdialog --icon=security-low.png --sorry "sha1 doesn't match!"
27 ERROR=1
29 else
30 let N=$N-1
33 if [ -f $1.sha256 ]; then
34 refsha256=`cat $1.sha256 | awk '{ print $1;}'`
35 if [ "$sha256" != "$refsha256" ]; then
36 kdialog --icon=security-low.png --sorry "sha256 doesn't match!"
37 ERROR=1
39 else
40 let N=$N-1
43 if [ $N = 0 ]; then
44 kdialog --icon=security-medium --error "No checksum files exist for this file."
45 ERROR=1
48 if [ $ERROR = 0 ]; then
49 kdialog --icon=security-high --msgbox "Checksums match."