#! /usr/bin/perl # read one disk config file and define classes depending on partition names # (c) Thomas Lange, 2001-2004, lange@informatik.uni-koeln.de # since this is 70partition, it can't respect classes that are define in a # script after this script. But HOSTNAME is respected. sub match { # here you can add more definitions m#\s/scratch\s# && print "NFS_SERVER SCRATCH "; m#\s/files/scratch\s# && print "NFS_SERVER FILES_SCRATCH "; m#\s/tmp\s# && print "TMP_PARTITION "; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - # main routine is read only for you foreach $class ( $ENV{HOSTNAME}, reverse split /\s+/, $ENV{classes}) { $file = "$ENV{FAI}/disk_config/$class"; next unless -f $file; open (PART,"<$file") || die "Can't open $file\n"; while () { # skip comments next if /^#/; &match; } close PART; print "\n"; # read only one config file exit 0; }