Subversion Repositories camp_sysinfo_client_3

Rev

Rev 224 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 224 Rev 225
Line 16... Line 16...
16
 
16
 
17
use Cwd qw(abs_path);
17
use Cwd qw(abs_path);
18
use sysinfosetup;
18
use sysinfosetup;
19
 
19
 
20
my $scriptDir = abs_path(File::Spec->catdir($FindBin::Bin) );
20
my $scriptDir = abs_path(File::Spec->catdir($FindBin::Bin) );
21
 
-
 
-
 
21
my $binDir = abs_path("$scriptDir/../");
22
use Digest::MD5 qw(md5_hex);
22
use Digest::MD5 qw(md5_hex);
23
use File::Copy;
23
use File::Copy;
24
 
24
 
25
# define the version number
25
# define the version number
26
# see https://metacpan.org/pod/release/JPEACOCK/version-0.97/lib/version.pod
26
# see https://metacpan.org/pod/release/JPEACOCK/version-0.97/lib/version.pod
Line 78... Line 78...
78
            ) or die "Error parsing command line\n";
78
            ) or die "Error parsing command line\n";
79
                  
79
                  
80
if ( $help ) { &help() ; exit; }
80
if ( $help ) { &help() ; exit; }
81
if ( $version ) { use File::Basename; print basename($0) . " $VERSION\n"; exit; }
81
if ( $version ) { use File::Basename; print basename($0) . " $VERSION\n"; exit; }
82
 
82
 
-
 
83
# find OS if they did not tell us what it was
-
 
84
$os = `$scriptDir/determineOS` unless $os;
-
 
85
print "Installing Conf and Cron for $os\n" unless $quiet;
-
 
86
 
83
my $returnValue = 0;
87
my $returnValue = 0;
-
 
88
my $command;
84
 
89
 
85
# load the definitions from installer_config.pl
90
# load the definitions from installer_config.pl
86
do "$scriptDir/installer_config.pl";
91
do "$scriptDir/installer_config.pl";
87
 
92
 
88
our %libraries;
93
our %libraries;
89
our %install;
94
our %install;
90
our %binaries;
95
our %binaries;
91
 
96
 
-
 
97
if ( $seedFileName =~ m'^((http)|(ftp))s?://' ) { # the seed file is a URL
-
 
98
   $command = "wget -O /tmp/seedfile --no-check-certificate $seedFileName";
-
 
99
   print "Downloading from $seedFileName\n\t$command\n" unless $quiet;
-
 
100
   `$command` unless $dryRun;
-
 
101
   $seedFileName = '/tmp/seedfile';
-
 
102
}
-
 
103
 
92
# Check for configuration file
104
# Check for configuration file
93
my $configDir = $operatingSystems{ $os }{'confdir'};
105
my $configDir = $operatingSystems{ $os }{'confdir'};
94
unless ( -d $configDir ) {
106
unless ( -d $configDir ) {
95
   print "Creating $configDir\n";
107
   $command = "mkdir -p $configDir";
-
 
108
   print "Creating $configDir\n\t$command\n" unless $quiet;
96
   `mkdir -p $configDir` unless $dryRun;
109
   `$command` unless $dryRun;
97
}
110
}
98
 
111
 
99
my $configFile = $operatingSystems{'configuration file'};
112
my $configFile = $operatingSystems{'configuration file'};
100
$configFile =~ s/<confdir>/$configDir/;
113
$configFile =~ s/<confdir>/$configDir/;
101
unless ( -f $configFile ) {
114
unless ( -f $configFile ) {
102
   print "Creating $configFile\n";
-
 
103
   $seedFileName = "$scriptDir/sysinfo-client.conf.template.yaml" unless $seedFileName;
115
   $seedFileName = "$scriptDir/sysinfo-client.conf.template.yaml" unless $seedFileName;
-
 
116
   $command = "cp $seedFileName $configFile";
-
 
117
   print "Creating $configFile\n\t$command\n" unless $quiet;
104
   `cp $seedFileName $configFile` unless $dryRun;
118
   `cp $seedFileName $configFile` unless $dryRun;
105
}
119
}
106
 
120
 
107
# check for cron file(s)
121
# check for cron file(s)
-
 
122
if ( defined( $operatingSystems{$os}{'crontab'} ) ) {
-
 
123
   my $command = $operatingSystems{$os}{'crontab'};
-
 
124
   $command =~ s/<bindir>/$binDir/;
-
 
125
   $command =~ s/<scriptdir>/$scriptDir/g;
-
 
126
   print "Setting up cron\n\t$command\n" unless $quiet;
-
 
127
   `$command` unless $dryRun;
-
 
128
}