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