support/download: make hash file optional
authorYann E. MORIN <yann.morin.1998@free.fr>
Tue, 31 Mar 2015 22:15:01 +0000 (00:15 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Fri, 3 Apr 2015 12:08:00 +0000 (14:08 +0200)
Currently, specifying a hash file for our download wrapper is mandatory.

However, when we download a git, svn, bzr, hg or cvs tree, there's by
design no hash to check the download against.

Since we're going to have hash checking mandatory when a hash file
exists, this would break those downloads from a repository.

So, make specifying a hash file optional when calling our download
wrapper and bail out early from the check-hash script if no hash file is
specified.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
support/download/check-hash
support/download/dl-wrapper

index 4c07274cc91cd6a9f42546885db2874fbb82bb17..cee64ef310fbb91c35c96c90d96d14a7585a52c9 100755 (executable)
@@ -23,7 +23,7 @@ file="${2}"
 base="${3}"
 
 # Does the hash-file exist?
-if [ ! -f "${h_file}" ]; then
+if [ -z "${h_file}" -o ! -f "${h_file}" ]; then
     exit 0
 fi
 
index 3b30840a0c84bfca1be05ef1810e51222b56d853..514118c57f62e1b14f440aee6bb81dec5f1ce3e0 100755 (executable)
@@ -44,9 +44,6 @@ main() {
     if [ -z "${output}" ]; then
         error "no output specified, use -o\n"
     fi
-    if [ -z "${hfile}" ]; then
-        error "no hash-file specified, use -H\n"
-    fi
 
     # If the output file already exists, do not download it again
     if [ -e "${output}" ]; then