~ubuntu-branches/ubuntu/precise/crossroads/precise

« back to all changes in this revision

Viewing changes to xr/etc/gettools

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Ritter
  • Date: 2010-07-05 16:27:00 UTC
  • Revision ID: james.westby@ubuntu.com-20100705162700-0g08tfav8ee9y51u
Tags: upstream-2.65
ImportĀ upstreamĀ versionĀ 2.65

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
}