#!/usr/bin/perl -w @machines=('all', 'v12', 'alanine', 'cysteine', 'isoleucine', 'lysine', 'tryptophan', 'tyrosine', 'proline'); if (scalar(@ARGV) != 1) { print "Usage: $0 \n"; print " where is one of the following:\n"; foreach $_ (@machines) { print " $_\n"; } exit; } $machine=$ARGV[0]; # Make sure we know what machine to build for $found = 0; foreach $_ (@machines) { if ($_ eq $machine) { $found = 1; } } if ($found == 0) { die "$machine not recognized. Cannot build kickstart configuration file\n"; } # Construct list of machines to build for if ($machine eq 'all') { shift(@machines); } else { @machines=($machine); } # Start building foreach $machine (@machines) { open(KSFILE, ">ks-$machine.cfg") || die "Unable to open ks-$machine.cfg for writing\n"; open(KSTMPL, ") { if (/^# Kickstart Template/) { print KSFILE "# Kickstart File for $machine - generated by mkkickstart\n"; } else { # if a : start the line, check if its the machine. If not, read until the next colon until :. is encountered if (/^:/) { while ($_ !~ /^:\./) { if (/$machine/) { $_ = ; while ($_ !~ /^:/) { print KSFILE $_; $_ = ; } } else { $_ = ; while ($_ !~ /^:/) { $_ = ; } } } } else { print KSFILE $_; } } } close(KSTMPL); close(KSFILE); }