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