#!/usr/bin/perl
$TARGET="/usr/local/bin";
print 'drsync.pl installer ($Id: install.pl,v 1.3 2002/07/06 16:58:18 dlux Exp $)'."\n";
eval {
  require File::Copy or die "You need to get and install File::Copy module from CPAN to use drsync!\n";
  @INC=grep { $_ ne '.' } @INC;
  require Getopt::Mixed and $has_gm=1;
};

my ($target_dir) = grep { /site.perl$/i } @INC;

if (!$has_gm) {
  mkdir $target_dir."/Getopt",0777;
  print "copying Getopt/Mixed.pm to $target_dir\n";
  File::Copy::copy("Getopt/Mixed.pm",$target_dir."/Getopt")
    or die "Cannot copy Getopt/Mixed.pm to $target_dir\n";
};

print "copying DRSync.pm to $target_dir\n";
File::Copy::copy("DRSync.pm", $target_dir)
  or die "Cannot copy DRSync.pm to $target_dir\n";

print "copying drsync.pl to $TARGET\n";
File::Copy::copy("drsync.pl",$TARGET)
  or die "Cannot copy drsync.pl to $TARGET\n";

chmod 0755,$TARGET."/drsync.pl", $target_dir."/DRSync.pm"
  or die "Cannot chmod drsync.pl or DRSync.pm";

