When the new "--skip-hash" option is passed to scripts/download.pl, hash
verification of the downloaded files is completely skipped.  This can be
useful when bumping package version, since the hash may not be known in
advance.

Signed-off-by: Baptiste Jonglez <g...@bitsofnetworks.org>
---
 scripts/download.pl | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/scripts/download.pl b/scripts/download.pl
index 775408934a..e0bf187559 100755
--- a/scripts/download.pl
+++ b/scripts/download.pl
@@ -13,9 +13,11 @@ use File::Basename;
 use File::Copy;
 use Text::ParseWords;
 
-@ARGV > 2 or die "Syntax: $0 <target dir> <filename> <hash> <url filename> 
[<mirror> ...]\n";
+@ARGV > 2 or die "Syntax: $0 [--skip-hash] <target dir> <filename> <hash> <url 
filename> [<mirror> ...]\n";
 
 my $url_filename;
+my $skip_hash = 0;
+$skip_hash = shift @ARGV if $ARGV[0] eq "--skip-hash";
 my $target = glob(shift @ARGV);
 my $filename = shift @ARGV;
 my $file_hash = shift @ARGV;
@@ -87,8 +89,13 @@ sub download_cmd($) {
        ;
 }
 
-my $hash_cmd = hash_cmd();
-$hash_cmd or die "Cannot find appropriate hash command, ensure the provided 
hash is either a MD5 or SHA256 checksum.\n";
+my $hash_cmd;
+if ($skip_hash) {
+       print("Warning: skipping hash verification as requested.\n");
+} else {
+       $hash_cmd = hash_cmd();
+       $hash_cmd or die "Cannot find appropriate hash command, ensure the 
provided hash is either a MD5 or SHA256 checksum.\n";
+}
 
 sub download
 {
-- 
2.11.0


_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to