Subversion Repositories camp_sysinfo_client_3

Rev

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