Subversion Repositories camp_sysinfo_client_3

Rev

Rev 229 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
229 rodolico 1
#! /usr/bin/env perl
2
 
3
use warnings;
4
use strict;  
5
 
6
# find our location and use it for searching for libraries
7
BEGIN {
8
   use FindBin;
9
   use File::Spec;
10
   # use libraries from the directory this script is in
11
   use lib File::Spec->catdir($FindBin::Bin);
12
   # and its parent
13
   use lib File::Spec->catdir( $FindBin::Bin . '/../' );
14
   eval( 'use YAML::Tiny' );
15
}
16
 
17
use Cwd qw(abs_path);
18
use sysinfosetup;
19
 
20
our $DEBUG;
21
# $DEBUG = 1;
22
 
23
my $scriptDir = abs_path(File::Spec->catdir($FindBin::Bin) );
24
my $binDir = abs_path("$scriptDir/../"); # bin directory assumed to be above this one
25
 
26
sub checkDirectory {
27
   my $directory = shift;
28
   print "In checkDirectory, looking in $directory\n";
29
   my @dirs;
30
 
31
   if ( -d $directory ) { # we found a modules directory
32
      opendir( my $dh, $directory ) || die "Could not read from $scriptDir/modules:$!\n";
33
      @dirs = grep { -f "$directory/$_" } readdir($dh);
34
      closedir $dh;
35
   }
36
   #die "dirs is " . join("\n", @dirs ) . "\n";
37
   while ( my $script = shift(@dirs) ) {
38
      next if $script =~ /\..+$/; # ignore anything with a period in it
39
      next if $script =~ /README/; # ignore readme
40
      print "Checking $directory/$script\n";
230 rodolico 41
      &runCommand( "chmod 755 $directory/$script" );
229 rodolico 42
      my $output = `$directory/$script $directory`;
43
      my $mod = $output ? '700' : '600';
44
      &runCommand( "chmod $mod $directory/$script" );
45
   }
46
}
47
 
48
# setting permissions
49
 
50
&runCommand( "chown -fR root:root $binDir" );
51
&runCommand( "chmod 700 $binDir/sysinfo-client" );
52
&runCommand( "chmod 700 $binDir/configure" );
53
 
54
&checkDirectory( "$binDir/modules" );