File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,12 @@ if [ "X$MD5SUM" == "X" ]; then
69
69
fi
70
70
fi
71
71
72
+ SHA1SUM=$( which sha1sum)
73
+ if [ " X$SHA1SUM " == " X" ]; then
74
+ echo " Error: you need sha1sum installed."
75
+ exit 1
76
+ fi
77
+
72
78
WGET=$( which wget)
73
79
if [ " X$WGET " == " X" ]; then
74
80
WGET=$( which curl)
@@ -543,9 +549,13 @@ function run_get_packages() {
543
549
544
550
url=" URL_$module "
545
551
url=${! url}
552
+
546
553
md5=" MD5_$module "
547
554
md5=${! md5}
548
555
556
+ sha1=" SHA1_$module "
557
+ sha1=${! sha1}
558
+
549
559
if [ ! -d " $BUILD_PATH /$module " ]; then
550
560
try mkdir -p $BUILD_PATH /$module
551
561
fi
@@ -581,6 +591,17 @@ function run_get_packages() {
581
591
error " Module $module have invalid md5, redownload."
582
592
rm $filename
583
593
fi
594
+ elif [ -n " $sha1 " ]; then
595
+ # check if the sha1 is correct
596
+ current_sha1=$( $SHA1SUM $filename | cut -d\ -f1)
597
+ if [ " X$current_sha1 " == " X$sha1 " ]; then
598
+ # correct, no need to download
599
+ do_download=0
600
+ else
601
+ # invalid download, remove the file
602
+ error " Module $module have invalid sha1, redownload."
603
+ rm $filename
604
+ fi
584
605
else
585
606
do_download=0
586
607
fi
You can’t perform that action at this time.
0 commit comments