Subversion Repositories camp_sysinfo_client_3

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
21 rodolico 1
#!/usr/bin/env perl
2
 
3
use warnings;
26 rodolico 4
use strict;  
21 rodolico 5
 
26 rodolico 6
our $VERSION = '1.0';
7
 
21 rodolico 8
# some debian specific things. NOT a stand alone; loaded by install.pl
9
sub systemSpecificInstall {
10
   if ( &yesno( 'Add link to cron.daily' ) ) {
11
      `rm /etc/cron.daily/sysinfo` if -e '/etc/cron.daily/sysinfo';
12
      `ln -s /opt/camp/sysinfo-client/sysinfo-client /etc/cron.daily/sysinfo`;
13
   }
14
   if ( `dpkg --get-selections | grep  sysinfo-client | grep install` 
15
      && &yesno ('It looks like sysinfo version 2 is installed via apt, should I remove it' ) ) {
16
      if ( &yesno( 'Back up old configuration? ') ) {
17
         `tar -czvf /root/sysinfo.2.config.tgz /etc/sysinfo`;
18
         print "Old configuration copied to /root/sysinfo.2.config.tgz\n";
19
      }
23 rodolico 20
      system 'apt-get -y --purge remove sysinfo-client';
21 rodolico 21
      print "There may be some unused packages now. You can remove them with\napt-get autoremove\n\n";
22
   }
23
   if ( &yesno( 'Would you like a link to /usr/local/bin/sysinfo-client' ) ) {
24
      `rm /usr/local/bin/sysinfo-client` if -e '/usr/local/bin/sysinfo-client';
25
      `ln -s  /opt/camp/sysinfo/sysinfo-client /usr/local/bin/sysinfo-client`;
26
   }
27
 
28
   # set all modules with debian or unix in the name to run
29
   foreach my $directory ( @moduleDirs ) {
30
      opendir ( $dh, $directory ) or die "Could not open directory [$directory]\n";
31
      my @modules = grep { /^((dpkg)|(unix))/ } readdir $dh;
32
      closedir $dh;
33
      foreach my $module (@modules) {
34
         `chmod 0700 $directory/$module`;
35
         `chown root:root $directory/$module`;
36
      }
37
   }
38
   print "All debian specific modules have been enabled\n";
39
}
40
 
41
1;