Subversion Repositories camp_sysinfo_client_3

Rev

Rev 28 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#!/usr/bin/env perl

use warnings;
use strict;  

our $VERSION = '1.1.1';
our @moduleDirs;

# some debian specific things. NOT a stand alone; loaded by install.pl
sub systemSpecificInstall {
   if ( &yesno( 'Add link to cron.daily' ) ) {
      `rm /etc/cron.daily/sysinfo` if -e '/etc/cron.daily/sysinfo';
      `ln -s /opt/camp/sysinfo-client/sysinfo-client /etc/cron.daily/sysinfo`;
   }
   if ( `dpkg --get-selections | grep  sysinfo-client | grep install` 
      && &yesno ('It looks like sysinfo version 2 is installed via apt, should I remove it' ) ) {
      if ( &yesno( 'Back up old configuration? ') ) {
         `tar -czvf /root/sysinfo.2.config.tgz /etc/sysinfo`;
         print "Old configuration copied to /root/sysinfo.2.config.tgz\n";
      }
      system 'apt-get -y --purge remove sysinfo-client';
      print "There may be some unused packages now. You can remove them with\napt-get autoremove\n\n";
   }
   if ( &yesno( 'Would you like a link to /usr/local/bin/sysinfo-client' ) ) {
      `rm /usr/local/bin/sysinfo-client` if -e '/usr/local/bin/sysinfo-client';
      `ln -s  /opt/camp/sysinfo/sysinfo-client /usr/local/bin/sysinfo-client`;
   }

   # set all modules with debian or unix in the name to run
   foreach my $directory ( @moduleDirs ) {
      my $dh;
      opendir ( $dh, $directory ) or die "Could not open directory [$directory]\n";
      my @modules = grep { /^((dpkg)|(unix))/ } readdir $dh;
      closedir $dh;
      foreach my $module (@modules) {
         `chmod 0700 $directory/$module`;
         `chown root:root $directory/$module`;
      }
   }
   print "All debian specific modules have been enabled\n";
}

1;