Subversion Repositories camp_sysinfo_client_3

Rev

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

Rev 55 Rev 57
Line 1... Line 1...
1
#! /usr/bin/env perl
1
#! /usr/bin/env perl
2
 
2
 
3
 
-
 
4
use strict;
3
use strict;
5
use warnings;
4
use warnings;
6
 
5
 
7
# install.pl
6
# install.pl
8
#
7
#
Line 45... Line 44...
45
 
44
 
46
my $status; # exit status of the processes
45
my $status; # exit status of the processes
47
my $sourceDir = File::Spec->catdir($FindBin::Bin);
46
my $sourceDir = File::Spec->catdir($FindBin::Bin);
48
my $installType;
47
my $installType;
49
 
48
 
-
 
49
 
50
my %install = (  'bindir' => '/opt/camp/sysinfo-client',
50
my %install = (  'bindir' => '/opt/camp/sysinfo-client',
51
                 'confdir' => '/etc/camp/sysinfo-client',
51
                 'confdir' => '/etc/camp/sysinfo-client',
52
                 'application name' => 'sysinfo client',
52
                 'application name' => 'sysinfo client',
53
                 'default group' => 'root',
53
                 'default group' => 'root',
54
                 'default owner' => 'root',
54
                 'default owner' => 'root',
Line 143... Line 143...
143
my %operatingSystems = (
143
my %operatingSystems = (
144
                  'debian' => {
144
                  'debian' => {
145
                     'bindir' => '/opt/camp/sysinfo-client',
145
                     'bindir' => '/opt/camp/sysinfo-client',
146
                     'confdir' => '/etc/camp/sysinfo-client',
146
                     'confdir' => '/etc/camp/sysinfo-client',
147
                     'crontab' => 'ln -s <bindir>/sysinfo-client /etc/cron.daily/sysinfo-client',
147
                     'crontab' => 'ln -s <bindir>/sysinfo-client /etc/cron.daily/sysinfo-client',
148
                     'modules' => '((dpkg)|(unix)|(ipmi)|(xen))',
148
                     'modules' => '((linux)|(dpkg)|(unix)|(all))',
149
                  },
149
                  },
150
                  'ipfire' => {
150
                  'ipfire' => {
151
                     'bindir' => '/opt/camp/sysinfo-client',
151
                     'bindir' => '/opt/camp/sysinfo-client',
152
                     'confdir' => '/etc/camp/sysinfo-client',
152
                     'confdir' => '/etc/camp/sysinfo-client',
153
                     'crontab' => 'ln -s <bindir>/sysinfo-client /etc/fcron.daily/sysinfo-client.fcron',
153
                     'crontab' => 'ln -s <bindir>/sysinfo-client /etc/fcron.daily/sysinfo-client.fcron',
154
                     'modules' => '((ipfire)|(unix))',
154
                     'modules' => '((ipfire)|(unix)|(all))',
155
                  },
155
                  },
156
                  'freebsd' => {
156
                  'freebsd' => {
157
                     'bindir' => '/usr/local/opt/camp/sysinfo-client',
157
                     'bindir' => '/usr/local/opt/camp/sysinfo-client',
158
                     'confdir' => '/usr/local/etc/camp/sysinfo-client',
158
                     'confdir' => '/usr/local/etc/camp/sysinfo-client',
159
                     'crontab' => 'ln -s <bindir>/sysinfo-client /etc/periodic/daily/sysinfo-client',
159
                     'crontab' => 'ln -s <bindir>/sysinfo-client /etc/periodic/daily/sysinfo-client',
160
                     'modules' => '((bsd)|(unix))',
160
                     'modules' => '((bsd)|(unix)|(all))',
161
                    'default group' => 'wheel',
161
                    'default group' => 'wheel',
162
                    'default owner' => 'root',
162
                    'default owner' => 'root',
163
                  },
163
                  },
164
                  
164
                  
165
                );
165
                );
Line 479... Line 479...
479
 
479
 
480
$status = &doInstall( \%install );
480
$status = &doInstall( \%install );
481
 
481
 
482
$status = &postInstall( \%install );
482
$status = &postInstall( \%install );
483
 
483
 
-
 
484
# create uninstaller script
-
 
485
# find the last non-space string in the crontab value. This is the target of the link
-
 
486
$install{'crontab'} =~ m/([^ ]+)$/;
-
 
487
my $uninstall = "#! /usr/bin/env sh\n\n# Uninstall syinfo\nrm -fR $install{'bindir'} $install{'confdir'} $1\n";
-
 
488
my $outFileName = $install{'bindir'} . '/uninstall';
-
 
489
open UNINSTALL, ">$outFileName" or die "could not write to $outFileName: $!\n";
-
 
490
print UNINSTALL $uninstall;
-
 
491
close UNINSTALL;
-
 
492
qx ( chmod 700 $outFileName );
-
 
493
 
-
 
494
print "Uninstall script has been created at $outFileName\n";
-
 
495
 
484
if ( ( -x $install{'configuration'}{'configurator'} ) && $install{'build config'} ) {
496
if ( ( -x $install{'configuration'}{'configurator'} ) && $install{'build config'} ) {
485
   exec( $install{'configuration'}{'configurator'} );
497
   exec( $install{'configuration'}{'configurator'} );
486
} else {
498
} else {
487
   print "Done, you should check the files in $install{'bindir'} and $install{'confdir'} before running\n";
499
   print "Done, you should check the files in $install{'bindir'} and $install{'confdir'} before running\n";
488
   print "If you need help configuring, the helper app at\n$install{'configuration'}{'configurator'}\ncan be used.\n";
500
   print "If you need help configuring, the helper app at\n$install{'configuration'}{'configurator'}\ncan be used.\n";
489
}
501
}
490
 
502
 
491
1;   
503
1;   
492
 
504
 
493
 
505
 
494
# add uninstall, clean to install.pl
-
 
495
# clean will look for any file in bindir which is NOT in the list of available files and remove them
506
# clean will look for any file in bindir which is NOT in the list of available files and remove them
496
# if files already exist in install, preserve their permissions
507
# if files already exist in install, preserve their permissions