Subversion Repositories sysadmin_scripts

Rev

Rev 60 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#! /usr/bin/env perl

use warnings;
use strict;

BEGIN {
   use FindBin;
   use File::Spec;
}

# see https://metacpan.org/pod/release/JPEACOCK/version-0.97/lib/version.pod
use version; our $VERSION = version->declare("v1.0.0");
use Data::Dumper;

my $sourceDir = File::Spec->catdir($FindBin::Bin);

use Cwd;
use File::Copy;

my $dir = getcwd; # remember where we downloaded this to

my $os = qx/uname -a/;
if ( $os =~ m/linux/i ) {
   $os = 'linux';
} elsif ( $os =~m/freebsd/i ) {
   $os = 'freebsd';
}

my $installDir = shift;
$installDir = ($os eq 'freebsd' ? '/usr/local/opt' : '/opt' ) . '/sendEmail' unless $installDir;

print "Installation Directory = [$installDir]\n";

# get files from server
#`wget -q http://clara.dailydata.net:22080/uploadFiles299q/sendEmail/sendEmail.tgz`;

# Add sendEmail to server
`mkdir -p $installDir`;
copy( "$sourceDir/sendEmail.pl", "$installDir/sendEmail.pl" );
copy( "$sourceDir/sendmail2sendEmail.pl", "$installDir/sendmail2sendEmail.pl" );
`ln -s $installDir/sendEmail.pl $installDir/sendEmail`;
if ( $os eq 'linux' ) {
   `chown -fRv root:root $installDir`;
}elsif ( $os eq 'freebsd' ) {
   `chown -fRv root:wheel $installDir`;
}
`chmod 755 $installDir/*`;

print '1.56';
1;