download.pl: properly cleanup intermediate .hash file
[openwrt/staging/thess.git] / scripts / download.pl
index 2d87f47f842bc7d2b9ccc70f43f1f504e1c8c798..84d10dbe5f9daea410c33677ef8cb3b90160f3ae 100755 (executable)
@@ -272,11 +272,11 @@ if (-f "$target/$filename") {
                $sum =~ /^(\w+)\s*/ or die "Could not generate file hash\n";
                $sum = $1;
 
+               cleanup();
                exit 0 if $sum eq $file_hash;
 
                die "Hash of the local file $filename does not match (file: $sum, requested: $file_hash) - deleting download.\n";
                unlink "$target/$filename";
-               cleanup();
        };
 }