| 1 |
#! /usr/bin/perl
|
| 2 |
|
| 3 |
# read one disk config file and define classes depending on partition names
|
| 4 |
# (c) Thomas Lange, 2001-2004, lange@informatik.uni-koeln.de
|
| 5 |
|
| 6 |
# since this is 70partition, it can't respect classes that are defined in a
|
| 7 |
# script after this script. But HOSTNAME is respected.
|
| 8 |
|
| 9 |
sub match {
|
| 10 |
# here you can add more definitions
|
| 11 |
m#\s/scratch\s# && print "NFS_SERVER SCRATCH ";
|
| 12 |
m#\s/files/scratch\s# && print "NFS_SERVER FILES_SCRATCH ";
|
| 13 |
m#\s/tmp\s# && print "TMP_PARTITION ";
|
| 14 |
}
|
| 15 |
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
| 16 |
# main routine is read only for you
|
| 17 |
foreach $class ( $ENV{HOSTNAME}, reverse split /\s+/, $ENV{classes}) {
|
| 18 |
$file = "$ENV{FAI}/disk_config/$class";
|
| 19 |
next unless -f $file;
|
| 20 |
open (PART,"<$file") || die "Can't open $file\n";
|
| 21 |
while (<PART>) {
|
| 22 |
# skip comments
|
| 23 |
next if /^#/;
|
| 24 |
&match;
|
| 25 |
}
|
| 26 |
close PART;
|
| 27 |
print "\n";
|
| 28 |
# read only one config file
|
| 29 |
exit 0;
|
| 30 |
}
|