Subversion Repositories camp_sysinfo_client_3

Rev

Blame | Last modification | View Log | RSS feed

#!/usr/bin/env perl

use warnings;

# special purpose for IPFire routers. NOT a stand alone, used as
# a part of install.pl
sub systemSpecificInstall {
   my @BACKUP_DIRS = ( '/etc/camp' );
   `ln -s /opt/camp/sysinfo/sysinfo-client /etc/fcron.daily/sysinfo.cron` if &yesno( 'Add link to fcron.daily' );
   # now, check for backup directories not in include.user
   open BACKUP, '</var/ipfire/backup/include.user';
   while ( $line = <BACKUP> ) {
      chomp $line;
      for (my $i = 0; $i < @BACKUP_DIRS; $i++ ) {
         if ( $BACKUP_DIRS[$i] eq $line ) {
            $BACKUP_DIRS[$i] = '';
            last;
         } # if
      }# for
   } # while
   close BACKUP;

   # if any remain, append them to include.user
   open BACKUP, '>>/var/ipfire/backup/include.user';
   foreach my $backupDir ( @BACKUP_DIRS ) {
      print BACKUP "$backupDir\n" if $backupDir;
   }
   close BACKUP;

   # set all modules with ipfire or unix in the name to run
   my $moduleDir = $moduleDirs[0];
   opendir $moduleDir, $moduleDir;
   my @modules = grep { /^((ipfire)|(unix))/ } readdir $moduleDir;
   closedir $moduleDir;
   foreach my $module ( @modules) {
      `chmod 0700 $moduleDir/$module`;
   }
   print "All IPFire specific modules have been enabled\n";
}

1;