crossroads

Git mirror of https://crossroads.e-tunity.com/
git clone git://git.finwo.net/app/crossroads
Log | Files | Refs | LICENSE

gettools (615B)


      1 #!/usr/bin/perl
      2 
      3 use strict;
      4 
      5 die ("Usage: gettools SRCDIR DSTDIR TOOL [TOOL...]\n")
      6   if ($#ARGV < 2);
      7 
      8 my $srcdir = shift (@ARGV);
      9 die ("gettools: source dir $srcdir not found\n") unless (-d $srcdir);
     10 my $dstdir = shift (@ARGV);
     11 die ("gettools: dest dir $dstdir not found\n") unless (-d $dstdir);
     12 for my $t (@ARGV) {
     13     gettool ($srcdir, $dstdir, $t);
     14 }
     15 
     16 sub gettool ($$$) {
     17     my ($sd, $dd, $t) = @_;
     18     my $src = "$sd/$t";
     19     return unless (-f $src);
     20     my $dst = "$dd/$t";
     21 
     22     if (! -f $dst or
     23 	(stat($src))[9] > (stat($dst))[9]) {
     24 	system ("cp '$src' '$dst'") and die ("gettools: cp failed\n");
     25     }
     26 }