Subversion Repositories sysadmin_scripts

Rev

Rev 60 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 60 Rev 62
Line 1... Line 1...
1
#! /usr/bin/perl -w
1
#! /usr/bin/env perl
-
 
2
 
-
 
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);
2
 
16
 
3
use Cwd;
17
use Cwd;
4
use File::Copy;
18
use File::Copy;
5
 
19
 
6
my $dir = getcwd; # remember where we downloaded this to
20
my $dir = getcwd; # remember where we downloaded this to
7
 
21
 
-
 
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
 
8
my $installDir = shift;
29
my $installDir = shift;
9
$installDir = '/opt' unless $installDir;
30
$installDir = ($os eq 'freebsd' ? '/usr/local/opt' : '/opt' ) . '/sendEmail' unless $installDir;
10
 
31
 
-
 
32
print "Installation Directory = [$installDir]\n";
11
 
33
 
12
# get files from server
34
# get files from server
13
#`wget -q http://clara.dailydata.net:22080/uploadFiles299q/sendEmail/sendEmail.tgz`;
35
#`wget -q http://clara.dailydata.net:22080/uploadFiles299q/sendEmail/sendEmail.tgz`;
14
 
36
 
15
# Add sendEmail to server
37
# Add sendEmail to server
16
$installDir .= '/sendEmail';
-
 
17
`mkdir -p $installDir`;
38
`mkdir -p $installDir`;
18
copy( 'sendEmail.pl', "$installDir/sendEmail.pl" );
39
copy( "$sourceDir/sendEmail.pl", "$installDir/sendEmail.pl" );
19
copy( 'sendmail2sendEmail.pl', "$installDir/sendmail2sendEmail.pl" );
40
copy( "$sourceDir/sendmail2sendEmail.pl", "$installDir/sendmail2sendEmail.pl" );
20
`ln -s $installDir/sendEmail.pl $installDir/sendEmail`;
41
`ln -s $installDir/sendEmail.pl $installDir/sendEmail`;
-
 
42
if ( $os eq 'linux' ) {
21
`chown -fRv root:root $installDir`;
43
   `chown -fRv root:root $installDir`;
-
 
44
}elsif ( $os eq 'freebsd' ) {
-
 
45
   `chown -fRv root:wheel $installDir`;
-
 
46
}
22
`chmod 755 $installDir/*`;
47
`chmod 755 $installDir/*`;
23
 
48
 
24
print '1.56';
49
print '1.56';
25
1;
50
1;