mirror of
https://git.centos.org/centos-git-common.git
synced 2025-02-23 16:22:56 +00:00
Added optional check for sha1sum of downloaded source file
This commit is contained in:
parent
4258078ef3
commit
061172c484
1 changed files with 13 additions and 0 deletions
|
@ -19,6 +19,7 @@ fi
|
|||
#parse command line args
|
||||
BRANCH=''
|
||||
QUIET=''
|
||||
CHECK=0
|
||||
while (($# > 0))
|
||||
do
|
||||
case $1 in
|
||||
|
@ -32,6 +33,11 @@ do
|
|||
surl=$2
|
||||
shift 2
|
||||
;;
|
||||
--check)
|
||||
#verify the sha1sum of the downloaded file
|
||||
CHECK=1
|
||||
shift
|
||||
;;
|
||||
-q)
|
||||
# Be less chatty
|
||||
QUIET='--silent'
|
||||
|
@ -103,5 +109,12 @@ while read -r fsha fname ; do
|
|||
else
|
||||
echo "${fname} exists. skipping"
|
||||
fi
|
||||
if [ ${CHECK} -eq 1 ]; then
|
||||
downsum=$(sha1sum ${fname} | awk '{print $1}')
|
||||
if [ ${fsha} != ${downsum} ]; then
|
||||
rm -f ${fname}
|
||||
echo "failed to download ${fname}" >&2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done < "${meta}"
|
||||
|
|
Loading…
Add table
Reference in a new issue