download.pl: properly cleanup intermediate .hash file
[openwrt/staging/chunkeey.git] / scripts / download.pl
index c1623bf91fe01b3096a710e72f3167bd9e242163..2876ae5807cd5611cf1d94591d506feba2c4dfc0 100755 (executable)
@@ -273,11 +273,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();
        };
 }