Subversion Repositories sysadmin_scripts

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
62 rodolico 1
#! /usr/bin/env perl
59 rodolico 2
 
62 rodolico 3
use warnings;
4
use strict;
5
 
6
BEGIN {
7
   use FindBin;
8
   use File::Spec;
9
}
10
 
11
# see https://metacpan.org/pod/release/JPEACOCK/version-0.97/lib/version.pod
12
use version; our $VERSION = version->declare("v1.0.0");
13
use Data::Dumper;
14
 
15
my $sourceDir = File::Spec->catdir($FindBin::Bin);
16
 
59 rodolico 17
use Cwd;
60 rodolico 18
use File::Copy;
59 rodolico 19
 
20
my $dir = getcwd; # remember where we downloaded this to
21
 
62 rodolico 22
my $os = qx/uname -a/;
23
if ( $os =~ m/linux/i ) {
24
   $os = 'linux';
25
} elsif ( $os =~m/freebsd/i ) {
26
   $os = 'freebsd';
27
}
28
 
60 rodolico 29
my $installDir = shift;
62 rodolico 30
$installDir = ($os eq 'freebsd' ? '/usr/local/opt' : '/opt' ) . '/sendEmail' unless $installDir;
59 rodolico 31
 
62 rodolico 32
print "Installation Directory = [$installDir]\n";
60 rodolico 33
 
59 rodolico 34
# get files from server
60 rodolico 35
#`wget -q http://clara.dailydata.net:22080/uploadFiles299q/sendEmail/sendEmail.tgz`;
59 rodolico 36
 
37
# Add sendEmail to server
60 rodolico 38
`mkdir -p $installDir`;
62 rodolico 39
copy( "$sourceDir/sendEmail.pl", "$installDir/sendEmail.pl" );
40
copy( "$sourceDir/sendmail2sendEmail.pl", "$installDir/sendmail2sendEmail.pl" );
60 rodolico 41
`ln -s $installDir/sendEmail.pl $installDir/sendEmail`;
62 rodolico 42
if ( $os eq 'linux' ) {
43
   `chown -fRv root:root $installDir`;
44
}elsif ( $os eq 'freebsd' ) {
45
   `chown -fRv root:wheel $installDir`;
46
}
60 rodolico 47
`chmod 755 $installDir/*`;
59 rodolico 48
 
60 rodolico 49
print '1.56';
50
1;