[LEDE-DEV] [PATCH 1/2] scripts/download.pl: Add a --skip-hash option

Baptiste Jonglez git at bitsofnetworks.org
Thu Oct 26 02:50:58 PDT 2017


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 <git at 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;
 
- at ARGV > 2 or die "Syntax: $0 <target dir> <filename> <hash> <url filename> [<mirror> ...]\n";
+ at 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




More information about the Lede-dev mailing list