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
 
26 rodolico 6
our $VERSION = '1.0';
7
 
21 rodolico 8
# special purpose for IPFire routers. NOT a stand alone, used as
9
# a part of install.pl
10
sub systemSpecificInstall {
22 rodolico 11
 
12
   if ( -d '/opt/sysinfo'
13
      && &yesno ('It looks like sysinfo version 2 is installed, should I remove it' ) ) {
14
      if ( &yesno( 'Back up old configuration? ') ) {
15
         `tar -czvf /root/sysinfo.2.config.tgz /etc/sysinfo`;
16
         print "Old configuration copied to /root/sysinfo.2.config.tgz\n";
17
      }
18
      `rm -fR /opt/sysinfo`;
19
      `rm -f /etc/fcron.daily/sysinfo.cron`;
20
      `cp -av /var/ipfire/backup/include.user /var/ipfire/backup/include.user.bak`;
21
      `grep -v sysinfo /var/ipfire/backup/include.user.bak > /var/ipfire/backup/include.user`;
22
   }
23
 
24
 
21 rodolico 25
   my @BACKUP_DIRS = ( '/etc/camp' );
22 rodolico 26
   `ln -s /opt/camp/sysinfo-client/sysinfo-client /etc/fcron.daily/sysinfo.cron`
27
      if &yesno( 'Add link to fcron.daily' );
21 rodolico 28
   # now, check for backup directories not in include.user
29
   open BACKUP, '</var/ipfire/backup/include.user';
30
   while ( $line = <BACKUP> ) {
31
      chomp $line;
32
      for (my $i = 0; $i < @BACKUP_DIRS; $i++ ) {
33
         if ( $BACKUP_DIRS[$i] eq $line ) {
34
            $BACKUP_DIRS[$i] = '';
35
            last;
36
         } # if
37
      }# for
38
   } # while
39
   close BACKUP;
40
 
41
   # if any remain, append them to include.user
42
   open BACKUP, '>>/var/ipfire/backup/include.user';
43
   foreach my $backupDir ( @BACKUP_DIRS ) {
44
      print BACKUP "$backupDir\n" if $backupDir;
45
   }
46
   close BACKUP;
47
 
48
   # set all modules with ipfire or unix in the name to run
49
   my $moduleDir = $moduleDirs[0];
50
   opendir $moduleDir, $moduleDir;
51
   my @modules = grep { /^((ipfire)|(unix))/ } readdir $moduleDir;
52
   closedir $moduleDir;
53
   foreach my $module ( @modules) {
54
      `chmod 0700 $moduleDir/$module`;
55
   }
56
   print "All IPFire specific modules have been enabled\n";
57
}
58
 
59
1;