Hi,
 I have modified the patch as John suggested. This patch will only copy a 
single file from local repository. If more than one instance of the same file 
exists in the subfolders then it will throw an error. I have used latest trunk 
(revision 31050) to test this patch.

Thanks John for your feedback.

Signed-off-by: Tathagata Das <[email protected]>

---

diff -Naur a/scripts/download.pl b/scripts/download.pl
--- a/scripts/download.pl       2012-03-05 10:44:02.000000000 +0530
+++ b/scripts/download.pl       2012-04-02 17:31:28.000000000 +0530
@@ -74,7 +74,18 @@
                if(! -d $target) {
                        system("mkdir -p $target/");
                }
-               system("cp -vf $cache/$filename $target/$filename.dl") == 0 or 
return;
+               system("find $cache -follow -name $filename 2>/dev/null 1>> 
temp.dls");
+               my $lines = `cat temp.dls | wc -l`;
+               if ($lines != 1 ) {
+                       system("echo Error : Number of instances of $filename 
in $cache is $lines");
+                       system("echo Only one instance allowed.");
+                       system("rm -f temp.dls");
+                       return;
+               }
+               else {
+                       system("cat temp.dls | xargs -i cp -vf {} 
$target/$filename.dl");
+                       system("rm -f temp.dls");
+               }
                system("$md5cmd $target/$filename.dl > 
\"$target/$filename.md5sum\" ") == 0 or return;
        } else {
                open WGET, "wget -t5 --timeout=20 --no-check-certificate 
$options -O- \"$mirror/$filename\" |" or die "Cannot launch wget.\n";


_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to