Subversion Repositories camp_sysinfo_client_3

Rev

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

Rev 100 Rev 101
Line 26... Line 26...
26
   use File::Spec;
26
   use File::Spec;
27
   use lib File::Spec->catdir($FindBin::Bin);
27
   use lib File::Spec->catdir($FindBin::Bin);
28
}
28
}
29
 
29
 
30
use sysinfoconf;
30
use sysinfoconf;
31
#use YAML::Tiny; # moved to after the call to check on libraries
31
use YAML::Tiny;
32
use Data::Dumper;
32
use Data::Dumper;
33
use File::Basename;
33
use File::Basename;
34
use Getopt::Long;
34
use Getopt::Long;
35
Getopt::Long::Configure ("bundling"); # allow -vd --os='debian'
35
Getopt::Long::Configure ("bundling"); # allow -vd --os='debian'
36
 
36
 
Line 224... Line 224...
224
                  'Exporter' => { 'debian' => 'apt-get -y install perl-base' },
224
                  'Exporter' => { 'debian' => 'apt-get -y install perl-base' },
225
                  'LWP' => { 
225
                  'LWP' => { 
226
                             'debian' => 'apt-get -y install libwww-perl',
226
                             'debian' => 'apt-get -y install libwww-perl',
227
                             'freebsd' => 'pkg install -y p5-libwww'
227
                             'freebsd' => 'pkg install -y p5-libwww'
228
                           },
228
                           },
229
                  'YAML::Tiny' => {
-
 
230
                              'debian' => 'apt-get -y install libyaml-tiny-perl',
-
 
231
                              'freebsd' => 'gunzip Tiny.pm.gz ; mkdir YAML ; mv Tiny.pm YAML'
-
 
232
                           },
-
 
233
                );
229
                );
234
 
230
 
235
# utilities md5sum
231
# utilities md5sum
236
# freebsd isomd5sum
232
# freebsd isomd5sum
237
 
233
 
Line 267... Line 263...
267
                            "\nand I don't know how to do this. Abort?" );
263
                            "\nand I don't know how to do this. Abort?" );
268
      }
264
      }
269
   } # if
265
   } # if
270
} # validateLibraries
266
} # validateLibraries
271
 
267
 
272
# checks various flags to 
-
 
273
 
-
 
274
sub determineOS {
-
 
275
   my $operatingSystems = shift;
-
 
276
   my $osType;
-
 
277
   # first, look through our entries for fileexists
-
 
278
   unless ( $os ) {
-
 
279
      foreach $osType ( keys %operatingSystems ) {
-
 
280
         next unless defined $operatingSystems->{$osType}->{'fileexists'};
-
 
281
         if (  -e $operatingSystems->{$osType}->{'fileexists'} ) {
-
 
282
            return $osType;
-
 
283
         } # if
-
 
284
      } # foreach
-
 
285
   } # unless
-
 
286
   # next, look for uname and see if that gives us a clue
-
 
287
   unless ( $os ) {
-
 
288
      my $osString = `uname -a`;
-
 
289
      foreach $osType ( keys %$operatingSystems ) {
-
 
290
         next unless defined $operatingSystems->{$osType}->{'regex'};
-
 
291
         print "Checking if OS is $osType in $osString\n" if $verbose > 2;
-
 
292
         if ( $osString =~ m/$$operatingSystems{$osType}{'regex'}/i ) {
-
 
293
            print "Yes, it is $osType\n" if $verbose > 2;
-
 
294
            return $osType;
-
 
295
         }
-
 
296
      } # foreach
-
 
297
   } # unless
-
 
298
   return '';
-
 
299
}
-
 
300
 
268
 
301
# attempt to locate the operating system.
269
# attempt to locate the operating system.
302
# if found, will set some defaults for it.
270
# if found, will set some defaults for it.
303
sub setUpOperatingSystemSpecific {
271
sub setUpOperatingSystemSpecific {
304
   my ( $install, $operatingSystems, $os ) = @_;
272
   my ( $install, $operatingSystems, $os ) = @_;
Line 542... Line 510...
542
# figure out if we know our operating system and set up special stuff for it
510
# figure out if we know our operating system and set up special stuff for it
543
$os = &setUpOperatingSystemSpecific( \%install, \%operatingSystems, $os );
511
$os = &setUpOperatingSystemSpecific( \%install, \%operatingSystems, $os );
544
 
512
 
545
&validateLibraries( \%libraries, $os );
513
&validateLibraries( \%libraries, $os );
546
 
514
 
547
# we don't get to use YAML unless it is installed
-
 
548
# so we have to put it in a conditional
-
 
549
eval( "use YAML::Tiny" );
-
 
550
 
-
 
551
$installType = &getInstallActions( \%install );
515
$installType = &getInstallActions( \%install );
552
 
516
 
553
# based on the defaults, flesh out the install hash
517
# based on the defaults, flesh out the install hash
554
$status = &populateSourceDir( \%install, $sourceDir );
518
$status = &populateSourceDir( \%install, $sourceDir );
555
 
519