summaryrefslogtreecommitdiff
path: root/lib/sbin/SystemInfo.pl
blob: 3af1eede115c4043e01a053915215b8d05c97d75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# this scrips gathers some basic info on the system it runs on.
# This is intended to be included in bugreports etc.

$config = $ARGV[0];
$home = `pwd`;
chop($home);

$sep = "/";

# Work out where the config directory is
if($ENV{"CONFIGS_DIR"})
{
  $configs_dir = $ENV{"CONFIGS_DIR"};
}
else
{
  $configs_dir = "configs";
}

$current_directory = `pwd`;
chop($current_directory);
$current_directory =~ s,^//([^/]+)/,$1:/,;


# Look to see if MPI is defined
$extra = "$current_directory${sep}configs${sep}$config${sep}config-data${sep}cctk_Extradefs.h";

$mpi = 0;
if (-e "$extra")
{
  open(EXTRA,"<$extra");
  while(<EXTRA>)
  {
    if (/\#define CCTK_MPI/)
    {
      $mpi = "MPI"
    }
    else 
    {
      $mpi = "NO MPI";
    }
  }
}

#Get the version number of the makefile
open (MF,"<Makefile");
while (<MF>)
  {
    if (/CCTK_VERSION_MAJOR\s+=\s+(\S+)/) 
      {
	$version.="$1.";
      }
    if (/CCTK_VERSION_MINOR\s*=\s*(\S+)/) 
      {
	$version.="$1.";
      }
    if (/CCTK_VERSION_OTHER\s*=\s*(\S+)/) 
      {
	$version.="$1";
      }
  }

close(MF);

#Get the CVS repository
if (-e "CVS/Root") 
{
   open(CVS,"CVS/Root");
   $cvsrep = <CVS>;
   chop($cvsrep);
} 
else
{
    printf "NO CVS";
}


#get the uname output
$uname = `uname -a`;
chop($uname);

#get hinv
if ($uname=~m/IRIX/i) 
{
  $hinv = `hinv`;
}


# Create sysinfo directory if needed
if (! -d "sysinfo")
{
  mkdir("sysinfo", 0755) || die "Unable to create sysinfo directory";
}

printf "Generating info file: sysinfo${sep}$config.sysinfo ...\n\n";

open (INFO,">sysinfo${sep}$config.sysinfo");

print INFO "VERSION: $version\n";
print INFO "UNAME  : $uname \n";
print INFO "MPI    : $mpi \n";
print INFO "CVSROOT: $cvsrep\n";
if ($hinv=~m/.*/) {
  print INFO "HINV   : $hinv \n";
}
close (INFO);